Strattic is great for making sure that your website is über-fast, secure, and scalable by making your WordPress static. This is great, and at the same time, it might mean there are some limitations to which plugins or services can be used on your site.
Never fear, serverless functions and services are here! 🤓 ☁️ 🚀
Check below for links where we provide some guidance and documentation on what serverless functions are, how to get set up, and also a repository of useful functions to get you started and provide “how-to” examples.
If you have any questions or would like to contribute your own function or service, please reach out.
Wait, what is “serverless” again
“Serverless” is the paradigm that removes the server from being a thing that the user manages. To quote AWS, serverless is “running code, managing data, and integrating applications, all without managing servers… [and includes features like]… automatic scaling, built-in high availability, and a pay-for-use billing model to increase agility and optimize costs.”
Since Strattic makes your WordPress static, there are no servers for you to use functionality you might normally get from WordPress when a user is interacting with your site. We’ve built out a lot of these services so you don’t have to.
But what if you want a service or integration today? Whelp, you can build a serverless function or service to cover your needs!
What are serverless functions?
“Serverless functions” are pieces of code that you run on someone else’s server. Netlify, Amazon Web Services, Google Cloud Platform, Microsoft Azure, and more, all have the ability to run bits of code as they are needed.
For example, if you have a form submission, and you want to collect emails and send them to your subscription service, you can write a function that would parse the form submission, and send just the email (ok, maybe the name of the person too) to your email subscription service of choice.
These serverless functions are used for random, ad hoc integrations, and only run when they’re called.
What are serverless services?
“Serverless services” are essentially a function or group of functions and other services that combine to accomplish a desired result. A serverless service could be:
- A single function that returns an IP address to you.
- A function that subscribes an email to a third party service.
- A group of functions and a document database that stores and returns information about a form submission, blog, or another service.
Really, serverless services can be anything, whatever you need them to be to perform an event or action in a static (or serverless environment).
When and why would I use serverless functions or services?
Here are some more example use cases for using a serverless function or service:
- If you need a “server” for something
- Hide API keys you don’t want in a browser
- Use to direct traffic and to connect and interact with other APIs and services
- Set up queues
- Send notifications or emails
- Authorize and authenticate users
- Process payments
- Process data or run processes that might bog down your site
- And so… much… more!
Ready to get set up and going?