Skip to content

Environment & Configuration

All configuration is done via environment variables in your .env file at the project root.

VariableDescriptionExample
DATABASE_URLPostgreSQL connection stringpostgresql://user:pass@localhost:5432/mydb
JWT_SECRETSecret key for signing JWT tokens. Use a strong random string (min 32 chars).a1b2c3d4e5...
VariableDescriptionDefault
VITE_API_URLBackend API URL. Used by the client SDK.http://localhost:3001
VITE_GOOGLE_CLIENT_IDGoogle OAuth client ID. Enables “Sign in with Google”.
VariableDescriptionDefault
PORTPort for the backend HTTP server3001
LOG_LEVELLogging verbosity: error, warn, info, debuginfo
NODE_ENVEnvironment: development or productiondevelopment
VariableDescriptionDefault
JWT_SECRETSecret for JWT signing (required if auth is enabled)
ACCESS_TOKEN_EXPIRES_INAccess token lifetime1h
REFRESH_TOKEN_EXPIRES_INRefresh token lifetime30d
ALLOW_REGISTRATIONAllow new users to register (true/false). First user can always register.false
GOOGLE_CLIENT_IDGoogle OAuth client ID (backend validation)
VariableDescriptionDefault
STORAGE_TYPEStorage backend: local or s3local
STORAGE_BASE_PATHBase path for local storage./uploads
S3_BUCKETS3 bucket name (when STORAGE_TYPE=s3)
S3_REGIONAWS region
S3_ACCESS_KEY_IDAWS access key
S3_SECRET_ACCESS_KEYAWS secret key
S3_ENDPOINTCustom S3 endpoint (for MinIO, Cloudflare R2, etc.)
VariableDescription
SMTP_HOSTSMTP server host
SMTP_PORTSMTP server port
SMTP_USERSMTP username
SMTP_PASSSMTP password
EMAIL_FROMSender address for system emails

The RebaseBackendConfig passed to initializeRebaseBackend() provides programmatic control:

await initializeRebaseBackend({
app,
server,
collections,
basePath: "/api", // Base path for all API routes (default: "/api")
driver: { // PostgreSQL driver config
connection: db,
schema: { tables, enums, relations }
},
auth: { // Authentication config
jwtSecret: process.env.JWT_SECRET!,
accessExpiresIn: "1h",
refreshExpiresIn: "30d",
requireAuth: true, // Require auth for data API (default: true)
allowRegistration: false,
google: {
clientId: process.env.GOOGLE_CLIENT_ID
}
},
storage: { // File storage config
type: "local",
basePath: "./uploads"
},
history: true, // Enable entity change history
enableSwagger: true, // Enable OpenAPI docs at /api/data/docs
logging: {
level: "info"
}
});