https://github.com/justyn-clark/nestjs-react-router
A modern, production-ready monorepo combining NestJS backend with React Router 7 frontend, featuring server-side rendering, client-side navigation, and enterprise-grade architecture. Built with TypeScript, Fastify, Drizzle ORM, Redis, and Tailwind CSS.
https://github.com/justyn-clark/nestjs-react-router
backend drizzle-orm fastify full-stack monorepo nestjs nodejs postgresql production-ready react react-router redis server-side-rendering ssr tailwindcss turborepo typescript vite web-framework
Last synced: 3 days ago
JSON representation
A modern, production-ready monorepo combining NestJS backend with React Router 7 frontend, featuring server-side rendering, client-side navigation, and enterprise-grade architecture. Built with TypeScript, Fastify, Drizzle ORM, Redis, and Tailwind CSS.
- Host: GitHub
- URL: https://github.com/justyn-clark/nestjs-react-router
- Owner: justyn-clark
- License: mit
- Created: 2025-10-01T07:25:16.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2026-05-06T00:49:15.000Z (about 2 months ago)
- Last Synced: 2026-05-06T02:33:39.975Z (about 2 months ago)
- Topics: backend, drizzle-orm, fastify, full-stack, monorepo, nestjs, nodejs, postgresql, production-ready, react, react-router, redis, server-side-rendering, ssr, tailwindcss, turborepo, typescript, vite, web-framework
- Language: TypeScript
- Homepage:
- Size: 614 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NestJS React Router
A truthful, opinionated starter where NestJS 11 hosts and renders a React Router 7 app with SSR, React 19, PostgreSQL persistence, Redis-backed state, and shared workspace packages.
## Why this starter
Use this if you want:
- one Nest-hosted full-stack app instead of a fake split frontend/backend setup
- SSR with React Router 7
- PostgreSQL via Drizzle
- Redis-backed sessions and queue wiring
- deterministic verification that is friendly to both humans and agents
## Why it saves work
This starter packages roughly 778k fresh agent-work tokens of solved product and integration work. Starting here means you do not have to spend that work rediscovering the NestJS/React Router seams, workspace wiring, docs, and verification loop from scratch.
See `docs/token-estimate.md` for the detailed estimate and caveats.
## What it includes
- NestJS 11 on Fastify 5
- React 19 + React Router 7 SSR bridge
- pnpm workspace + Turborepo layout
- route-module manifest pattern for feature-oriented routing
- PostgreSQL package with Drizzle schema and helpers
- Redis-backed sessions
- BullMQ demo queue wiring
- contact submission flow persisted to PostgreSQL
- health endpoint covering Redis and PostgreSQL
- CI, devcontainer config, and release docs
- end-to-end smoke coverage against a running built app
- a tech stack map for modern and agent-legible application building
- a starter control plane with slash-command palette, activity feed, task runs, and realtime events
## Intentional seams
This starter is publishable and usable, but it stays honest about what is still demo-level:
- auth is demo auth, not a production identity system
- queue processing is demo scaffolding
## Quick start
### Local services already available
```bash
cp .env.example .env
pnpm install
pnpm db:push
pnpm dev
```
Open `http://localhost:3000`.
`pnpm db:push` will create the `DATABASE_URL` database when it does not exist and the configured Postgres user has `CREATEDB` permission. With hosted or restricted Postgres users, create the database manually first and then run `pnpm db:push`.
### Compose-backed path
If ports `3000`, `5432`, or `6379` are already occupied:
```bash
cp .env.example .env
export NRR_APP_PORT=3300
export NRR_POSTGRES_PORT=55432
export NRR_REDIS_PORT=56379
pnpm docker:up
DATABASE_URL=postgres://postgres:postgres@localhost:${NRR_POSTGRES_PORT}/appdb pnpm db:push
pnpm start
```
Open `http://localhost:${NRR_APP_PORT}`.
### Full compose app container
```bash
export NRR_APP_PORT=3300
export NRR_POSTGRES_PORT=55432
export NRR_REDIS_PORT=56379
pnpm docker:up:build
```
## Verify it
```bash
pnpm verify
pnpm start
pnpm test:e2e
```
## Runtime shape
This is one Nest-hosted full-stack application.
- Nest handles API routes, auth/session endpoints, and SSR orchestration
- React Router is rendered and served through Nest
- client assets are served from the built web output
It is not two independently deployed apps pretending to be one product.
## Main routes and endpoints
The web shell now includes a small control-plane layer:
- slash-command palette
- realtime activity feed
- task/run surface
- app-native control actions such as enqueueing the demo job
- PostgreSQL-backed persistence for recent task runs and activity events
Browser routes:
- `/`
- `/stream`
- `/contact`
- `/dashboard`
- `/test`
HTTP endpoints:
- `GET /api/health`
- `GET /api/control-plane/summary`
- `GET /api/control-plane/events`
- `POST /api/contact`
- `GET /api/session-debug`
- `GET /api/queue/add`
- `POST /auth/login`
- `POST /auth/logout`
- `GET /auth/me`
## Commands
```bash
pnpm dev
pnpm start
pnpm verify
pnpm start
pnpm test:e2e
pnpm db:push
pnpm docker:up
pnpm docker:up:build
pnpm docker:down
```
## Read next
- Architecture: `docs/architecture.md`
- Local development: `docs/local-development.md`
- Agent legibility: `docs/agent-legibility.md`
- Token estimate note: `docs/token-estimate.md`
- Tech stack map: `docs/tech-stack-map.md`
- Release checklist: `docs/release-checklist.md`
- Route notes: `apps/web/src/routes/README.md`
- Secrets guidance: `SECRETS_POLICY.md`
## License
MIT. See `LICENSE`.