React Router
Mount the API, render the page and schedule checks in a React Router app.
The adapter turns a status page into the loader and action exports of one
catch-all route. React Router passes the Web Request through unchanged, so
nothing is translated.
Project shape
my-status-page
- heyo-status.config.ts
- heyo-status.database.ts
src
- root.tsx
- routes.ts
routes
- _index.tsx
- api.heyo-status.$.ts
styles
- status.css
- react-router.config.ts
- vite.config.ts
The API route
loader serves GET, action serves POST, PATCH, PUT and DELETE.
The route path and basePath must agree: api/heyo-status/* pairs with the
default "/api/heyo-status".
The page
await import("../../heyo-status.config") inside the loader keeps the
embedded database adapter on the server-only path, out of the client graph
and out of build-time static analysis.
Root layout
Layout also renders for error boundaries, where the loader never ran —
hence the optional chaining on data.
Scripts
heyo-status dev -- wraps the framework dev server so the local cron
scheduler runs beside it and stops with it.
Requirements and deployment
- Node.js 20.19+ in production for native
tcpandsslchecks. - Cloudflare Workers: the overlay adds
src/status-worker.ts, which binds D1 before the request handler runs and forwardsscheduledevents. See Deploying to Cloudflare. - Vercel: the overlay adds
src/routes/api.cron.$task.tsand avercel.jsonwith the three cron entries. See Deploying to Vercel.