advanced~40 minutesapi

REST API — Cursor + D1 + Cloudflare

Production API with auth, rate limiting, and docs

Edge-deployed REST API using Hono.js on Cloudflare Workers. API key management, rate limiting, and auto-generated OpenAPI docs. Under 5ms response time globally.

CursorHono.jsCloudflare D1API keys + JWTCloudflare Workers

What's Included

🔑

API Key Management

Generate and revoke API keys per user

🚦

Rate Limiting

Per-key rate limiting with configurable limits

📚

OpenAPI Docs

Auto-generated API documentation

Edge Performance

Under 5ms response time globally

Setup Guide

1

Clone and install

$ git clone https://github.com/gptsters/api-starter my-api && cd my-api && npm install
2

Create D1 database

$ npx wrangler d1 create api-db
3

Deploy to Cloudflare

Deploys your API to 300+ edge locations.

$ npx wrangler deploy

Cursor Prompt

Paste this into Cursor to generate the full codebase

Build a production REST API with Hono.js on Cloudflare Workers:
- D1 database for data storage
- API key authentication middleware
- Rate limiting: 100 requests/minute per key
- OpenAPI/Swagger spec auto-generated
- CORS headers configured
- Input validation with Zod

Endpoints: CRUD for a configurable resource.
Response format: { success: boolean, data: T, error?: string }

Tools You'll Need

Based on this starter's stack

Some links are affiliate links.

Common Issues

Related Starters

Frequently Asked Questions

~40 minutes. The setup guide walks you through every step with copy-paste commands. No guesswork.

Free. Cloudflare Workers has a generous free tier.

Yes. The starter kit gives you a working foundation. Use the included Cursor prompt to add features specific to your product.

Check our integration guides at /integrations and prompt library at /prompts for step-by-step instructions on adding any feature.