Skip to content

feat: --layout monorepo (pragmatic-layered, pnpm workspaces) for FE+BE #81

Description

@spencer-osbrjp

Context

Org practice is DDD + monorepo whenever FE and BE ship together. Add a --layout monorepo (default flat) that, when a backend is selected, emits a pnpm-workspace monorepo instead of a colocated single package.

Chosen shape (pragmatic layered)

<name>/
  package.json          # private workspace root: scripts + packageManager
  pnpm-workspace.yaml    # apps/*, packages/*
  apps/
    web/                 # the current frontend scaffold + its package.json
    api/                 # backend (hono/elysia + orm/db) + its package.json  [only if --backend]
  packages/
    domain/              # shared contract: zod schemas + types (workspace:* dep)
  • Tooling: pnpm workspaces (matches default PM).
  • packages/domain is the shared kernel; when --validation zod it ships an example schema, otherwise plain TS types. Both apps depend on it via workspace:*.

Scope

  • pkg/config.go: Layout enum + field (flat|monorepo), default flat
  • cmd/create.go: --layout flag + validation
  • pkg/scaffold.go: layout-aware roots — FE → apps/web, backend/orm → apps/api, plus root workspace files + packages/domain
  • pkg/packagejson.go: split package.json generation (web / api / domain / root); FE build skips backend/orm deps in monorepo mode
  • config/templates/monorepo/*: root package.json, pnpm-workspace.yaml, domain package, api tsconfig
  • Tests

Notes / out of scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions