4 ms·
hey hn, supabase ceo here This is a webserver for Deno. It is MIT licensed, written in Rust, and based on the latest Deno Runtime (1.32+). It can serve TypeScr
by kiwicopple 4y ago
hey hn, supabase ceo here
This is a webserver for Deno. It is MIT licensed, written in Rust, and based on the latest Deno Runtime (1.32+). It can serve TypeScript, JavaScript, and WASM functions.
This one is important for local development and self-hosting. For local development, it ensures there is parity between development and production. For self-hosting, it means you can deploy and manage your Deno Functions on your own hardware. We have provided a Demo repository for deploying to Fly.io [1]. The runtime is not production-ready, but it is in a usable state. Note that we still use Deno Deploy at Supabase, and strongly recommend it for your own Deno functions.
In the medium-term, this will reduce our tech-stack by 1 service. We'll remove Kong (a reverse proxy) and replace it with the Deno runtime. I'm excited about some other possibilities that this provides for self-hosting - one that we talked about was the ability to bundle a SQLite file with your functions, for a fully-contained and globally deployed webserver.
The team will be around if you have any questions
[1] Deploy on Fly: https://github.com/supabase/self-hosted-edge-functions-demo https://github.com/supabase/self-hosted-edge-functions-demo
- CoolCold 4y agoHey! I wonder, why CEO, not even CTO or other Principal Engineer come here in person. Is it cuz company doing so great that CEO has so much free time to spend it on activity of that sort or HN is consider so serious resource to spend time on it even for C level person..
- kiwicopple 4y ago1. HN has been invaluable to us, guiding what we build and highlighting the areas we need to improve. 2. We encourage all of our developers to participate in the discussions, I just am usually just faster to respond. 3. Personally: I love HN and the community. I read it every day and learn a lot from it. I'm a developer like most other readers
- trevor-e 4y agoIs Supabase targeted towards webdev "apps" or mobile "apps"? As a mobile dev I got excited to check out a Firebase + serverless alternative, but the docs seem very targeted towards webdevs and non-native apps. I see there's a 1.0 Swift library that's available, would love if someone can chime in with their experience using that in an iOS app.
- MrOwnPut 4y agoThey seem to have Flutter support but the lack of React Native support is non starter for me.
- kiwicopple 4y agoActually React Native is supported with the JS libs. While we don't have React Native docs, here is one for Expo which should be easy enough to convert: https://supabase.com/docs/guides/getting-started/tutorials/with-expo https://supabase.com/docs/guides/getting-started/tutorials/w... We also support swift: https://supabase.com/docs/reference/swift/introduction https://supabase.com/docs/reference/swift/introduction One more thing - we will have some more announcements for mobile (specifically auth) tomorrow.
- MrOwnPut 4y agoI see, awesome. Thanks for the clarification!
- paradaux 4y agoI'm working on several RN + Supabase projects and it just works ! There were a few kinks initially, like URL polyfil being missing from RN and the need for AsyncStorage alongside supabase.js but they've all been rectified by the team or made more clear using their Expo instructions in the docs — Although maybe it'd be clearer for people that the expo guide is for RN? People who haven't started using RN might not know the connection? It's such a pleasant stack, we're experimenting currently with edge functions in place of an API in certain places, so far it's just to use Cloudflare Turnstile to insert contact form records into a database, but it's super trivial. Excited for the future of edge functions!
- tychi 4y agoGreat work! I've been dabbling with deno for a couple years now, one of the most powerful features I'm excited about is BroadcastChannel[1] support, which works with --unstable in Deno Deploy. One of the challenges I've run into is debugging timeouts in deno deploy, so I'm curious-- 1. is BroadcastChannel supported in supabase self-hosted edge functions? 2. is there more tooling available to supabase edge functions to debug than currently in deno deploy? [1]: https://deno.com/deploy/docs/runtime-broadcast-channel https://deno.com/deploy/docs/runtime-broadcast-channel --- if curious of specifics, this is my work in progress proof of concept, exploring using pathnames for channels, to get anyone on the same url path connected across regions through sockets and broadcast channel: https://github.com/tylerchilds/kickstart/blob/869506c9dae1e1bd6b802b868fb55c33d9dd2be5/src-edge/mod.js https://github.com/tylerchilds/kickstart/blob/869506c9dae1e1...
- laktek 4y ago[Supabase engineer & author of the blog post here.] Thanks! Good Questions 1. We haven't enabled BroadcastChannel in the Edge Runtime. Mainly because we haven't found good use cases for it within Edge Functions (it does make sense as a way to subscribe within a browser client, but not sure how it fits with async/short-lived nature of Edge Functions). Curious about how you plan to use BroadcastChannel in Edge Functions? 2. As I've mentioned in the blog post Edge Runtime allows you to tweak the duration and memory available for an Edge Function (check the examples/main/index.ts in the repo too). Personally, I use this option to debug timeouts and memory issues on Edge Functions. We also plan to introduce better ways to profile your Edge Functions in the future.
- tychi 4y agoThanks Lakshan! I don't think my use-case is necessarily a good fit for edge functions. I am trying to achieve what Supabase realtime/multiplayer accomplishes, but generically. I participate informally with the https://braid.org https://braid.org IETF working group, which to over-simplify is CRDTs over HTTP with subscriptions. I'm interested in web standards and that's what's drawn me to deno, so I'm super excited the more and more I see it being adopted. BroadcastChannel piques my interest because it is perfectly in that gray area of standardization-- it makes total sense on the client and we're on the cusp of discovering what that could look like for servers. In deno deploy, all the instances of my service are able to be linked together by BroadcastChannel, which I'm viewing as a p2p-style architecture. Ultimately, I'm curious about how this works under the hood and if it would be possible to interoperate a BroadcastChannel between Deno Deploy, Supabase, and say a Raspberry Pi in my house. I've gone on a bit of a tangent, but I think maybe I should get involved with the WinterCG, since now that I'm putting my thoughts to words-- seems like it fits their charter.
- wdb 4y agoAny details about the removing of Kong? What did you use it for and how will this help with removing it?
- inian 4y agoWe use Kong as our API Gateway, so it is responsible for authentication, rate limiting, routing, etc. By moving that to edge runtime, we simplify our stack since we already run a edge runtime container to run user functions. The other motivation for doing this is that it makes our API Gateway programmable with user defined functions. For example, you could implement custom transformations for storage or augment the Authorization header with custom claims before calling Postgrest.
- SOLAR_FIELDS 4y agoThis is really exciting Inian. I’ve long felt that api gateways are one of the heavier and more complex parts of the modern infra stack and the work you’re doing to make this more self hostable is laudable!
- ovao 4y agoCongrats on the launch! I’ve been so underwhelmed with Lambda’s lack of forward progress lately and have been wanting to play around a bit with V8 isolates. This looks like a super-easy way to get a runtime spun up and handling requests on AWS.
- helsontaveras18 4y agoOpen question: what are the benefits of replacing Lambda with this new service, if you’re not using any other Supabase functionalities? Our Lambdas are currently written in Typescript and built with esbuild. We zip them and push to AWS.
- easton 4y agoThese would boot faster since you don’t have to boot a whole OS, just a V8 VM. Downside is compatibility, your lambdas would have to be largely rewritten (especially if they rely on any other AWS services). It’s also probably more expensive since you’d have to keep a EC2 or something up running this. Kinda wish Amazon would have an alternative runtime that was more like this. They kinda do with lambda@edge, but that’s only for CloudFront stuff, mostly.
- ovao 4y agoLambda@Edge is a great solution for the locality problem (CloudFront can just route to the nearest edge function, and despite certain headaches, it works well), but what it doesn’t help to solve is the cold start problem. In a sense Lambda@Edge works against it, as provisioned concurrency is only supported for ‘regular’ Lambda functions. At a certain level of scale, the cost of spinning of an ALB Fargate task (which could run these servers relatively easily) ends up being relatively negligible. Although that’s certainly not true for every org.
- ovao 4y agoThe largest advantage currently (in my opinion) is with respect to cold starts. Lambda has gotten significantly better over the years, but cold starts are still a concern, largely because it’s difficult to anticipate the level of needed provisioned concurrency needed to mitigate it. Not having to think about that at all would be a large advantage (I’m ignoring Lambda SnapStart since it’s strictly limited to Java at this time). It’s also the case that there’s just so much historical baggage within Node, mainly with regard to CJS. Developing against Deno at least presents the opportunity for us to move past that and improve DX.
- samuba 4y agoInteresting! Do you have an idea of what it would mean performance/latency wise to replace kong with this?
- laktek 4y agoWe are yet to complete our Kong replacement. Once we do that, we'll probably publish another blog post with performance benchmarks.
- NiekvdMaas 4y agoOne of the biggest annoyances with Deno deploy/functions is that there is no way to store any data. This would be very useful to e.g. cache an auth token, store a key/value pair, etc. See also: https://github.com/denoland/deploy_feedback/issues/110 https://github.com/denoland/deploy_feedback/issues/110 Is any work being done to fix this? Or is this out of scope currently?
- laktek 4y agoYes, this is something we are exploring for Edge Runtime. One cool development is AsyncLocalStorage now works on Deno via a polyfill [0]. We may enable a single node store on Edge Runtime using this. Also, there are some interesting development in Supabase platform to enable Edge Databases, which could also be an answer to this. [0] https://github.com/denoland/deno/issues/7010#issuecomment-1418995646 https://github.com/denoland/deno/issues/7010#issuecomment-14...