Skip to content

Configuration

Configure your NestForge Web application

NestForge Web can be configured via nestforge-web.config.ts or environment variables.

nestforge-web.config.ts
export const config = {
// Application name
name: "my-app",
// Directories
appDir: "./src/app",
backendDir: "./src/backend",
// Server
port: 3000,
host: "127.0.0.1",
// Build options
outDir: ".nestforge",
sourcemap: true,
// OpenAPI
openapi: {
title: "My API",
version: "1.0.0",
description: "API documentation",
},
// Features
features: {
hmr: true,
ssr: true,
apiDocs: true,
},
};
VariableDefaultDescription
PORT3000Server port
HOST127.0.0.1Server host
RUST_LOGinfoRust logging level
VariableDefaultDescription
APP_DIRsrc/appFrontend source directory
NESTFORGE_DIRsrc/backendBackend source directory
OUT_DIR.nestforgeBuild output directory
VariableDefaultDescription
NODE_ENVdevelopmentEnvironment mode
SOURCEMAPtrueGenerate source maps
MINIFYfalseMinify output
VariableDefaultDescription
DATABASE_URL-PostgreSQL connection string
REDIS_URL-Redis connection string
MONGODB_URL-MongoDB connection string
VariableDefaultDescription
JWT_SECRET-JWT signing secret
SESSION_SECRET-Session encryption key
Terminal window
nestforge-web dev [options]
OptionDefaultDescription
-p, --port <port>3000Port to listen on
-h, --host <host>127.0.0.1Host to bind to
--app-dir <dir>src/appFrontend source directory
Terminal window
nestforge-web build [options]
OptionDefaultDescription
--app-dir <dir>src/appFrontend source directory
--out-dir <dir>.nestforgeOutput directory
--no-sourcemapfalseDisable source maps
--releasefalseProduction build
Terminal window
nestforge-web start [options]
OptionDefaultDescription
-p, --port <port>3000Port to listen on
-h, --host <host>127.0.0.1Host to bind to
tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"@/*": ["./src/*"],
"@backend/*": ["./src/backend/*"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
Cargo.toml
[package]
name = "my-app"
version = "0.1.0"
edition = "2021"
[dependencies]
nestforge-web = { version = "0.1", features = ["full"] }
[profile.release]
opt-level = 3
lto = true
codegen-units = 1
[dependencies.nestforge-web]
version = "0.1"
default-features = false
features = [
"axum", # HTTP server
"openapi", # OpenAPI generation
"hmr", # Hot module replacement
"redis", # Redis caching
"postgres", # PostgreSQL support
"mongodb", # MongoDB support
]