npm run migrate.GET /health returns {"status":"healthy"} without touching the database (avoids Neon auto-suspend).DATABASE_URL is not set, with actionable error messages./css, /docs) so API routes stay unmasked.This template scaffolds a complete Express + Postgres app following Polsia's mandatory architecture rules:
| Layer | Location | Rule |
|---|---|---|
| Entry point | server.js | Max 300 lines — wiring only |
| Routes | routes/ | One file per endpoint group |
| Database | db/ | Only db/index.js constructs Pool |
| Migrations | migrations/ | Timestamped files, tracked in _migrations |
| Business logic | services/ | Named exports, no inline DB queries |
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | Neon connection string (with SSL). App will not start without it. |
PORT | No | Server port. Defaults to 3000. |
OPENAI_API_KEY | No | Required only if using AI features (via Polsia platform). |
GITHUB_TOKEN | No | Raise GitHub API rate limit from 60 to 5,000 req/hr. |
# Install
npm install
# Run migrations (creates schema, core tables)
npm run migrate
# Start dev server
npm run dev
# Production (Render)
npm run build # runs migrate then start
The migrate.js runner is invoked on every deploy. It:
_migrations tracking table (idempotent)users, sources, documents (idempotent)migrations/ in filename order_migrationsNew migrations: create migrations/{timestamp}_{name}.js with module.exports = { name: '...', up: async (client) => { ... } }.
express.static was intercepting /api/* before routes could handle it. Static now mounted at scoped sub-paths (/css, /docs) after API route registration.github.com — now correctly matches standard GitHub repository URLs.