https://github.com/initialcapacity/cloudflare-workers-starter
A starter app for projects on Cloudflare Workers
https://github.com/initialcapacity/cloudflare-workers-starter
cloudflare edge functions workers
Last synced: 4 months ago
JSON representation
A starter app for projects on Cloudflare Workers
- Host: GitHub
- URL: https://github.com/initialcapacity/cloudflare-workers-starter
- Owner: initialcapacity
- Created: 2024-02-12T12:48:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-16T18:09:31.000Z (over 2 years ago)
- Last Synced: 2025-04-12T05:05:51.041Z (about 1 year ago)
- Topics: cloudflare, edge, functions, workers
- Language: TypeScript
- Homepage: https://starterapp.work
- Size: 263 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cloudflare Workers Starter
A starter app that deploys a web application, authentication proxy, and background worker to [Cloudflare Workers](https://developers.cloudflare.com/workers/).
- Authentication
- Web app
- Background worker
## Technology stack
This codebase is written Typescript and runs on the [Cloudflare Workers runtime](https://developers.cloudflare.com/workers/runtime-apis/web-standards/),
an [open source runtime](https://github.com/cloudflare/workerd) similar to the [Web Workers API](https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker)
which differs from what runs on Node or your browser.
It uses a lightweight framework called [Hono](https://hono.dev/) for routing and templating.
The codebase is tested with [Vitest](https://vitest.dev/) and builds and deploys with [Wrangler](https://developers.cloudflare.com/workers/wrangler/).
A [GitHub action](.github/workflows/pipeline.yml) builds a zip artifact and deploys it to Cloudflare
Workers.
See the starter in action at [starterapp.work](https://starterapp.work) (login required).
## Run tests
1. Create a `.dev.vars` file from the example.
```shell
cp .dev.vars.example .dev.vars
```
1. Edit the `.dev.vars` file to match your configuration.
1. Migrate your local database.
```shell
npm run migrations:apply
```
1. Run tests with NPM.
```shell
npm test
```
## Run the apps
1. Run the scheduled worker.
```shell
npm run worker:start
```
1. Trigger the scheduled worker.
```shell
npm run worker:trigger
```
1. Run the auth app.
```shell
npm run auth:start
```
1. Run the app and visit [localhost:8788](http://localhost:8788).
```shell
npm start
```
## Migrations
Create a migration with
```shell
npm run migrations:create -- $MIGRATION_NAME
```