A production-minded, contributor-friendly monorepo starter for Express (Node.js) + React (Vite) with Postgres (Prisma) and a secure default auth setup (JWT access + rotating refresh tokens).
- Monorepo layout:
apps/+packages/+infra/+docs/ - Backend (Express, ES Modules):
- Clean layering: routes → controllers → services → models
- JWT auth: register/login/refresh/logout
- Refresh token rotation (stored hashed in DB, delivered via httpOnly cookie)
- Role-based access control middleware (admin example endpoint)
- Zod request validation + global error handler
- Frontend (React + Vite):
- Login/Register/Dashboard pages
- Axios API client with refresh-on-401 retry
- Minimal, clean UI (easy to replace with any design system)
- Shared package: common types + small shared schemas
- Infra: Docker compose for Postgres + dev containers
- Backend: Node.js, Express, Prisma, Zod, JWT
- Frontend: React, Vite, React Router, Axios
- DB: Postgres
- Monorepo: pnpm workspaces
- Node.js 20+
- pnpm (
corepack enable) - Docker Desktop (recommended for Postgres)
Copy the example:
cp .env.example .env(or create.envmanually on Windows)
From repo root:
docker compose -f infra/docker/docker-compose.yml --env-file .env up --buildThen open:
- Frontend:
http://localhost:5173 - Backend:
http://localhost:4000
In another terminal (repo root):
pnpm -C apps/backend prisma:generate
pnpm -C apps/backend prisma:migrate:dev --name initIf you want to run apps locally and only run Postgres via Docker:
docker compose -f infra/docker/docker-compose.yml --env-file .env up postgres -d
pnpm install
pnpm devapps/
backend/ # Express API (ESM): routes → controllers → services → models
frontend/ # React + Vite app
packages/
shared/ # Shared types and utilities
infra/
docker/ # docker-compose + Dockerfiles
aws/ # optional deployment scaffolding
docs/
architecture.md
good-first-issues.md
.github/
ISSUE_TEMPLATE/
pull_request_template.md
GET /healthPOST /auth/registerPOST /auth/loginPOST /auth/refresh(uses httpOnly cookie)POST /auth/logoutGET /users/me(requires access token)GET /users/admin(requiresadminrole)
See CONTRIBUTING.md. Good beginner tasks are listed in docs/good-first-issues.md.
- Add JWT refresh token replay detection improvements (token family)
- Add rate limiting + request logging (pino)
- Add testing: unit + integration (supertest) + frontend component tests
- Add OpenAPI docs + API client generation
- Add CI: lint/typecheck/test, Docker build