Development Guide
Environment
Built-in env file loading in Reion, supported file patterns, mode behavior, and precedence.
Environment Variables
Reion loads environment variables automatically, so you do not need to install dotenv.
Supported Files
Reion reads env files from your project root in this order:
.env.env.local.env.[mode](for example:.env.development).env.[mode].local(for example:.env.development.local)
mode comes from NODE_ENV.
reion devdefaults todevelopmentreion startdefaults toproduction
Precedence
- Shell/CI environment variables are preserved and are not overwritten.
- Later env files can override values from earlier env files.
Example
# .env
DATABASE_URL="postgres://localhost:5432/reion"
LOG_LEVEL=info// src/router/ping/route.ts
import type { Context } from "reion";
export async function GET(ctx: Context) {
return {
database: process.env.DATABASE_URL,
logLevel: process.env.LOG_LEVEL,
};
}Important Security Tips
Keep Your Keys Safe
- Never commit
.envfiles to git. - Use different API keys for development and production.
- Do not share API keys in code or messages.