Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/riteshpuvvada/supabase-workers
Proof-of-concept for making API requests to Supabase in Cloudflare Workers
https://github.com/riteshpuvvada/supabase-workers
Last synced: 27 days ago
JSON representation
Proof-of-concept for making API requests to Supabase in Cloudflare Workers
- Host: GitHub
- URL: https://github.com/riteshpuvvada/supabase-workers
- Owner: RiteshPuvvada
- License: apache-2.0
- Created: 2021-09-03T03:19:55.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-06T07:59:34.000Z (almost 2 years ago)
- Last Synced: 2023-03-03T21:44:01.971Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://supabase-workers.riteshpuvvada.workers.dev/users
- Size: 1 MB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE_APACHE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# supabase-workers 👷
This codebase is a proof-of-concept for making API requests to [Supabase](https://supabase.com) inside of a [Cloudflare Workers](https://workers.cloudflare.com) serverless function.
Supabase's [JavaScript client](https://github.com/supabase/supabase-js) doesn't work directly in Workers without using Webpack's `externals` feature to replace `cross-fetch` with the native `fetch` API in Workers, as seen [here](https://github.com/signalnerve/supabase-workers-proxy/blob/main/webpack.config.js).
You can see an example of this API at `https://supabase-workers.riteshpuvvada.workers.dev`:
- `https://supabase-workers.riteshpuvvada.workers.dev/users`: select all users
- `https://supabase-workers.riteshpuvvada.workers.dev/users/:id`: query for a user by id
- `https://supabase-workers.riteshpuvvada.workers.dev/*`: all other requests are redirected to this GitHub projectTo deploy your own version, clone or fork the project, replace the `account_id` value in `wrangler.toml` with your own, and then set two secrets using `wrangler secret put`:
- `SUPABASE_API_KEY`: anon/public key available in your Supabase project's "API settings"
- `SUPABASE_URL`: RESTful endpoint URL available in your Supabase project's "API settings"This project is built on TypeScript using [`itty-router`](https://itty-router.dev) and could easily be extended to provide a RESTful interface to your Supabase data, without needing to expose any API credentials.