Skip to content

Deploy your server ​

CodeRail's server is one Cloudflare Worker with a D1 database and Durable Objects, in your own Cloudflare account. Deploy it with one click, or from the command line.

One click ​

Deploy to Cloudflare

  1. Click Deploy to Cloudflare and sign in to Cloudflare.
  2. Connect your GitHub (or GitLab) account. Cloudflare copies the CodeRail repository there, so you can update it later.
  3. Keep the suggested names, or change them, and enter a setup token: any long random string. Keep it for step 5.
  4. Click Deploy. Cloudflare builds CodeRail and creates the Worker, its database and its Durable Objects. It takes a few minutes.
  5. Open your new site (https://coderail.<your-subdomain>.workers.dev) at /setup, enter the setup token, and choose your admin username and password.

Your site is live. Next: add a computer.

From the command line ​

You need a Cloudflare account and Bun.

sh
git clone https://github.com/wiva-hq/CodeRail && cd CodeRail
bun install
bun run deploy

bun run deploy builds the web app and deploys the Worker described in wrangler.jsonc. The first time, Wrangler asks you to sign in and creates the D1 database. Then set the setup token:

sh
npx wrangler secret put SETUP_TOKEN

Open your site at /setup and create the first admin. The database's tables are made on first use, so there's no migration step.

Optional extras ​

These work with either way of deploying; change wrangler.jsonc (in your copy of the repository) and deploy again.

ExtraHow
Your own domainAdd { "pattern": "coderail.example.com", "custom_domain": true } to routes. The domain must be on your Cloudflare account.
Dev-server previewsAdd a second domain to routes and set it as vars.PREVIEW_HOST. See Dev-server preview.
Push notificationsRun bun scripts/vapid.ts, then npx wrangler secret put VAPID_PUBLIC_KEY and VAPID_PRIVATE_KEY with the two values. Set vars.VAPID_SUBJECT to a mailto: address of yours.

See Configuration for everything you can set.

Apache License 2.0 · Built by Wiva