Project: Production API on Cloudflare
Advanced · 9 missions · about 4 hours
Build Linkstash, a bookmarks JSON API that a browser extension, a phone app and a web app could all rely on. Mission by mission you spec it with AI, design the D1 schema, write the queries, router, validation, API keys and rate limits, then prove it with tests and a security review. You finish with your own API live on Cloudflare Workers.
Missions
- Spec the API with AI: Resources, endpoints, errors and limits, before any code.
- Data model: tables that guard themselves: Tables, constraints and an index that protect your data from your own bugs.
- Core queries: pages, search and counts: Keyset paging, a search that cannot leak, and honest tag counts.
- Router and handlers on D1: handle(request, env): routes, status codes and real D1 queries.
- Validation and one error shape: Clean every input, report every problem, and answer every error the same way.
- API keys and per-key rate limits: Hashed keys, honest 401s, and 429s with Retry-After.
- Tests that catch planted bugs: Write a test suite that passes on the real API and fails on six broken copies.
- Fix the AI: a security review of its PATCH endpoint: SQL injection, a missing owner check and mass assignment, in eight lines.
- Boss: ship Linkstash to Workers + D1: One Worker, a real database, a real secret and your own live URL.
Part of: Backend & Cloud Engineer career path