Skip to content

Quickstart

There are two parts: stand up the service once for your team, then read flags from your apps. After that, adding a flag is one CLI command or one click, plus an if in your code.

Terminal window
npm create flaghoist@latest team-flags
cd team-flags

It asks a few questions: the project name, where it will run, which storage to use, whether you want accounts and roles, single sign-on, and the dashboard. Enter takes the default for each. Accounts are on by default, so setup creates an AUTH_PEPPER, the secret your password hashes depend on. It shows it once for your password manager and keeps it in a git-ignored .env.

This makes the team-flags directory and writes flaghoist.toml into it, which is the whole project. Flaghoist runs as its own service rather than a library inside your app, so it wants a directory of its own. If you already made an empty one, run npx flaghoist init inside it instead.

Terminal window
npx flaghoist deploy

It asks where you are deploying. Pick one of the two paths below.

Choose Cloudflare Workers. The CLI installs what it needs, creates a KV namespace for your flags, and deploys, so you end up with a URL like https://team-flags.<you>.workers.dev. It runs on the free plan and costs nothing while nobody is reading flags.

Set the two secrets before your first write:

Terminal window
npx wrangler secret put ADMIN_TOKEN
Terminal window
npx wrangler secret put READ_API_KEY

Use long random values for both (openssl rand -hex 32). You do not need to set AUTH_PEPPER: deploy copies it from .env onto the Worker.

Choose Another platform. The CLI writes a small Node project (server.mjs, a Dockerfile and package.json) that runs anywhere a container or Node runs: a VPS, Render, Fly.io, Railway, Cloud Run, Kubernetes. It is configured entirely with environment variables. To try it on your machine with flags kept in memory:

Terminal window
docker build -t team-flags .
Terminal window
docker run -p 8080:8080 --env-file .env -e FLAGS_STORAGE=memory -e ADMIN_TOKEN=change-me-to-something-long -e READ_API_KEY=change-me-too team-flags

For real use, point it at Postgres, Redis or SQLite with FLAGS_STORAGE and DATABASE_URL (or REDIS_URL, or DATABASE_PATH), and add AUTH_PEPPER from .env to your host’s secrets. If you turned accounts off, there is no .env, so leave out --env-file .env. The Docker guide lists every variable, and there are walkthroughs for Render, Fly.io and Railway.

To skip the question, create the project with --platform container, or run npx flaghoist deploy --target other.

Either way, that one URL now serves three things: the OFREP read API your apps use, the admin API, and the dashboard at /admin.

Go to /admin on your server and sign in with the admin token. Then open Account and create your own account, which becomes the owner. From then on you sign in with your email, and you can invite the rest of your team, each with their own role. If you turned accounts off, the admin token is how you sign in.

Flag commands need your server’s URL and a token. Export them once for the session:

Terminal window
export FLAGS_URL=https://flags.example.com
export FLAGS_ADMIN_TOKEN=<your admin token>

With accounts on, npx flaghoist login signs you in instead and saves a personal token.

Terminal window
npx flaghoist flag create new-checkout --desc "Redesigned checkout"

Flags start off, so nothing changes for users until you turn one on. You can also click New flag in the dashboard. Neither needs a code change.

Install the client (JavaScript shown; other languages use their own OFREP provider):

Terminal window
npm install @openfeature/web-sdk @flaghoist/vue

Register the provider once at startup:

import { OpenFeature } from '@openfeature/web-sdk'
import { FlaghoistProvider } from '@flaghoist/vue'
await OpenFeature.setProviderAndWait(
new FlaghoistProvider({
url: import.meta.env.VITE_FLAGS_URL,
apiKey: import.meta.env.VITE_FLAGS_KEY,
}),
)
OpenFeature.setContext({ targetingKey: user.id })

Then use it anywhere:

<script setup lang="ts">
import { useFeatureFlag } from '@flaghoist/vue'
const newCheckout = useFeatureFlag('new-checkout')
</script>
<template>
<NewCheckout v-if="newCheckout" />
<LegacyCheckout v-else />
</template>

Turn the flag on, roll it out to a percentage, or add a targeting rule, from the dashboard or the CLI. None of it needs a deploy:

Terminal window
npx flaghoist flag toggle new-checkout --on
npx flaghoist flag rollout new-checkout 25

Users pick up the change the next time their app fetches flags.

The read API is OFREP, so any language with an OpenFeature provider reads flags without a Flaghoist package. Each verified language has a guide with install steps and a working example: Go, Python, Java, .NET, Ruby, Rust and JavaScript / TypeScript. The overview covers the read key and evaluation context they share.