# Quickstart

Install the SDK, create a flag, read it in your code and roll it out — in about ten minutes.

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

```bash
npm install @driftwire-demo/sdk
# or: pnpm add @driftwire-demo/sdk · yarn add @driftwire-demo/sdk
```

Then add your server-side SDK key. Find it under **Settings → Environments**; each environment has its own.

```text
DRIFTWIRE_SDK_KEY=sdk-prod-7f3c9e2a41b84d0c
DRIFTWIRE_ENV=production
```

## 2. Create a flag

From the dashboard, or from the CLI, which is what the rest of this guide uses:

```bash
$ 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 ms
```

New flags start `false` in every environment, so creating one never changes what users see.

## 3. Read it in your code

```typescript
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

```vue
<script setup lang="ts">
const { enabled } = useFlag('new-checkout-flow')
</script>

<template>
    <CheckoutV2 v-if="enabled" />
    <Checkout v-else />
</template>
```

## 4. Try it

This is what a flag looks like from the dashboard. Go on — it is wired to nothing.

## Interactive flag toggle

## 5. Roll it out

1. Turn it on for your team with a rule: `user.email ends with "@yourcompany.com"`.

1. Raise it to 1% of production and watch the guardrails for an hour.

1. 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:

```json
{
  "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.

```yaml
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](/changelog) has the before-and-after; everything else is compatible. Style the site your docs live on with [the style guide](/system).

## 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.
