2

I developed a node Js application integrated with some services like database, authentication from Supabase, It works fine and gave success results in local development for each routes when called from Postman. Now I want to deploy this application to make rest APIs for frontend. Supabase provides edge-functions. In their documentation they told it is an alternative for firebase functions. But I can't able to find any documentation or blog regarding deployment of node Js application. Is there any way to deploy this application like firebase functions on edge functions of Supabase Any clarification related docs or alternative solutions would be helpful.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

2

Supabase edge functions run Deno application at the moment, which is a bit different from a node.js application, so your node.js application will not deploy directly to Supabase edge functions. You would have to rewrite your code to make it compatible with a Deno application.

Luckily, since typescript, the language used in Deno functions is a superset of javascript, so you should be able to reuse a lot of the code during the rewrite!

dshukertjr
  • 15,244
  • 11
  • 57
  • 94
  • Language-wise - yes. Dependency-wise - it's a mess. – Ilya Saunkin Jan 14 '23 at 19:23
  • That's why it's paramount to write adapters around the vendor-lock platforms that we use – I feel you... Try to refactor in many small iterations and refactor all the dependencies from Node into small functions inside a single `platform.js` file, and then replace their use all around the codebase (search&replace will help you a lot). After that, you can refactor the `platform.js` to make use of Deno instead of Node. And make use of import-map to alias the imported dependencies and make them easier to use. – Kamafeather Jun 12 '23 at 11:11