A fast and lightweight quote API built using Cloudflare Workers and Hono, storing data via D1 and Prisma.
You can fetch a random quote with the following endpoint:
GET https://quotes.0xff.workers.dev/quote/random
Returns:
{
"id": 1,
"text": "The only limit to our realization of tomorrow is our doubts of today.",
"author": "Franklin D. Roosevelt"
}- Node.js (>=18 recommended)
- Cloudflare Wrangler:
npm install -g wrangler - Prisma CLI:
npm install -g prisma
npm installnpm run devThis will start a local Cloudflare Worker using wrangler dev.
npm run deployTo run performance tests using Artillery:
- Install globally:
npm install -g artillery
- Use your
.ymlor command line to simulate traffic (you can customize it as needed).
- Schedule quote-fetching from external APIs using Cloudflare Cron Triggers.
- Add pagination and search capabilities.
- Rate limiting or API key authentication (optional).
- Cloudflare Workers
- Hono - Lightweight Web Framework
- Prisma - Database ORM
- D1 - Serverless SQL database for Workers
├── index.ts # Main Worker code
├── package.json # Project configuration
├── README.md # You're reading it!
Generate Cloudflare types (optional):
npm run cf-typegenMIT — feel free to use, contribute, or fork this project!