Configuration
Every file, script and environment value the project reads.
wrangler.jsonc#
| Key | Value | Meaning |
|---|---|---|
name | hello-fresh-api | The deployed worker name. |
main | src/index.ts | The entry module. |
compatibility_date | 2026-09-01 | The runtime behaviour set. |
d1_databases[].binding | DB | The binding name the code reads as env.DB. |
d1_databases[].database_name | hello-fresh | The D1 database name. |
d1_databases[].database_id | placeholder | Replace with the id from wrangler d1 create before deploying. |
d1_databases[].migrations_dir | migrations | Where d1 migrations apply finds SQL files. |
observability.enabled | true | Sends worker logs to the Cloudflare dashboard. |
Environment values#
| Name | Where | Meaning |
|---|---|---|
SECRET_KEY | .dev.vars locally, wrangler secret in production | The HMAC-SHA256 key that signs login tokens. Required. |
.dev.vars is gitignored. Copy .dev.vars.example to create it.
npm scripts#
| Script | What it does |
|---|---|
prepare | Runs wrangler types to generate worker-configuration.d.ts. Runs on npm install. |
dev | Serves the worker and a local D1 database on port 8787. |
deploy | Uploads the worker to Cloudflare. |
typecheck | Runs tsc --noEmit. |
test | Runs the Vitest suite inside workerd. |
db:migrate:local | Applies migrations/*.sql to the local database. |
db:migrate:remote | Applies migrations/*.sql to the production database. |
db:seed:local | Loads seed.sql into the local database. |
db:seed:remote | Loads seed.sql into the production database. |
seed.sql#
The seed creates these accounts and rows. It is for development only.
| What | Value |
|---|---|
| API user | user / password |
| Customer | alice / password |
| Classifications | Meat & Veggis, Veggie (published), Family (unpublished) |
| Recipes | Duck Breast with Cheesy Chive Mash, Southeast Asian Chicken Coconut Soup, each with two ingredients |
| Weekly menu | Week 46 with both recipes mapped and one 4-star review |
| Week 47 | Empty menu |
Password hashes use PBKDF2-SHA256 with a fixed demo salt, so the file reproduces the same rows every run. Never load it into a database the internet can reach.