1- # Template
1+ # NestJs Fastify React Full Stack Template
22
33A reusable full-stack TypeScript application template with NestJS, Fastify,
44React, PostgreSQL, Redis, Docker Compose, and observability built in. See
5- ` AGENTS.md ` for conventions, ` docs/adr/ ` for recorded architectural decisions,
6- and ` docs/runbooks/ ` for operational guides.
5+ ` CONTRIBUTING.md ` for contribution guidance, ` AGENTS.md ` for conventions,
6+ ` docs/adr/ ` for recorded architectural decisions, and ` docs/runbooks/ ` for
7+ operational guides.
78
8- ## Quick start
9+ ## Project scope
910
10- ``` bash
11- nvm use # Node 24
12- corepack enable # pnpm 11
13- pnpm install
14- cp .env.example .env # docker-compose values; not committed
15- # Install once per Docker host. Use 3.7.0-arm64 on ARM64 hosts.
16- docker plugin install grafana/loki-docker-driver:3.7.0 --alias loki --grant-all-permissions
17- pnpm compose up -d # postgres, redis, prometheus, grafana, loki, tempo
18- pnpm dev
19- ```
11+ This template is intentionally kept minimal. It provides the foundation for a
12+ full-stack service, but it does not try to include every capability a real
13+ product usually needs.
2014
21- After cloning for a new project, run the one-time rename helper:
15+ There is no authentication, authorisation, user management, rate limiting,
16+ abuse prevention, billing, background job system, email delivery, object
17+ storage, feature flagging, admin area, or domain-specific workflow. Add those
18+ pieces deliberately based on the product you are building, rather than carrying
19+ generic defaults that may not fit.
20+
21+ ## Tech stack
22+
23+ | Layer | Tech |
24+ | --- | --- |
25+ | Monorepo | pnpm workspaces, TypeScript |
26+ | Backend | NestJS, Fastify |
27+ | Frontend | Vite, React, Tailwind CSS, shadcn/ui |
28+ | Database | PostgreSQL, Kysely, kysely-codegen |
29+ | Cache | Redis |
30+ | Validation and config | Zod |
31+ | Testing | Vitest, Playwright browser mode, Testcontainers |
32+ | Linting and formatting | Biome |
33+ | Container runtime | Docker, Docker Compose |
34+ | Observability | Prometheus, Grafana, Loki, Tempo, OpenTelemetry Collector |
35+ | Git workflow | Lefthook, commitlint, conventional commits |
36+
37+ ## Template cloning and project init
2238
2339``` bash
40+ git clone https://github.com/dearzubi/nestjs-fastify-react-template.git my-app
41+ cd my-app
2442bash scripts/init-project.sh acme
2543```
2644
@@ -30,10 +48,68 @@ database placeholders, compose identifiers, and observability queries. It also
3048adds ` docs/superpowers/ ` to ` .git/info/exclude ` for local AI-agent working
3149files.
3250
51+ ## Quick start
52+
53+ ### 1. Set up local tooling
54+
55+ ``` bash
56+ nvm use
57+ corepack enable
58+ ```
59+
60+ The Docker Compose stack uses the Loki Docker logging driver. Install it once
61+ per Docker host. Use ` 3.7.0-arm64 ` on ARM64 hosts.
62+
63+ ``` bash
64+ docker plugin install grafana/loki-docker-driver:3.7.0 --alias loki --grant-all-permissions
65+ ```
66+
67+ ### 2. Install dependencies
68+
69+ ``` bash
70+ pnpm install
71+ ```
72+
73+ ### 3. Build the project
74+
75+ ``` bash
76+ pnpm build
77+ ```
78+
79+ ### 4. Prepare the root environment file
80+
81+ ``` bash
82+ cp .env.example .env
83+ ```
84+
85+ The root ` .env ` is used by Docker Compose and is not committed.
86+
3387Per-app env files (` apps/*/.env ` , ` apps/*/.env.development ` ) are committed
3488with safe defaults and are loaded automatically. Override locally with
3589` apps/*/.env.local ` or ` apps/*/.env.development.local ` (both gitignored).
3690
91+ If the default Postgres host port is already in use, change ` POSTGRES_PORT ` in
92+ the root ` .env ` and set ` DATABASE_URL ` in ` apps/backend/.env.development.local `
93+ to the same host port.
94+
95+ ### 5. Run with local Node processes
96+
97+ Use Docker Compose for the supporting services, then run the backend and web app
98+ through pnpm.
99+
100+ ``` bash
101+ pnpm compose up -d postgres redis
102+ pnpm dev
103+ ```
104+
105+ ### 6. Run fully through Docker Compose
106+
107+ Use this when you want the app and supporting services to run in containers.
108+
109+ ``` bash
110+ pnpm compose up -d --build
111+ ```
112+
37113## Single-VPS production
38114
39115See [ VPS production deployment] ( docs/runbooks/vps-production-deployment.md )
0 commit comments