You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3 KiB
Markdown

+++
title = "Define Cloudflare Worker route/domain — worker.dev subdomain or custom route for API"
priority = 6
status = "done"
ticket_type = "task"
dependencies = ["a23489"]
+++
<context>
Infrastructure is managed with OpenTofu using the Cloudflare provider. Configuration lives in `infra/`. Resources include a Cloudflare Worker (API), Cloudflare D1 database (bound to the worker), and a Cloudflare Pages project (UI frontend).
The API Worker needs a publicly accessible route. This can be the default `*.workers.dev` subdomain or a custom route under `elijah.run`.
</context>
<goal>
Define the Cloudflare Worker route or subdomain in OpenTofu. Options:
1. Use the default `quotesdb.your-account.workers.dev` URL (no DNS record needed)
2. Define a `cloudflare_worker_route` resource for a custom subdomain (e.g. `api.quotes.elijah.run`)
Choose the simpler option first. Document the final API base URL in the project README.
</goal>
<constraints>
- The UI API client must know the API base URL — if a custom route is used, update the UI to point to it.
- If using a custom route, a `cloudflare_record` DNS entry may be needed.
- Every block must have a comment.
</constraints>
<validation>
Run from the `infra/` directory:
```sh
tofu validate
tofu plan
```
</validation>
<commit>
`feat(quotesdb): define Cloudflare Worker route/domain for API`
</commit>