# Node.js quickstart

Use the server SDK with Node.js 20 or later. Keep the server key in a secret environment variable. The SDK downloads your application's rules and evaluates flags in memory.

```sh
npm install @dipswitch/sdk-node
```

```ts
import { createClient } from '@dipswitch/sdk-node'

const serverKey = process.env.DIPSWITCH_SERVER_KEY
if (!serverKey) throw new Error('Set DIPSWITCH_SERVER_KEY')

const flags = createClient({ serverKey })
await flags.ready

export const useNewCheckout = (userId: string) => flags.isEnabled('new-checkout', userId, false)
export const stopFlags = () => flags.close()
```

Create one client for each application and environment used by your service, then reuse that client for every request. Close it on shutdown. A check uses the configured default if rules have not loaded or the flag is missing.
