Docs · Getting started
Quickstart
Ten minutes from an empty project to a flag you can turn off from your phone. You will need Node 20+ and a Driftwire account (the free plan is fine).
1. Install the SDK
npm install @driftwire-demo/sdk
# or: pnpm add @driftwire-demo/sdk · yarn add @driftwire-demo/sdkThen add your server-side SDK key. Find it under Settings → Environments; each environment has its own.
DRIFTWIRE_SDK_KEY=sdk-prod-7f3c9e2a41b84d0c
DRIFTWIRE_ENV=production2. Create a flag
From the dashboard, or from the CLI, which is what the rest of this guide uses:
$ driftwire login
$ driftwire flags create new-checkout-flow --type boolean
ok Created new-checkout-flow in development, staging, production
$ driftwire rollout new-checkout-flow --env production --to 25%
ok Live everywhere in 38 msNew flags start false in every environment, so creating one never changes what users see.
3. Read it in your code
import { createClient } from '@driftwire-demo/sdk'
export const driftwire = createClient({
sdkKey: process.env.DRIFTWIRE_SDK_KEY!,
// Served while the first ruleset loads, and if Driftwire is unreachable.
defaults: { 'new-checkout-flow': false },
})
await driftwire.ready()In a Vue or Nuxt component
import { createClient } from '@driftwire-demo/sdk'
const driftwire = createClient({ sdkKey: process.env.DRIFTWIRE_SDK_KEY! })
export async function checkoutFor(user: User) {
const useV2 = await driftwire.isEnabled('new-checkout-flow', {
key: user.id,
plan: user.plan,
})
return useV2 ? renderCheckoutV2(user) : renderCheckout(user)
}4. Try it
This is what a flag looks like from the dashboard. Go on — it is wired to nothing.
new-checkout-flow
On · serving the new checkout to 25% of productionOff · everyone gets the current checkout, everywhere, in 38 ms
5. Roll it out
- Turn it on for your team with a rule:
user.email ends with "@yourcompany.com". - Raise it to 1% of production and watch the guardrails for an hour.
- Let the schedule take it to 100%, or promote it by hand.
Prefer configuration in your repository? Everything in the dashboard can live in a file:
{
"flags": {
"new-checkout-flow": {
"rollout": { "steps": ["1%", "5%", "25%", "100%"], "every": "4h" },
"guardrails": [{ "metric": "error_rate", "below": "1%" }]
}
}
}SDKs
Every SDK evaluates locally and streams changes. All are open source and MIT licensed.
server: [node, go, python, ruby, java, dotnet, php]
edge: [cloudflare-workers, vercel-edge, fastly-compute]
client: [javascript, react, vue, swift, kotlin, flutter]Upgrading from 3.x
4.0 renamed one method. The changelog has the before-and-after; everything else is compatible. Style the site your docs live on with the style guide.
Working with an AI agent?
Point it at /docs/quickstart.md or /llms.txt. Every page on this site is also served as clean Markdown, generated from the same content.