A starter app that deploys a web application, authentication proxy, and background worker to Cloudflare Workers.
- Authentication
- Web app
- Background worker
This codebase is written Typescript and runs on the Cloudflare Workers runtime, an open source runtime similar to the Web Workers API which differs from what runs on Node or your browser. It uses a lightweight framework called Hono for routing and templating. The codebase is tested with Vitest and builds and deploys with Wrangler. A GitHub action builds a zip artifact and deploys it to Cloudflare Workers. See the starter in action at starterapp.work (login required).
-
Create a
.dev.vars
file from the example.cp .dev.vars.example .dev.vars
-
Edit the
.dev.vars
file to match your configuration. -
Migrate your local database.
npm run migrations:apply
-
Run tests with NPM.
npm test
-
Run the scheduled worker.
npm run worker:start
-
Trigger the scheduled worker.
npm run worker:trigger
-
Run the auth app.
npm run auth:start
-
Run the app and visit localhost:8788.
npm start
Create a migration with
npm run migrations:create -- $MIGRATION_NAME