Configuration
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
PORT |
No | 3002 |
Express listen port |
NODE_ENV |
No | development |
production enables secure cookies |
CONTENT_DIR |
No | ./content |
Path to documentation markdown files |
POSTGRES_HOST |
No | localhost |
PostgreSQL host |
POSTGRES_PORT |
No | 5433 |
PostgreSQL port (Docker-mapped) |
POSTGRES_DB |
No | hypnoelp_cms |
Database name (shared with CMS) |
POSTGRES_USER |
No | cms_user |
Database user |
POSTGRES_PASSWORD |
No | cms_password |
Database password |
DATABASE_URL |
No | — | Alternative: full connection string |
GOOGLE_CLIENT_ID |
Prod | — | Google OAuth client ID |
GOOGLE_CLIENT_SECRET |
Prod | — | Google OAuth client secret |
GOOGLE_CALLBACK_URL |
Prod | /auth/google/callback |
OAuth redirect URI |
SESSION_SECRET |
Prod | dochub-dev-secret |
Session encryption key |
COOKIE_DOMAIN |
Prod | — | .ipnoelp.com for shared auth |
ALLOWED_EMAIL_DOMAINS |
No | omelasai.com |
Comma-separated allowed domains |
SERVE_PREBUILT |
No | — | Serve from build/ directory |
ANTHROPIC_API_KEY |
No | — | For daily agent Claude API calls |
Express Settings
| Setting | Value | Purpose |
|---|---|---|
trust proxy |
1 |
Trust first proxy (nginx) for X-Forwarded-Proto detection — required for secure cookie setting behind reverse proxy |
Database Connection
src/config/database.ts creates a pg.Pool with:
- Max 5 connections (smaller than CMS’s 20 — DocHub is read-only)
- 30s idle timeout
- 2s connection timeout
If DATABASE_URL is set, it’s used as a connection string. Otherwise individual POSTGRES_* vars are used.
The pool logs connection success/failure at startup and exits on unexpected idle client errors.
npm Dependencies
Runtime
| Package | Version | Purpose |
|---|---|---|
express |
^4.18.2 | HTTP server |
express-session |
^1.19.0 | Session middleware |
connect-pg-simple |
^10.0.0 | PostgreSQL session store |
passport |
^0.7.0 | Authentication framework |
passport-google-oauth20 |
^2.0.0 | Google OAuth strategy |
pg |
^8.11.3 | PostgreSQL client |
helmet |
^7.1.0 | Security headers |
morgan |
^1.10.0 | HTTP logging |
dotenv |
^16.3.1 | Environment variable loading |
markdown-it |
^14.1.0 | Markdown to HTML rendering |
markdown-it-anchor |
^9.2.0 | Heading anchor links |
gray-matter |
^4.0.3 | YAML frontmatter parsing |
highlight.js |
^11.10.0 | Code syntax highlighting |
js-yaml |
^4.1.0 | YAML file parsing |
glob |
^11.0.0 | File pattern matching |
@anthropic-ai/sdk |
^0.39.0 | Claude API for daily agent |
Dev
TypeScript compiler, type definitions for all runtime deps, nodemon for dev reload, and ts-node for running scripts directly.
TypeScript
Compiled to dist/ with ES2020 target, commonjs modules, strict mode enabled except noImplicitReturns (disabled because Express route handlers commonly use return res.send() patterns).