Configuration
NeatNode templates come preconfigured, but you can still adjust the generated project through config files, environment variables, and template-aware project settings.
Project Config
Use a project config file to control the template, feature flags, validation stack, and source layout.
export default {
template: "rest-api",
features: {
resourceGenerator: true,
},
language: "typescript",
architecture: "modular",
database: {
provider: "mongodb",
client: "mongoose",
},
validation: "zod",
srcDir: "src",
};Configuration Fields
| Field | Purpose |
|---|---|
template | Selects the template family to generate. |
features.resourceGenerator | Enables resource generation in supported templates. |
language | Chooses JavaScript or TypeScript output. |
architecture | Selects the folder architecture when a template supports multiple layouts. |
validation | Chooses the validation library or strategy. |
srcDir | Sets the source directory root. |
database.provider | Declares the database backend. |
database.client | Selects the database client or ORM. |
[!NOTE] Unsupported fields are ignored by templates that do not recognize them.
Environment Variables
Each template includes a .env.example file. Copy and rename it:
cp .env.example .envCommon variables:
| Variable | Description | Default |
|---|---|---|
PORT | Server port | 5000 |
NODE_ENV | Environment mode | development |
DB_URL | Database connection string | - |
JWT_SECRET | Secret for JWT tokens | - |
Config Files
| File | Location | Purpose |
|---|---|---|
db.js | src/config/ | Database connection logic |
logger.js | src/config/ | Winston or console logger |
socket.js | src/config/ | Socket.IO initialization |
cors.js | src/config/ | CORS options |
TypeScript Config
TypeScript templates include a tsconfig.json with:
- Strict mode enabled
- ES module output
- Path aliases configured
- Source maps for debugging
Customizing Config
All config files are in src/config/. You can:
- Modify existing files directly
- Add new config modules (Redis, mail, etc.)
- Import them in
server.jsorapp.js
See Customization Guide for detailed examples.