Skip to content

Configuration Reference

Every project created with Express Forge uses a centralized configuration system powered by environment variables.

🌍 Environment Variables

Create a .env file in the root of your project.

VariableDescriptionDefaultRequired
PORTThe port the server listens on3000No
NODE_ENVdevelopment, production, testdevelopmentNo
DATABASE_URLConnection string for your DB-Yes*
LOG_LEVELfatal, error, warn, info, debug, tracedebugNo
CORS_ORIGINAllowed origins (comma separated)*No
RATE_LIMIT_MAXMax requests per window100No
RATE_LIMIT_WINDOWWindow size in minutes15No

*Required if an ORM is selected.

⚙️ App Configuration

Configuration is managed in src/config/index.ts. This file:

  1. Validates environment variables using Zod.
  2. Exports a typed configuration object.
  3. Provides default values for optional variables.

💾 Database Config

If you chose Prisma, your configuration is primarily in prisma/schema.prisma.

For Sequelize, configuration is found in src/config/database.ts, which handles the connection pooling and dialect-specific settings.

📝 Logger Config

Logging configuration is found in src/config/logger.ts. You can toggle between pretty-print (for development) and JSON (for production) logging here.

Released under the MIT License.