Install with the Deploy button
The repository has a Deploy to Cloudflare button. It deploys the main Worker (amable-core: dashboard, CRM, automations, email and API) into your account from the browser. To get a complete installation you then add the edge Worker and the first owner with the setup script.
Overview
Section titled “Overview”| Deploy button | Setup script | |
|---|---|---|
| Where you run it | In the browser | On your computer |
| Deploys | amable-core only |
amable-core and amable-edge |
| Creates the first owner | No | Yes (--owner-email) |
| Secrets | You type them in the form | Generated for you |
| Result | A partial installation, to be completed with the script | A complete installation |
If you are comfortable with a terminal, the setup script alone is simpler. The button is useful to see the dashboard deployed quickly, or when your Git provider is where you want the code to live.
The button link is:
https://deploy.workers.cloudflare.com/?url=https://github.com/Ratne/AmableData/tree/main/deploy/cloudflareHow it works
Section titled “How it works”Cloudflare’s Deploy to Cloudflare flow:
- clones the repository into your own GitHub or GitLab account,
- lets you adjust the project name, Worker name and resource names,
- builds and deploys with Workers Builds, and provisions the resources declared in the Wrangler configuration.
amabledata’s button points at deploy/cloudflare, whose wrangler.jsonc declares:
Declared in deploy/cloudflare/wrangler.jsonc |
Value |
|---|---|
| Worker name | amable-core |
| Dashboard assets | apps/web/dist (built by the project’s build script) |
| D1 database | binding DB, name amable-installation |
| Durable Objects | TenantDb, Engine, MailDb, EditSession, BookingCalendar |
| Queues | producers and consumers for email-send, events-rollup, webhooks-out, form-submissions, esign-seal |
| CPU limit | limits.cpu_ms 120000 on amable-core |
| R2 bucket | binding FILES, name amable-files |
| Cron Trigger | */5 * * * * |
| Rate limiting | RL_AUTH (60/60 s), RL_API (600/60 s) |
| Variables | ENVIRONMENT=production, ERROR_REPORTING=local |
The package.json of that folder runs the monorepo build (pnpm install --frozen-lockfile && pnpm run build:web) and deploys with this configuration.
What the button asks for
Section titled “What the button asks for”The form lists the secrets of deploy/cloudflare/.dev.vars.example:
| Secret | What to enter |
|---|---|
PASSWORD_PEPPER |
A random value: openssl rand -base64 32. Never change it once users exist. |
AUTH_ENCRYPTION_KEY |
A random value: openssl rand -base64 32 (it must decode to exactly 32 bytes). Never change it once users exist. |
EMAIL_TOKEN_SECRET |
A random value: openssl rand -base64 32 |
EDGE_GATEWAY_SECRET |
A random value: openssl rand -base64 32. The setup script later replaces it with a new value shared by the core and the edge Worker (Cloudflare never reveals a secret, so the script cannot copy yours to the edge). |
APP_ORIGIN |
The public origin of the app, for example https://amable-core.<your-subdomain>.workers.dev |
Without PASSWORD_PEPPER and AUTH_ENCRYPTION_KEY a production Worker refuses to start authentication.
What is missing after the button
Section titled “What is missing after the button”Until the edge Worker is deployed:
- web analytics, hosted forms, booking pages and landing pages answer
503; - email links point at
APP_ORIGINinstead of a tracking hostname; - there is no first owner, so nobody can sign in yet.
Step by step
Section titled “Step by step”Deploy the core Worker
Section titled “Deploy the core Worker”-
Make sure the Cloudflare account is on Workers Paid with R2 enabled. See Plans and billing.
-
Open the button link (above) or select Deploy to Cloudflare in the repository README.
-
Sign in to Cloudflare and connect your GitHub or GitLab account when asked.
-
Keep the proposed names: the Worker
amable-core, the databaseamable-installation, the bucketamable-filesand the queue names. The setup script later looks for exactly these names. -
Fill in the secrets listed above. Keep a copy of
PASSWORD_PEPPERandAUTH_ENCRYPTION_KEYin your password manager. -
Start the deployment and wait for the build to finish. The dashboard opens at
https://amable-core.<your-subdomain>.workers.dev.
Complete the installation with the setup script
Section titled “Complete the installation with the setup script”-
On your computer, clone your copy of the repository (the one the button created) or the original one, check out the same release, and install:
pnpm install. -
Sign in:
pnpm exec wrangler login. -
Run the full setup:
Terminal window pnpm self-host:setup --deploy \--app-origin https://amable-core.<sub>.workers.dev \--edge-origin https://amable-edge.<sub>.workers.dev \--owner-email you@example.com --workspace "My company"It finds the existing database, bucket and queues, creates the
analyticsqueue, deploys the edge, redeploys the core with the analytics binding, and prints the owner invitation link. It keeps every secret you already set exceptEDGE_GATEWAY_SECRET: since only the core has it, the script writes one new random value to both Workers and printscore EDGE_GATEWAY_SECRET: missing on the other worker, both rotated. -
Open the link and create the owner account. If you lose it or it expires before anyone signs up, rerun the same command: it prints a new link for the same workspace and the old one stops working.
Reference
Section titled “Reference”| Item | Value |
|---|---|
| Button URL | https://deploy.workers.cloudflare.com/?url=https://github.com/Ratne/AmableData/tree/main/deploy/cloudflare |
| Config used | deploy/cloudflare/wrangler.jsonc |
| Secrets template | deploy/cloudflare/.dev.vars.example |
| Build command | cd ../.. && pnpm install --frozen-lockfile && pnpm run build:web |
| Deploy command | cd ../.. && pnpm --filter @amable/app-core exec wrangler deploy --config ../../deploy/cloudflare/wrangler.jsonc |
| Deploys | amable-core only |
| Missing until the script runs | amable-edge, the analytics queue, the ANALYTICS binding, EDGE_ORIGIN, the first owner |
Limits and permissions
Section titled “Limits and permissions”- The button deploys from the
mainbranch of the repository. For a specific release, use the setup script with a checked-out tag. - Cloudflare’s Deploy button supports only public GitHub and GitLab repositories and has limited monorepo support; if the build fails in Workers Builds, install with the setup script instead.
- You need permission to create Workers, D1, R2 and Queues on the Cloudflare account.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| The build fails in Workers Builds | Monorepo build or dependency install failed | Use the setup script, which builds on your computer. |
| The dashboard shows an authentication configuration error | PASSWORD_PEPPER or AUTH_ENCRYPTION_KEY missing or invalid |
Set them (AUTH_ENCRYPTION_KEY must be base64 of exactly 32 bytes) and redeploy. |
| Analytics pages answer analytics unavailable (503) | The edge Worker is not deployed | Complete the installation with the setup script. |
| Hosted forms or booking pages fail after deploying the edge | EDGE_GATEWAY_SECRET differs between the two Workers (for example it was changed by hand on one of them) |
Delete it on the edge (pnpm exec wrangler secret delete EDGE_GATEWAY_SECRET --config apps/edge/wrangler.self-host.jsonc) and rerun the setup script with --deploy: both Workers get a new shared value. |
| Nobody can sign in | No owner yet, or the first-owner link was lost or expired | Run the setup script with --deploy and --owner-email; while nobody has signed up, every run prints a new link. |

