A uptime monitoring service that is easy and cheap to run at scale. Create endpoint checks for uptime, latency, and status code. Supports OpsGenie, for alerts when there are two or more consecutive failures.
TODO: expectations for cost
- Fork the repo
- Copy and fill out
.dev.vars.example
->.dev.vars
.dev.vars.example
->.prod.vars
.env.example
->.env
- Create production D1 database
- run
pnpm db:create:prod
- search for
UPDATE_ME_D1_ID
and replace with the id - run migrations with
pnpm db:migrate:prod
- run
- Update production fully qualified domain name
- search for
UPDATE_ME_PROD_FQDN
and replace with your production FQDN (e.g.uptime-monitor.example.com
)
- search for
- Deploy the app and api with
pnpm run deploy
Optional:
- Search for
UPDATE_ME_ABC
and replace with your unique values
Built 100% on Cloudflare, using Workers, Durable Objects, and D1. A quick explanation of the architecture:
- Each endpoint has its own Durable Object, known as the Trigger. This acts as a programmable CronJob via the Alarm API
- The Trigger calls a Worker, known as the Executioner.
- This is a fire and forget call via
waitUntil()
— minimizing the time the Durable Object is running and thus its cost (charged for Wall Time)
- This is a fire and forget call via
- The Executioner handles making the request to the respective endpoint and updating the DB
- This is extremely cost effective since Workers are charged for CPU Time, and waiting on I/O tasks like this costs nothing
You can find this code in the ./api
directory.
Standard NextJS v15, shadcn, TailwindCSS v4, and Drizzle stack. Some other notable points:
- pnpm as package manager
- biome as linter/formatter
- zustand for state management
- opennext with the CF adapter (not that it changes much)
- OpenAPI support via scalar
You can find this code in the ./src
directory.
Fill out the env files and run to confirm you're using the correct CF account:
pnpm exec wrangler whoami
Run the migrations and (optionally) seed the database:
# this is a convenience script that runs db:touch, db:generate, db:migrate, and db:seed
pnpm db:setup
This repo uses multiple workers, each split into their own workspace. To run everything together:
# Start both the API (monitor workers) and the Next.js app
pnpm dev
If you need to run components separately:
# Run just the API (includes both executor and trigger workers)
pnpm dev:api
# Run just the Next.js app
pnpm dev:app
# Run the API executor worker
pnpm dev:api-exec
# Run the API trigger worker
pnpm dev:api-trigger
To deploy the entire application:
pnpm run deploy
To deploy components separately:
# Deploy just the Next.js app
pnpm deploy:app
# Deploy just the API workers
pnpm deploy:api
# Deploy the API executor worker
pnpm deploy:api-exec
# Deploy the API trigger worker
pnpm deploy:api-trigger
Update dependencies
pnpm exec ncu -t minor -u
pnpm i
To generate the latest migration files, run:
pnpm run db:generate
Then, test the migration locally:
pnpm run db:migrate
To run the migration script for production:
pnpm run db:migrate:prod
To view/edit your database with Drizzle Studio:
# Local database
pnpm run db:studio
# Production database
pnpm run db:studio:prod
TODO