# ADR 002: Cloudflare Workers for backend APIs

- HTML version: https://robbiepalmer.me/projects/personal-engineering-platform/adrs/002-cloudflare-workers
- Project: Personal Engineering Platform (https://robbiepalmer.me/projects/personal-engineering-platform.md)
- Status: Accepted
- Date: 2026-09-12
- Initiatives: Semi-autonomous Software Development (https://robbiepalmer.me/initiatives/semi-autonomous-software-development.md)

## Context

Small web applications need an HTTP runtime without a separately operated
server, but not every application has a backend API.

## Decision

Prefer Cloudflare Workers for the backend runtime slot. Projects activate the
slot only when they need an API.

## Consequences

Backend code must fit the
[Workers runtime](https://developers.cloudflare.com/workers/runtime-apis/).
It runs in V8 isolates, exposes Web Platform APIs, and supports a subset of
Node.js APIs. Dependencies need compatibility tests against the project's
Workers compatibility date.

Requests may run in different isolates, and Cloudflare may evict an isolate.
Backends cannot use mutable global state as durable application state. They
must put durable state in an external store or a Durable Object. CPU, memory,
subrequest, and connection limits also constrain workloads and library choices.

---

Markdown index of this site: https://robbiepalmer.me/llms.txt
