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
REPORTS_PORT3000HTTP server port
REPORTS_VERSION1.0.0App version string
REPORTS_UI_DIR./ui/distBuilt UI static files path
REPORTS_USER�Basic auth username (empty = disabled)
REPORTS_PASS�Basic auth password (empty = disabled)
REPORTS_CORS_ORIGIN*Allowed CORS origins (comma-separated)
REPORTS_RATE_LIMIT100Max requests per 60s sliding window (compile endpoints get 1/4)
REPORTS_TEMPLATES_DIR./templatesTemplate storage directory
REPORTS_ASSETS_DIR./assetsAsset directory
REPORTS_FONTS_DIR�Custom fonts directory (defaults to assets dir)
REPORTS_MAX_BODY_SIZE10485760 (10 MB)Max request body size in bytes
REPORTS_COMPILE_TIMEOUT60000 (60 s)Max Typst compilation time in milliseconds
REPORTS_CACHE_SIZE100Max cached compiled PDFs in memory (LRU)
REPORTS_POOL_SIZE2Number of pre-warmed compilation workers
LOG_LEVELinfoLogging level (info, debug, warn, error)

Authentication ​

Authentication is optional and resolved in this priority order:

  1. Env vars: Both REPORTS_USER and REPORTS_PASS set
  2. Credentials file: .credentials.json in the app root (created via /api/change-password)
  3. Default credentials: admin / password123 (hardcoded fallback)
bash
# Enable auth via env vars
REPORTS_USER=admin
REPORTS_PASS=your-secure-password

The UI has a dedicated login page at /login and supports changing passwords via the settings menu.

Data Directory Structure ​

templates/          # Typst template files (.typ) and metadata (.json)
assets/             # Uploaded assets (images, fonts, documents)
.packages/          # Installed Typst community packages (auto-managed)

Rate Limiting ​

The app uses a sliding window rate limiter per IP:

  • General limit: REPORTS_RATE_LIMIT requests per 60-second window
  • Compilation limit: 1/4 of the general limit (applied to /api/report and /api/preview)
  • Rate limit entries are cleaned up every 2 windows

CORS ​

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

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

# Multiple origins (comma-separated)
REPORTS_CORS_ORIGIN=https://app.example.com,https://admin.example.com

Design and Dev by David Lam