InkOps

express-postgres-templated v1.0.0

express-postgres-templated  ·  Initial Release  ·  May 23, 2026

What's New

Architecture

This template scaffolds a complete Express + Postgres app following Polsia's mandatory architecture rules:

LayerLocationRule
Entry pointserver.jsMax 300 lines — wiring only
Routesroutes/One file per endpoint group
Databasedb/Only db/index.js constructs Pool
Migrationsmigrations/Timestamped files, tracked in _migrations
Business logicservices/Named exports, no inline DB queries

Environment Variables

VariableRequiredDescription
DATABASE_URLYesNeon connection string (with SSL). App will not start without it.
PORTNoServer port. Defaults to 3000.
OPENAI_API_KEYNoRequired only if using AI features (via Polsia platform).
GITHUB_TOKENNoRaise GitHub API rate limit from 60 to 5,000 req/hr.

Key Dependencies

Usage

# 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

Migration System

The migrate.js runner is invoked on every deploy. It:

  1. Creates _migrations tracking table (idempotent)
  2. Creates core tables: users, sources, documents (idempotent)
  3. Runs pending migrations from migrations/ in filename order
  4. Tracks each applied migration in _migrations

New migrations: create migrations/{timestamp}_{name}.js with module.exports = { name: '...', up: async (client) => { ... } }.

Bug Fixes

Generated by InkOps