A lightweight Cloudflare Worker project integrating Supabase and the Cache API to efficiently manage caching and serverless database interactions.
This project is designed for developers seeking to leverage the Cloudflare global network cache for optimized performance and reduce database load while utilizing Supabase for simple and scalable backend integration.
Based on: https://github.com/cloudflare/workers-sdk/tree/main/packages/create-cloudflare/templates/openapi
- Cache API Utilization: Implement caching for improved response times and reduced requests to the origin (Supabase).
- Supabase Integration: Simplify data management with Supabase's powerful backend-as-a-service.
- Serverless Deployment: Run entirely on Cloudflare Workers for minimal infrastructure overhead.
- Sign up for Cloudflare Workers. The free tier is more than enough for most use cases.
- Clone this project and install dependencies with
npm install
- Run
wrangler login
to login to your Cloudflare account in wrangler - Run
wrangler deploy
to publish the API to Cloudflare Workers
- Your main router is defined in
src/index.ts
. - Each endpoint has its own file in
src/endpoints/
. - For more information read the chanfana documentation and Hono documentation.
- Run
wrangler dev
to start a local instance of the API. - Open
http://localhost:8787/
in your browser to see the Swagger interface where you can try the endpoints. - Changes made in the
src/
folder will automatically trigger the server to reload, you only need to refresh the Swagger interface.