-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate function to generic code using Hono and bun #473
Comments
I strongly believe that this is easier said then done. Fundamentally none of the problems solved by our current conversion script are solved by bun/hono/ Let's start at the beginning. Hono does not REALLY have official support for supabase Second, we have the problem of the npm prefix. That is nice and all but it really does not solve anything. Even if we assume that EVERY package from npm will work on deno (and that likely is not the case) then we still have to account for cloudflare and netlify. Since we migrated from denoflare that means that cloudlfare with wrangler is going to be a problem. It's closer to node runtime BUT there are a lot of packages from npm that just do not work with cloudflare. If we are going to use 1 package for ALL runtimes then essentially that package has to meet the following requirements:
Given all that, it might be possible to improve the conversion script (rewriting it for example in deno + typescript for example) but I highly doubt we can get rid of it entirely / drastically improve how it works |
I whole heartedly and technically agree with that. What are the runtimes we currently use? |
right now? ( But once d1 gets integrated into production it will no longer be like this. It will go: I have wrote changed the transformation script to concert the supabase functions into ones that can be run using wrangler. This is because I needed D1 and denoflare did not support d1 locally but the entire chain i think is quite useless. Honestly the The entire code generation is a big mess. There are dirty/mysterious macros (commens) to paste some code, unexplained changes (not documented), easily breaking codegen (recently a lint caused the codegen to fail to detect some of the macros), no typescript, wrongly named folders ( |
I definitely know that. I did try doing it all to Hono but yeah it's perplexing. What are some of things in the queue which might block if I work on something? I'm thinking to do something that abstracts the core. Makes sense? |
Would @riderx and you be interested for me to work on something like below: abstract core of an API to a workflow that does aim at handling all the envs Step 1. Focus on a single endpoint, and try to migrate that and figure out the basic migration workflow. (as from your above response, it looks like it's everything edge & node w/o deno) hence we do need it for every environment. |
i think the biggest improvement you could make to this codegen system is the migration of the As for if ridex is interested in this - i do not know. Right now we are planning to migrate from denoflare -> wrangler. It's already MOSTLY in production but I was to scared to switch prod to use wranger so when Marin has a while he will likely do the switch himself. There might be occasional changes to the migration scripts but nothing big |
oh yea, i also have to change the codegen script a bit because this should be using drizzle but right now it is not This is the only change to the codegen script that is planned for the foreseeable future |
Currently, we have Supabase Deno function who are translated to Deno Netlify function, Cloudflare worker and Node function with a custom script.
This leads to some complexity.
Supabase just released support for
npm:
prefix.Hono and Bun start to be stable.
So we can now have only one base code for all functions.
We need to move all the code in a backend folder, with only export of Hono app in each function.
Env should use Hono adapter to work on any platform:
https://hono.dev/helpers/adapter#env
Then the code server implementation should be present in :
Who import the exporter app.
A script should be provided who can create a new implementation.
The script should allow creating :
He will ask for a name and create a basic hello world server endpoint, with all selected implementations.
It could be nice if the script knows how to add implementation later on endpoint who already exist.
Each time and implementation is added, the required config file is updated ( Netlify config file, Cloudflare, Supabase)
Currently, Cloudflare is implemented in preprod branch but with all endpoints on the same function and with Senoflare.
We want to switch to pure worker thanks to Hono and multi endpoint for easier debug.
This script could become an autonomus CLI in the future
The text was updated successfully, but these errors were encountered: