Deploy to Cloudflare
Deploy the open-source Worker, initialize D1 and connect your devices.
Deployment button
Open Deploy to Cloudflare, authorize your Cloudflare account and follow the setup flow.
Deploy the root repository, not only apps/site: the site depends on the connection core and SDK in the same pnpm workspace. Provision a Worker, one D1 database and a SQLite Durable Object.
Grant the Worker, D1 and Durable Object permissions requested by the setup flow, then save the assigned service URL and resource bindings.
Manual deployment
Install Git, Node.js 24 and pnpm 10.34.5, and prepare a Cloudflare account:
git clone https://github.com/monkeyWie/reignhub.git
cd reignhub
corepack enable
pnpm install --frozen-lockfile
pnpm exec wrangler login
pnpm build:web
pnpm run deployUse pnpm run deploy, not pnpm's own deploy subcommand. The deployment script initializes D1 after resource creation; requests may fail until initialization completes.
Preserve resource bindings
Save the assigned D1 database ID in wrangler.jsonc. Reuse that database for future releases so that the device directory and service identity remain intact.
Check the service:
curl https://YOUR-WORKER.YOUR-SUBDOMAIN.workers.dev/healthz
curl https://YOUR-WORKER.YOUR-SUBDOMAIN.workers.dev/p2p/configHealth should succeed and config should contain connection capabilities and the signing identity. Open the same-origin /chat page and set the Worker root URL in native clients.
Domains and origins
Bind a custom domain in Cloudflare and use HTTPS after DNS and certificate activation. Keep Web, API, signaling and relay on the same origin.
To allow additional Web origins, set ALLOWED_ORIGINS to exact comma-separated origins. The current origin is allowed by default. Broad wildcards are not a replacement for pairing authorization.
Site languages and SEO
English uses unprefixed URLs such as /docs; Chinese uses /zh-CN/docs. First visits follow the browser language, and manual language choices are remembered. The console uses /chat. Before building for a stable public domain, set SITE_URL:
SITE_URL=https://reignhub.example.com pnpm build:web
pnpm run deployThis generates canonical URLs, language alternates, social cards and a sitemap for your domain. Without SITE_URL, the build omits absolute canonical URLs and publishes an empty sitemap rather than pointing your instance at the official site. Change the build variable and rebuild if you change domains. Keep private instances protected by access control; robots.txt is not authorization.
Link your own legal policies
If your service has its own terms and privacy policy, configure their URLs at build time:
NEXT_PUBLIC_TERMS_URL='https://example.com{localePrefix}/terms' \
NEXT_PUBLIC_PRIVACY_URL='https://example.com{localePrefix}/privacy' \
NEXT_PUBLIC_SUPPORT_EMAIL='support@example.com' \
pnpm build:web{localePrefix} is empty for English and /zh-CN for Chinese; fixed URLs also work. Once both URLs are configured, the website footer and account page show the links. Host the content on your own site; the open-source build does not include another operator's policies.
Configure NEXT_PUBLIC_SUPPORT_EMAIL to display your own clickable support mailbox in the website and documentation footers. This is a public build-time value; rebuild after changing it.
Local verification
pnpm exec wrangler d1 migrations apply DB --local
pnpm exec wrangler dev --port 8787Open http://localhost:8787/chat. Local resources are separate from production D1; never point development at a real user's device state directory.