Skip to content

Configuration

Better Reports is configured via environment variables. Copy the .env.example file to get started:

bash
cp .env.example .env

Environment Variables

VariableDefaultDescription
NODE_ENVdevelopmentRuntime mode (development / production)
HOST0.0.0.0Server bind address
PORT3000Server port
REPORTS_DATA_DIR./Data directory for templates and assets
REPORTS_USERBasic auth username (disabled if empty)
REPORTS_PASSBasic auth password
CORS_ORIGIN*Allowed CORS origin(s)
RATE_LIMIT_WINDOW_MS60000Rate limit window in milliseconds
RATE_LIMIT_MAX100Max requests per window
RATE_LIMIT_COMPILE_MAX30Max compile requests per window
WORKER_POOL_SIZE2Number of compilation worker threads
CACHE_SIZE100LRU cache size for compiled PDFs
LOG_LEVELinfoPino log level

Authentication

Enable HTTP Basic Authentication by setting both REPORTS_USER and REPORTS_PASS:

bash
REPORTS_USER=admin
REPORTS_PASS=your-secure-password

When authentication is enabled, the UI will automatically prompt for credentials on 401 responses.

Data Directory Structure

/path/to/data/
├── templates/      # Typst template files (.typ) and metadata (.json)
├── assets/         # Uploaded assets (images, fonts, documents)
└── packages/       # Installed Typst community packages

Rate Limiting

The app uses a sliding window rate limiter with separate limits for general requests and compilation:

  • General: 100 requests per 60-second window
  • Compilation: 30 requests per 60-second window

CORS

By default, all origins are allowed. Restrict to specific origins in production:

bash
CORS_ORIGIN=https://reports.yourdomain.com

Design and Dev by David Lam