How vaibhavnaiyar/betteruptime works
BetterUptime is a website-availability monitor. A user signs up or signs in, then adds monitored URLs and views recent check status and response times. The API stores monitor records; a recurring pusher queues URLs, and workers check them and persist ticks for the dashboard to retrieve. The repository excerpts show the API, web client, pusher, and worker interactions; Redis-stream internals and the Prisma schema were not excerpted, so those connections are limited to the visible imports and calls.
Main entry points: store/index.ts Store client · api.ts API client · worker/index.ts Check worker · v1/index.ts V1 router
Components 18
Web app
- Landing page
apps/web/app/page.tsx - Sign-up page
apps/web/app/signup/page.tsx - Sign-in page
apps/web/app/signin/page.tsx - Dashboard
apps/web/app/dashboard/page.tsx - API client
apps/web/lib/api.ts
API
- API server
apps/api/index.ts - V1 router
apps/api/routes/v1/index.ts - User routes
apps/api/routes/v1/user.ts - Website routes
apps/api/routes/v1/website.ts - Token middleware
apps/api/middleware/auth.ts
Monitoring pipeline
- Monitor pusher
apps/pusher/index.ts - Check worker
apps/worker/index.ts - Stream client
packages/redis-stream/index.ts - Redis stream
Persistence
- Store client
packages/store/index.ts - Prisma database
packages/store/prisma/schema.prisma
Other components
- User
- Monitored website
Connections 21
- User → Landing page: visits
apps/web/app/page.tsx - User → Sign-up page: registers
apps/web/app/signup/page.tsx - User → Sign-in page: signs in
apps/web/app/signin/page.tsx - User → Dashboard: manages monitors
apps/web/app/dashboard/page.tsx - Sign-up page → API client: calls signup/signin
apps/web/app/signup/page.tsx - Sign-in page → API client: calls signin
apps/web/app/signin/page.tsx - Dashboard → API client: loads and manages
apps/web/app/dashboard/page.tsx - API client → API server: HTTP requests
apps/web/lib/api.ts - API server → V1 router: mounts routes
apps/api/index.ts - V1 router → User routes: registers routes
apps/api/routes/v1/index.ts - V1 router → Website routes: registers routes
apps/api/routes/v1/index.ts - User routes → Store client: reads/writes users
apps/api/routes/v1/user.ts - Website routes → Token middleware: protects endpoints
apps/api/routes/v1/website.ts - Website routes → Store client: reads/writes monitors
apps/api/routes/v1/website.ts - Store client → Prisma database: accesses
- Monitor pusher → Store client: loads websites
apps/pusher/index.ts - Monitor pusher → Stream client: queues checks
apps/pusher/index.ts - Stream client → Redis stream: writes/reads stream
- Check worker → Stream client: reads and acknowledges
apps/worker/index.ts - Check worker → Monitored website: checks URL
apps/worker/index.ts - Check worker → Store client: writes check ticks
apps/worker/index.ts