Deployment
Docker
Section titled “Docker”Build from the repository root (the Dockerfile context must be the root):
docker build -f apps/standalone/Dockerfile -t xtandard-flags .The build is multi-stage:
buildstage: installs dependencies and runsbun run build:ui.runtimestage: copiessrc/,dist/ui/,node_modules/, andapps/standalone/— no compiled lib needed because Bun runs TypeScript directly.
Minimal (in-memory storage, no auth — for local testing only):
docker run --rm -p 3000:3000 xtandard-flagsWith Redis and basic auth:
docker run --rm -p 3000:3000 \ -e SOURCE_STORAGE_DRIVER=redis \ -e RUNTIME_STORAGE_DRIVER=redis \ -e REDIS_URL=redis://host.docker.internal:6379 \ -e AUTH_MODE=basic \ -e AUTH_USERNAME=admin \ -e AUTH_PASSWORD_HASH='scrypt$abc123...$def456...' \ xtandard-flagsDocker Compose with Redis
Section titled “Docker Compose with Redis”version: "3.9"services: redis: image: redis:7-alpine command: redis-server --notify-keyspace-events KEA ports: - "6379:6379"
flags: build: context: . dockerfile: apps/standalone/Dockerfile ports: - "3000:3000" environment: SOURCE_STORAGE_DRIVER: redis RUNTIME_STORAGE_DRIVER: redis REDIS_URL: redis://redis:6379 SOURCE_PREFIX: xtandard:flags:source RUNTIME_PREFIX: xtandard:flags:runtime AUTH_MODE: basic AUTH_USERNAME: admin AUTH_PASSWORD_HASH: "${FLAGS_ADMIN_PASSWORD_HASH}" depends_on: - redisThe notify-keyspace-events KEA flag on Redis enables keyspace notifications, which allows the OpenFeature provider to pick up new snapshots via watch instead of waiting for the next poll.
Security Warnings
Section titled “Security Warnings”Authentication
Section titled “Authentication”Always set AUTH_MODE=basic (or provide a custom AuthProvider) before exposing the admin panel to any network.
When AUTH_MODE=none the standalone server logs:
[xtandard/flags] Running with AUTH_MODE=none. Do NOT expose this publicly without authentication.A deployment with no auth and a publicly reachable port allows anyone to read, modify, and publish flags.
Password Storage
Section titled “Password Storage”- Use
AUTH_PASSWORD_HASH(scrypt) rather thanAUTH_PASSWORD(plaintext) in production. - Generate a hash with:
bun -e "const {hashPassword} = await import('./src/auth/basic.ts'); console.log(await hashPassword('your-password'))"- Store the hash in an environment secret (CI secret, Docker secret, Vault), not in source control.
Readonly Mode
Section titled “Readonly Mode”When the admin is embedded in an application that untrusted code can reach, set readonly: true (or READONLY=1). This blocks all state-changing API calls at the core level, returning 403 for any mutating action regardless of auth.
Cookie/Session Auth and CSRF
Section titled “Cookie/Session Auth and CSRF”If you implement a delegated AuthProvider that uses cookies or sessions, add CSRF protection to your outer request handler. The panel handler does not include CSRF middleware — it is the consumer’s responsibility when session-based auth is used.
Network Exposure
Section titled “Network Exposure”Consider mounting the admin panel on an internal-only port or path:
- Use
BASE_PATHto namespace the panel under a non-obvious route. - Place a reverse proxy in front and restrict access by IP or mTLS.
- Run the standalone container on a non-public network and only expose the OpenFeature provider’s runtime storage (Redis) to applications.
Storage driver env vars (per driver)
Section titled “Storage driver env vars (per driver)”The standalone app and CLI accept these SOURCE_STORAGE_DRIVER /
RUNTIME_STORAGE_DRIVER values. Source and runtime share one connection but are
isolated by a distinct table/collection/prefix/dir.
| Driver | Env vars |
|---|---|
memory |
(none) — ephemeral, lost on restart. Docker default. |
file |
SOURCE_FILE_DIR / RUNTIME_FILE_DIR (standalone default ./data/{source,runtime}; CLI serve default ./.flags/{source,runtime}) |
redis |
REDIS_URL (default redis://localhost:6379); optional SOURCE_PREFIX / RUNTIME_PREFIX |
postgres |
DATABASE_URL (or POSTGRES_URL); optional SOURCE_PG_TABLE / RUNTIME_PG_TABLE (default xtandard_flags_{source,runtime}) |
mongodb |
MONGO_URL; optional MONGO_DB (default xtandard_flags), SOURCE_MONGO_COLLECTION / RUNTIME_MONGO_COLLECTION (default flags_{source,runtime}) |
sqlite |
SOURCE_SQLITE_PATH / RUNTIME_SQLITE_PATH (default ./data/{source,runtime}.sqlite). Bun-only — works in the Docker image (Bun) and under bunx. |
unstorage |
in-memory by default; configure other unstorage drivers in code (see Storage) |
Note:
libsql/Turso andcloudflare-kvadapters exist but are wired in code (createLibsqlStorage/createCloudflareKvStorage), not via these env drivers.
# Postgres source + runtimedocker run -p 3000:3000 \ -e SOURCE_STORAGE_DRIVER=postgres -e RUNTIME_STORAGE_DRIVER=postgres \ -e DATABASE_URL=postgres://user:pass@db:5432/flags \ ghcr.io/xantiagoma/xtandard-flags:latest
# MongoDB source + runtimedocker run -p 3000:3000 \ -e SOURCE_STORAGE_DRIVER=mongodb -e RUNTIME_STORAGE_DRIVER=mongodb \ -e MONGO_URL=mongodb://db:27017 \ ghcr.io/xantiagoma/xtandard-flags:latestA common production split: Postgres as source (durable, transactional history)
and Redis/Upstash as runtime (fast reads).