Get started
Run misomoon in your Cloudflare account
This guide deploys misomoon to your own Cloudflare account. Then it walks you through claiming your instance and tracking your first site. misomoon runs as one Worker with D1 databases and a queue. You have no server or container to manage.
There are two ways to deploy:
- With the Deploy to Cloudflare button. This takes about 5 minutes and needs only a browser.
- From the command line. Use this to change the code, to run more shards, or to deploy from your own CI.
Before you start
You need a Cloudflare account. The Workers Free plan works for small sites. The Free plan's queue allows 10,000 operations a day, and each event uses about 3, so it handles about 3,000 events a day. For more traffic, use the Workers Paid plan. See Workers pricing, D1 pricing, and Queues pricing.
misomoon creates these resources in your account:
| Resource | Name | What it is for |
|---|---|---|
| Worker | misomoon or misomoon-api | The API, the tracker, and the dashboard |
| D1 database | misomoon-control | Accounts, sites, goals, and keys |
| D1 databases | misomoon-shard-0, misomoon-shard-1 | Events and visits |
| Queues | misomoon-events, misomoon-events-dlq | Event buffering, and failed batches |
| Cron trigger | Every 5 minutes | Reports, alerts, and retention |
Deploy with the button
Select the button:
Sign in to Cloudflare, and connect your GitHub or GitLab account. Cloudflare copies the deploy bundle into a new repository that you own.
Keep the default names for the databases and the queues, or change them. The migrations use binding names, so any names work.
Select Create and deploy. The build creates the databases and the queues, applies the migrations, and deploys the Worker.
When the deploy is done, open the Worker's URL. It looks like
https://misomoon.<your-subdomain>.workers.dev.
Continue with claim your instance.
The button deploys the bundle that CI builds from main and publishes to the deploy
branch. It sets SIGNUPS to invite, so only the first person can sign up.
Deploy from the command line
You need Node.js 22.5 or later, pnpm 10, and git.
Clone the repository and install the dependencies:
git clone https://github.com/jackzard/misomoon.git cd misomoon pnpm installSign in to Cloudflare:
pnpm --filter @misomoon/api exec wrangler loginClose open sign-up. In
apps/api/wrangler.jsonc, setSIGNUPSinvarstoinvite. Change the line ifvarsalready has one, so the key appears once:"SIGNUPS": "invite"The first account can still sign up. Everyone after that needs an invitation.
Deploy:
pnpm --filter @misomoon/api run deployThe command builds the tracker and the dashboard. On the first run, it also creates the three D1 databases and the two queues, and writes the database ids into
apps/api/wrangler.jsonc. Then it applies the migrations and deploys the Worker. Commit the changedwrangler.jsonc, so that the next deploy uses the same databases.Open the URL that the deploy prints.
To keep the data in the EU, set D1_JURISDICTION=eu on the first deploy. D1 then runs
and stores the databases only in the EU. Cloudflare sets a database's jurisdiction when
it is created and never changes it, so set it before the first deploy, and on every run
that adds shards. D1 data location
has the details.
To start with more shards, set SHARD_COUNT, for example
SHARD_COUNT=4 pnpm --filter @misomoon/api run deploy. Scale the shards
explains when you need more.
Claim your instance
- Open your misomoon URL, and select Create an account.
- Enter your email, name, and password. This account owns the instance.
After this, the sign-up link is gone. To add people, open Settings, and invite them to your team.
Claim the instance right after the deploy. Until the first account exists, anyone who knows the URL can sign up.
Track your first site
In Settings, add your site's domain.
Copy the snippet, and paste it into the
<head>of every page:<script defer src="https://misomoon.example.workers.dev/m.js?s=your-site"></script>Open your site. You appear in Live within a few seconds.
The tracking guide covers custom events, revenue, and goals.
Use your own domain
To use a domain such as analytics.example.com:
- Add the domain to Cloudflare as a zone, if it isn't one already.
- In the Cloudflare dashboard, open Workers & Pages, and select the misomoon Worker.
- Open Settings > Domains & Routes, and select Add > Custom domain.
- Enter
analytics.example.com, and save. - Set the
PUBLIC_URLvariable tohttps://analytics.example.com. Then the links in email reports point to the right place.
Update the snippet on your sites to use the new domain.
Turn on optional features
Each feature needs a secret or a variable. In the Cloudflare dashboard, open the Worker,
then Settings > Variables and Secrets. From the command line, run
wrangler secret put <NAME> in apps/api.
| Feature | What to set |
|---|---|
| Emails: invitations, password resets, reports, and alerts | One provider, and the variable EMAIL_FROM with an address on a domain that the provider verified. For Cloudflare Email Service, add "send_email": [{ "name": "EMAIL" }] to wrangler.jsonc. For Amazon SES, set the variable AWS_SES_REGION and the secrets AWS_SES_ACCESS_KEY_ID and AWS_SES_SECRET_ACCESS_KEY. |
| Email reports with the right links | The variable PUBLIC_URL |
| Google Analytics import and Search Console | The secrets GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET |
| A managed proxy subdomain for each site | The secret CF_API_TOKEN, and the variables CF_ZONE_ID and PROXY_CNAME_TARGET |
| Deleting old data | The variable RETENTION_DAYS |
| A limit on events per site per day | The variable INGEST_DAILY_CAP |
The configuration reference explains each one.
Without an email provider, invitations still work. The dashboard shows the invitation link, and you send it yourself.
A variable that you set in the Cloudflare dashboard is replaced by the next deploy from
the repository. To keep a variable, put it in vars in wrangler.jsonc. Secrets are
not affected.
Next steps
- Connect Claude, Cursor, or another MCP client.
- Serve the tracker from your own domain so that ad blockers don't drop events.
- Upgrade to a new version.
- Fix common problems.