aws-lambdaserverlessnetlifyverceljamstack

Why are the serverless functions needed for JAMStack apps if I can access data securely from client?


JAMStack People are using Netlify/Zeit (or AWS Lambda) functions to access their database. But there are cloud databases like Firestore which you can access securely and directly from your web/mobile apps as described here. Then why do not people embed the data access logic into their client app too? Why do they need extra layer of serverless functions?


Solution

  • for the example you mention you're completely right. 🎉

    Serverless functions offer more opportunities though. Think for example of sending emails. Email providers usually don't provide a way to send emails from the client (rightfully so, I guess) and for that case, a serverless function can help.

    Additionally not every data storage service provides a way to securely access/write data into a database right from the client. This would be another case where you could use a serverless function.

    That said, serverless functions offer a fairly new way to quickly orchestrate and combine services to support and enrich your static site.

    Hope that helps. :)