---
title: "Deploy a Nosflare Nostr Relay"
description: "Two ways to deploy Nosflare: one-click no-code deployment for 21,420 sats, or a manual build and deploy to Cloudflare Workers with a D1 database."
canonical: "https://nosflare.com/docs/deployment.md"
---

# Deploying Nosflare

There are two paths: a one-click no-code deployment, or a manual deployment you build and ship yourself.

## Option 1: One-click deploy (no code)

For people who do not code or do not want to operate a server.

1. Go to https://deploy.nosflare.com
2. Pay the one-time setup fee of **21,420 sats**.
3. Your relay is deployed to **your own Cloudflare account** in under a minute.

You can make as many updates to your relay as you like afterwards at no extra cost.

## Option 2: Manual deployment

### Prerequisites

- A [Cloudflare account](https://www.cloudflare.com/plans/). The Workers paid plan is recommended; a free tier is available. D1 and Durable Objects must be enabled.
- [Node.js](https://nodejs.org/) and npm.
- Optional: the [Wrangler CLI](https://developers.cloudflare.com/workers/cli-wrangler/install-update).

### Dependencies

```bash
npm install @noble/curves
npm install -g esbuild typescript wrangler
npm install --save-dev @cloudflare/workers-types @types/node
```

Nosflare uses [@noble/curves](https://github.com/paulmillr/noble-curves) for cryptography, [esbuild](https://github.com/evanw/esbuild) for bundling, and TypeScript.

### Configure

Fork https://github.com/Spl0itable/nosflare (forking is recommended so you can deploy from your own git repository), then open `src/config.ts` and edit:

- `relayInfo` - relay name, description, icon, contact, limitations.
- Pay-to-relay settings - `PAY_TO_RELAY_ENABLED` (enabled by default; set to `false` to turn off), `relayNpub`, `RELAY_ACCESS_PRICE_SATS`.
- `nip05Users` - usernames and hex pubkeys for NIP-05 verified addresses.
- `allowedPubkeys` / `blockedPubkeys`, `allowedEventKinds` / `blockedEventKinds`, `allowedTags` / `blockedTags` - access control.
- `blockedContent` - blocked words and phrases.
- `excludedRateLimitKinds` - kinds exempt from rate limiting.
- `allowedNip05Domains` / `blockedNip05Domains` - NIP-05 domain filtering.

Reference lists: [event kinds](https://github.com/nostr-protocol/nips#event-kinds) and [standardized tags](https://github.com/nostr-protocol/nips?tab=readme-ov-file#standardized-tags).

### Build

```bash
npm run build
```

This bundles the worker using your edited `src/config.ts` and overwrites `worker.js`.

### Deploy via the Cloudflare dashboard

1. Log in to the Cloudflare dashboard.
2. Go to **Storage & Databases > D1 SQL Database** and click **Create Database**. Choose a name and region.
3. Open the new database's **Settings** tab and click **Enable read replication**. Nosflare has been extensively tested with read replication; fallback support exists if it is disabled.
4. Edit `wrangler.toml` with your D1 database name and id (the UUID shown on the D1 dashboard). Other worker settings, including its name, live in this file too.
5. Go to **Compute (Workers)** and create a new Worker. You can import directly from a git repository or start from the "Hello World" template. This is the primary relay worker that Nostr clients connect to.
6. If you are **not** using a connected git repository, open the Worker's **Bindings** tab and bind the `RELAY_DATABASE` variable to the D1 database from step 2. With a connected git repository this binding happens automatically.
7. Ship the code: paste the contents of `worker.js` into the online editor, or let the connected git repository build `worker.js` into the Worker automatically. With a connected repository, every later push updates the Worker.
8. Save and deploy. Then visit the relay URL in a browser over HTTP to load the landing page - **this first HTTP request triggers database initialization** and creates the necessary tables.
9. Add a custom domain under the Worker's **Settings > Domains & Routes**. This becomes your relay URL.

Deployment with the Wrangler CLI follows broadly the same steps.

### Recommended Cloudflare settings

- Set the Worker's **CPU time limit** to `30000`.
- Create a Page Rule with a **"cache everything"** rule and a long Cloudflare edge TTL for a high cache rate.
- Enable **rate limiting** to protect the relay from abuse.

## After deployment

Add your relay URL (`wss://your-domain.com`) to your Nostr client's relay list. If pay-to-relay is enabled, visitors pay through the landing page before their events are accepted.
