A pnpm workspace with two main packages available at the root:
client: Next.js app (Frontend)server: NestJS API (Backend)
- Node.js 22.x
- pnpm 10.25.0
- Postgres (local) for server development
-
Install Dependencies
pnpm install
This installs dependencies for both
clientandserver. -
Setup Database Ensure your local Postgres is running.
# Set the database URL environment variable (required for Prisma) export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres" # Generate Prisma Client pnpm --filter server prisma:generate # Or using the root alias: pnpm prebuild # Push the schema to your local database pnpm --filter server prisma:migrate # Or using the root alias: pnpm migrate
-
Generate API Client The frontend uses a generated TypeScript client to interact with the backend API.
pnpm --filter client openapi
This runs
openapi-generator-cliusing the configuration inclient/openapi-generator.config.json. -
Run Development Server Start both client and server in parallel:
pnpm dev
- Client: http://localhost:3001
- Server: http://localhost:3000
Since this is a monorepo, you must specify which package to install dependencies into.
- Add a runtime dependency (e.g.,
lodashto client):pnpm add lodash --filter client
- Add a dev dependency (e.g.,
jestto server):pnpm add -D jest --filter server
- Remove a dependency:
pnpm remove <package_name> --filter client
- Add to both packages:
pnpm add <package_name> --filter client --filter server
- Build everything:
pnpm build
- Start production:
pnpm start
- Build/Start individual apps:
pnpm build:client pnpm build:server
- Server Tests:
pnpm --filter server test pnpm --filter server test:e2e - Lint Code:
pnpm lint
The project uses pnpm workspaces defined in pnpm-workspace.yaml.
/
├── client/ # Next.js Frontend
│ ├── openapi-generator.config.json
│ └── package.json
├── server/ # NestJS Backend
│ ├── prisma/
│ └── package.json
├── .changeset/ # Versioning configuration
├── package.json # Root scripts & dev dependencies
└── pnpm-workspace.yaml
- Config at
.changeset/config.json. - Create a changeset (run this when you make changes):
pnpm changeset
- Apply versions and update lockfile (CI/CD usually handles this):
pnpm version-packages
- Build and publish:
pnpm release
- Hooks installation: automatic on
pnpm installviapreparescript. - Pre-commit: runs
pnpm run lint. - Commit message check: enforces Conventional Commits.
feat: add homepage hero
fix(server): handle missing env var
chore(client): update eslint config
docs: update README
- Port Conflicts:
- Client defaults to port
3001(configured inclient/package.json). - Server defaults to port
3000. - If you encounter
EADDRINUSE, check for running processes or adjust ports.
- Client defaults to port
- Prisma Client Not Found:
- If the server fails to start with this error, run
pnpm --filter server prisma:generateto regenerate the client.
- If the server fails to start with this error, run