Skip to content

Quickstart

Terminal window
bun add @xtandard/flags
# optional integrations (peer deps) — install only what you use:
bun add redis pg mongodb @libsql/client unstorage @openfeature/server-sdk elysia hono express
Terminal window
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$...' \
ghcr.io/xantiagoma/xtandard-flags:latest

Visit http://localhost:3000. Health check at /healthcheck.

Configured entirely by env vars — PORT, BASE_PATH, TITLE, LOGO_URL, READONLY, STREAMING (OFREP SSE), AUTH_MODE/AUTH_USERNAME/AUTH_PASSWORD[_HASH], and the SOURCE_/RUNTIME_STORAGE_DRIVER family (memory/file/redis/postgres/ mongodb/sqlite/unstorage). Full reference + per-driver vars: docs/DEPLOYMENT.md. The same set works with serve (run npx @xtandard/flags serve --help).

Same server, same env vars — no container:

Terminal window
PORT=4000 \
SOURCE_STORAGE_DRIVER=redis RUNTIME_STORAGE_DRIVER=redis \
REDIS_URL=redis://localhost:6379 \
AUTH_MODE=basic AUTH_USERNAME=admin AUTH_PASSWORD=secret \
npx @xtandard/flags serve # or: bunx @xtandard/flags serve

serve runs under both Node (npx) and Bun (bunx). With no env it defaults to file storage under ./.flags/ in the current directory (a source/ and a runtime/ subdir) and no auth — fine for a quick local look. It prints the resolved storage paths on startup; set an absolute SOURCE_FILE_DIR / RUNTIME_FILE_DIR (or a different driver) to persist elsewhere, and set AUTH_MODE=basic before exposing it.

Elysia
import { Elysia } from "elysia";
import { flagsPanel } from "@xtandard/flags/elysia";
import { createRedisStorage } from "@xtandard/flags/storage/redis";
import { basicAuth } from "@xtandard/flags/auth/basic";
new Elysia()
.mount(
"/flags",
flagsPanel({
basePath: "/flags",
sourceStorage: createRedisStorage({ url: process.env.REDIS_URL!, prefix: "flags:source" }),
runtimeStorage: createRedisStorage({ url: process.env.REDIS_URL!, prefix: "flags:runtime" }),
auth: basicAuth({
users: [{ username: "admin", passwordHash: process.env.FLAGS_ADMIN_PASSWORD_HASH! }],
}),
}),
)
.listen(3000);
Hono
import { Hono } from "hono";
import { flagsPanel } from "@xtandard/flags/hono";
import { createUnstorageStorage } from "@xtandard/flags/storage/unstorage";
import { createStorage } from "unstorage";
const app = new Hono();
app.route(
"/flags",
flagsPanel({
basePath: "/flags",
sourceStorage: createUnstorageStorage({ storage: createStorage() }),
}),
);
export default app;
Express
import express from "express";
import { flagsPanel } from "@xtandard/flags/express";
import { createFileStorage } from "@xtandard/flags/storage/file";
const app = express();
// Mount the panel BEFORE body-parsing middleware — it reads the raw body.
app.use(
"/flags",
flagsPanel({ basePath: "/flags", sourceStorage: createFileStorage({ dir: "./.flags" }) }),
);
app.listen(3000);

Then open http://localhost:3000/flags, create a flag, and Publish.