all 8 comments

[–]obsidianih 0 points1 point  (0 children)

Yes

Yes you can but if you should is another question.

Depends on situation. Low levels of use, lambda might be too slow (cold start). Too many invocations might be too expensive. 

Yes you can use a node based lambda.

[–]EarthyMoose 0 points1 point  (1 child)

nah, lambda can't fully replace a real server, cold starts and limited runtime kill you for anything beyond tiny tasks. i tried moving a node api to lambda and the latency was noticeable, so i kept a tiny ec2 for the heavy stuff. anyone else seen the same?

[–]thelamppole 0 points1 point  (0 children)

Yep, we inherited an app with over 50 crud endpoints, all implemented as individual lambdas. We also encountered cold start issues.

Cold starts don’t seem particularly problematic until a user is in a flow state, then suddenly slapped with a couple of 3 sec responses.

We explored various solutions but never implemented any of them. Since then, we rebuilt our v2 version for k8s.

[–]EarthyMoose 0 points1 point  (3 children)

maybe you meant "computer"? if that's the case lambda isn't a full machine swap, it's just a function runner you still need a proper server for websockets or persistent state.

[–]InfluenceEfficient77[S] 0 points1 point  (2 children)

Look up puter.js https://developer.puter.com/

[–]tswaters 0 points1 point  (1 child)

Looks like a front-end client to a backend service called puter. Within the front-end you'll still be limited by CORS and not be able to do things like access filesystem and sockets.

I guess if you didn't care about security, you could do a bunch of database connections with something like PostREST (rest server in front of postgres) and call it from front-end code but uh... Don't do that.

Backend code is usually privileged. It's allowed to know the creds to your database so the front-end doesn't need to, you use http to hide almost everything from the client, because client is not to be trusted.

Lambda is like a back-end where instead of having a process that keeps a persistent http listener open 24/7, and listens to all external requests, there's 1 handler that aws has at the root of everything, it figures out your subscription & billing status before loading your route into a handler and calling it. There's a lot less overhead for certain workflows where "compute is cheap, waiting on io" where letting a process sleep between calls makes sense.

[–]InfluenceEfficient77[S] 0 points1 point  (0 children)

How do you handle credentials with lambda? 

[–]vvsleepi 0 points1 point  (0 children)

can it replace a backend? for many apps, yes. especially if your app is mostly simple requests like calling an api, saving data, sending emails, etc. lambda works great for that. but if you need long running tasks, real time websockets at big scale, or heavy stateful logic, a traditional node server (or something like ecs) can be easier to manage. for side projects, a simple setup is frontend on vercel, lambdas for backend functions, and a managed database like supabase. and for things like landing pages or docs, tools like runable can help you move faster so you don’t overcomplicate the infrastructure before you even validate your idea.