Harden template for production: add comments, fix bugs, add lock file

- Add inline comments to docker-compose.yml explaining the 5 key rules
  (expose vs ports, DB host, DB name persistence, no Traefik labels)
- Add comments to Dockerfile explaining multi-stage build, layer caching,
  and why .dockerignore excludes client/dist
- Add comments to .dockerignore explaining each exclusion
- Fix dev script: use nodemon (auto-restart) instead of node for server.js
- Add postinstall script to auto-install client deps (cd client && npm install)
- Fix SPA fallback: bare return → next() to prevent hanging requests
- Add root package-lock.json for deterministic server dependency installs
- Remove committed tsconfig.tsbuildinfo build artifact, add *.tsbuildinfo to .gitignore
- Update README: simpler install (npm install handles everything), reference SAAC_DEPLOYMENT.md,
  use npx instead of pnpm dlx for shadcn components
This commit is contained in:
SAAC Daemon
2026-02-18 16:36:33 +01:00
parent 0e21d26c05
commit 5b37f88477
10 changed files with 1962 additions and 17 deletions

View File

@@ -24,22 +24,23 @@ React + shadcn/ui + Express + PostgreSQL + Redis scaffold for SAAC deployment.
│ ├── components.json # shadcn/ui config
│ ├── vite.config.ts # Vite config with path aliases
│ └── package.json # Client dependencies
├── docker-compose.yml # PostgreSQL + Redis + App
├── docker-compose.yml # PostgreSQL + Redis + App (see comments inside)
├── Dockerfile # Multi-stage: build React → serve with Express
├── SAAC_DEPLOYMENT.md # Deployment rules — READ THIS FIRST
└── package.json # Server dependencies
```
## Development
```bash
# Install all dependencies
npm install && cd client && npm install && cd ..
# Install all dependencies (postinstall auto-installs client deps)
npm install
# Run backend + frontend concurrently
# Run backend + frontend concurrently (nodemon + Vite HMR)
npm run dev
# Or run separately:
npm run dev:server # Express on :3000
npm run dev:server # Express on :3000 (with nodemon auto-restart)
npm run dev:client # Vite on :5173 (proxies /api to :3000)
```
@@ -47,9 +48,9 @@ npm run dev:client # Vite on :5173 (proxies /api to :3000)
```bash
cd client
pnpm dlx shadcn@latest add dialog # Add Dialog component
pnpm dlx shadcn@latest add table # Add Table component
pnpm dlx shadcn@latest add select # Add Select component
npx shadcn@latest add dialog # Add Dialog component
npx shadcn@latest add table # Add Table component
npx shadcn@latest add select # Add Select component
```
Import: `import { Button } from "@/components/ui/button"`
@@ -60,6 +61,8 @@ Import: `import { Button } from "@/components/ui/button"`
saac deploy
```
See `SAAC_DEPLOYMENT.md` for deployment rules, common mistakes, and debugging commands.
## API Routes
- `GET /health` — Health check (PostgreSQL + Redis)