What problem does it solve?
It solves the need to configure default user settings in a self-hosted app without hardcoding values in the codebase, enabling safer and environment-specific defaults.
Core Features & Use Cases
- Environment-variable-backed defaults: Reads server-side environment variables and maps them into user settings with a clear priority: User Custom > Server Env Var > Hardcoded Default.
- Typed configuration by domain: Adds per-domain environment parsing (e.g., in src/envs/<domain>.ts) using Zod validation and typed config helpers.
- End-to-end wiring: Updates shared server config types, assembles global server config, merges values into the user store slice, and documents the variables in .env.example and docs.
Use case: You want image-related defaults (like the maximum number of images generated) to differ between staging and production while keeping the UI behavior consistent and allowing users to override their own preferences.
Quick Start
Ask the system to add a new server-side setting by creating src/envs/<domain>.ts with Zod-validated env parsing, wiring it into the global server config and user store, then documenting it in .env.example and the self-hosting environment variable docs.