Skip to content

Environment

nexgen uses a Zod-validated .env file at the project root. Copy .env.example to get started.

bash
cp .env.example .env

Application

VariableDefaultDescription
APP_NAMEnexgenApplication name used in logging and email headers
APP_ENVdevelopmentRuntime environment: development, production, or test
APP_PORT3000HTTP server port
APP_URLhttp://localhost:3000Public-facing URL of the application (required)
UItrueSet false for API-only mode (no UI build/serve)
FRONTEND_URLSeparate frontend URL when UI is on a different domain. Leave empty when served from APP_URL
SOCKETfalseEnable/disable Socket.IO on both backend and UI

Database

VariableDefaultDescription
DATABASE_URLsqlite:./src/storage/database/nexgen.sqliteDatabase connection string (SQLite, MySQL, PostgreSQL)

Redis

VariableDefaultDescription
REDIS_URLredis://127.0.0.1:6379Redis connection string
REDIS_PREFIXnexgenKey prefix for all Redis namespacing

JWT & Cookies

VariableDefaultDescription
JWT_ACCESS_SECRETAccess token signing secret (required)
JWT_REFRESH_SECRETRefresh token signing secret (required)
COOKIE_SECRETCookie signing secret (required)

Mail

VariableDefaultDescription
MAIL_USERNAME""SMTP username
MAIL_PASSWORD""SMTP password

Storage

VariableDefaultDescription
STORAGE_ACCESS_KEY_IDS3-compatible access key (required when using S3)
STORAGE_SECRET_ACCESS_KEYS3-compatible secret key (required when using S3)

Feature Toggles

REDIS

  • Type: boolean (true / false)
  • Default: false

Controls all Redis-backed subsystems. When false, the framework skips Redis entirely and every Redis-dependent feature degrades gracefully.

SubsystemREDIS=trueREDIS=false
QueueJobs processed by persistent workerQueue worker refuses to start. Jobs return null
CacheRedis-backed TTL cacheAll methods return null / fallback. Cache is a no-op
SessionRedis-backed session storeAll methods return null / false. Cookie is set but no data stored
RealtimeSocket.IO uses Redis adapter for multi-instance broadcastSingle-instance mode only
SchedulerDistributed Redis lockFalls back to database-level locking
BullBoardLive queue dashboardDashboard shows "unavailable"

Startup behavior: Redis uses lazyConnect. If unreachable at startup, the server still boots — all Redis features log a warning and degrade.

SOCKET

  • Type: boolean (true / false)
  • Default: true

Controls Socket.IO on both backend and UI:

SOCKET=trueSOCKET=false
Socket.IO server startsNo Socket.IO instance created
UI Pulse client activeUI Pulse client is a silent no-op
dispatchEvent() with broadcast fans out via WebSocketbroadcast option is silently ignored

UI

  • Type: boolean (true / false)
  • Default: true

Controls whether the UI (Vue SPA) is served from the same API server.

UI=trueUI=false
Built Vue assets served from public/Not served
SPA fallback for unmatched routesReturns 404
Dev stack starts Vite on port 5173Only API server starts

Use UI=false for API-only mode (separate UI, mobile app, third-party consumer).

OPEN_API

  • Type: boolean (true / false)
  • Default: true

Controls the OpenAPI / Scalar documentation endpoint at /api-docs. Set OPEN_API=false in .env to disable. Routes still work when disabled — only the documentation endpoints are removed.

Feature Interaction Map

REDIS=true
 ├── Queue worker required for async jobs
 ├── Cache persists across restarts
 ├── Sessions shared across instances
 ├── Socket.IO broadcasts across instances
 ├── Scheduler locks across instances
 └── BullBoard live dashboard

SOCKET=true
 └── REDIS=true  → multi-instance realtime
 └── REDIS=false → single-instance realtime

UI=true  → API + SPA monolith (no CORS issues)
UI=false → API-only (set FRONTEND_URL for CORS)

OPEN_API=true  → /api-docs + /doc
OPEN_API=false → bare API, no docs endpoints

Configuration

All subsystem settings (cache TTL, JWT expiry, mail host, rate limits, etc.) are defined in the src/config/ folder. See Configuration for details.

Released under the MIT License.