Supabase integration project
I like supabase, even if you click to this button:
You will see that is exactly supabase + cloudflare. This is simple way to initialize project of that type (this is instruction from Cloudflare https://developers.cloudflare.com/workers/get-started/guide/#7-configure-your-project-for-deployment):
// Prerequisites - Sign up for a Cloudflare account - Install npm - Install Node.js // Than # npm init # npm i wrangler --save-dev # npx wrangler --version # npm i @cloudflare/workers-types --save-dev # npx wrangler whoami # npm i @supabase/supabase-js # npx wrangler secret put SUPABASE_URL # npx wrangler secret put SUPABASE_KEY // Than make wrangler.toml like this name = "xxxxxxxxxx" main = "./src/index.js" account_id = "yyyyyyyyyyyyyyyyyyyyyyyyyyyy" compatibility_date = "2023-03-04" [vars] // Than init local Git repository and start debug and deploy project # npx wrangler dev # npx wrangler deploy
This is Cloudflare worker management panel (and this is Coludflare examples https://developers.cloudflare.com/workers/examples/):
This project type can perfectly debugging directly in Browser and locally in VS Code https://blog.cloudflare.com/debugging-cloudflare-workers:
Also we have opportunity to see all request and console.log on deployed worker and have opportunity directly watch to deployed code.
So, this is my simplest Cloudflare boilerplate:
And this is more real boilerplate with Dynamic data based on Supabase:
This is third my working template what receive post request (like Express, but Cloudflare has own packages to create endpoints https://itty.dev/itty-router/, boilerplate on the screen below allow to accept Post request to one endpoint:
That's claim I collected in Supabase and link to documentation Request Headers, Cookies and JWT claims
And let me describe little bit more about Supabase. I like this online PostgreSQL based database, because this project
- free for use, like cloudflare
- support all PostgreSQL features and looks as you deployed PostreSQL locally
- has a lot of additional functions around embedded PostgreSQL reatures
- Support a lot of Authenticated methods:
This is one of intermediate moment to debug Supabase SQL stored Procedures and link to documentation to this type of procedures Database Functions
In Supabase my liked functional is WebHook, this allow me processing Notification for any inserted or updated rows.
WebHook automatically loading Payload to body from inserted row https://supabase.com/docs/guides/database/webhooks
Most interesting Supabase opportunity is Edge functions https://supabase.com/docs/guides/functions - this look as embedded workers like Cloudflare.
This type of application can very simple deployed, but unfortunately in my current development environment local debugging is impossible.
For example, in my developer environment Docker working fine and I try to start local Edge development from computer Administrator account - I sill have unresolved security issue.
And this is more serious my Supabase project, but this is not my project, therefore I'm sorry, I can not describe it.
Related page:
|