Deploy Calends to your Cloudflare account with D1, scheduled jobs and optional email reminders.
Calends is a Cloudflare Worker: the front end is served as the Worker’s static assets, data lives in D1 (SQLite), and reminders and exchange rates run on a cron trigger. Usage and cost depend on your Cloudflare account’s current plan and quotas.
Requirements
- A Cloudflare account;
- for command-line deploys, Node.js 24 and git.
One-click deploy
Open Deploy to Cloudflare and follow the steps to copy the repository into your GitHub account and deploy it.
Then, in the Cloudflare dashboard, open the Worker’s Settings → Variables and Secrets and add a secret named SETUP_TOKEN with a long random value. Without it you can’t set a password.
Command-line deploy
-
Clone and install:
Terminal window git clone https://github.com/imetn/calends && cd calendsnpm ci -
Sign in to Cloudflare and check that
npx wrangler whoamishows your account:Terminal window npx wrangler login -
Set the setup token:
Terminal window npx wrangler secret put SETUP_TOKENopenssl rand -base64 24is one way to generate a random value. -
Deploy:
Terminal window npm run deploy -
Open
https://calends.<your-subdomain>.workers.dev, enter the setup token and choose your password.
npm run deploy does the following:
- generates the migration and translation files, type-checks, and builds the front end with Vite;
- deploys the Worker with
wrangler deploy. On the first deploy, a D1 database namedcalendsis created automatically — nodatabase_idto fill in; - applies all migrations to the remote database.
The Worker also checks for and applies missing migrations the first time each instance handles a request, so one-click deployments work too.
wrangler.jsonc
The wrangler.jsonc in the repository is ready to go:
| Setting | What it does |
|---|---|
assets |
Front-end assets. /api/*, /cal/* and /mcp go to the Worker first; other paths fall back to the single-page app. |
d1_databases |
Binding DB, database calends. |
triggers.crons |
*/15 * * * *: checks reminders and retries every 15 minutes. FX maintenance runs at UTC hour boundaries and refreshes rates older than 20 hours. |
observability |
Workers logs on, so reminder results and migrations show up in the dashboard. |
Email reminders
Email reminders use Cloudflare Email Sending. Skip this section if you don’t need email; no other channel needs server-side configuration.
-
Enable email sending for your domain in Cloudflare and verify a sender address, such as
calends@example.com. -
In
wrangler.jsonc, uncomment and edit these two entries:"send_email": [{ "name": "EMAIL", "allowed_sender_addresses": ["calends@example.com"] }],"vars": { "SITE_URL": "https://calends.example.com", "MAIL_FROM": "calends@example.com", "MAIL_FROM_NAME": "Calends" }, -
Deploy again:
npm run deploy. -
Under Settings → Notification channels, add an email channel with your address and click Test.
Custom domain
Cost
Usage includes Workers requests, D1 reads, writes and storage, Cron, optional R2 storage/operations, and email sending. Check actual usage and current quotas in your Cloudflare dashboard. The built-in assistant uses your selected provider, billed separately from Cloudflare.
File storage
File uploads require a private R2 bucket bound as FILES; without it uploads are disabled and other ledger features continue to work. Create it with npx wrangler r2 bucket create calends-files, add "r2_buckets": [{ "binding": "FILES", "bucket_name": "calends-files" }] to your Wrangler configuration, keep public access disabled, and redeploy. FILES_LIMIT_MB sets total capacity in MB (default 300); each file is limited to 10 MB.