Host Your SAAS Completely Serverless and Free
Tags: saas, serverless, webdev, startup
Published: 2022-10-22 16:45:00

SAAS architecture is inherently complex and designing one on a tight budget can be extremely difficult. When you are starting as a founder your focus should be on acquiring users, getting feedback, and building a great product. This is where a serverless architecture comes in, it handles all the underline complexity of managing servers through an abstract interface.

**Disclaimer ⚠️** - This article doesn't convey that you will be able to host your SAAS for free forever. A lot of these tools have Free tier and credits for Startups. That can be used to host your SAAS app for a year or so, or until you receive traction.

## What are the benefits of hosting your SAAS on a serverless architecture?

- Most serverless platforms have generous limits and have pay as you go, model. So your cost is directly proportional to your usage. If you price your product correctly you don't need to worry about the infrastructure pricing at all.
- Serverless scales really and the underlying complex infrastructure is abstracted. This way when your SAAS takes off you do not need to about scaling your infrastructure on worry about the platform going down.

## What things to consider before using a serverless architecture?

- You have tonnes of users and a big team. Although, If you are following a microservice-based architecture some of your services can be hosted on these platforms but at that stage, it makes more sense to look into Bare Metal Servers, you will be able to reduce your cost drastically(That's a topic for another day).
- Your SAAS uses very long-running processes like web crawling. Most serverless platforms have a hard timeout limit. This only means your backend for this service. The rest of your application can still be serverless.
- Your SAAS uses really huge Machine Learning models. The most popular platforms have a memory limit(AWS has 10Gb). **Bonus:** If you are planning to use such a model. You might want to look into GPT3. Here is a [crash course to get started with GPT3](https://sid.black/blogs/gpt3-crash-course).

## Tools to consider for your Serverless architecture

There are a lot of tools in the market. Here are my personal picks, Which I have personally used and should cover a majority of use cases.

### Website and Web Application Hosting

[Netilify](https://www.netlify.com/) and [Vercel](https://vercel.com/) are best suited for web hosting. I personally use Vercel but Netilify is equally good. They both have CDN built in, generous limits(paid plans starting at 20$), image optimization, Continuous Integration and Continuous Deployment.

You might want to consider using Cloudflare as A DNS management service as it offers DDOS protection, loads of optimizations and a free inbox for your @domain emails. If you don't want to buy Gsuite or similar services.

### Backend and Crons Hosting

[AWS Lambda](https://aws.amazon.com/lambda/) is my go-to choice when it comes to backend hosting. You can configure your domain or subdomain in [Route 53](https://aws.amazon.com/route53/) and [API Gateway](https://aws.amazon.com/api-gateway/) to interface with your functions via REST API. I highly recommend using [Serverless](https://www.serverless.com/) for deploying your code. It abstracts all the complexity and you can deploy all the complex cloud configurations using a simple YAML file.

### Databases

Depending on your use case you should consider one of the following.

- [Firestore](https://firebase.google.com/products/firestore) - If you need a real-time database and need 2-way communication between your frontend and backend.
- [AWS DynamoDB](https://aws.amazon.com/dynamodb/) - If your SAAS requires basic CRUD operation and you are planning to use a No SQL Database. This DB scales very well horizontally.
- [PlanetScale](https://planetscale.com/) - If you are planning to use a SQL database.
- [MongoDB](https://www.mongodb.com/) - If your SAAS requires Advance No SQL queries, Aggregations and etc. MongoDB Atlas has a serverless option and you can get free credits by applying to the [MongoDB Startup program](https://www.mongodb.com/startups)

### Authentication

For Authentication trust me to go with [Firebase](https://firebase.google.com/). It's super easy to implement and has tonnes of Authentication options including auth by phone numbers. The limits are amazing and are perfect if you are in the initial stages.

### Monitoring And Logging

In a serverless environment, it's super important to keep track of your errors, logs and usage. These are the must-haves for any serverless application.

- [Sentry](https://sentry.io/) - Monitor all your errors in a single place using this. This tool converts errors into issues so you can prioritize the important issue.
- [New Relic](https://newrelic.com/) - Extremely powerful with a very generous limit. Help you analyze all your logs in a single place. This comes in extremely handy when your whole application is distributed. It integrates very well with all the services mentioned above.

## Conclusion

Choosing a serverless architecture will save you a lot of time and a lot of headaches. Launching a SAAS product requires juggling multiple things. This architecture just takes the infrastructure off your plate until you can afford a dedicated DevOps person. It takes some work but you can incrementally move your application to a dedicated server.

I personally feel using the right tools can 10x your productivity. Like what you read? Check out my [top list of must have SAAS Tools](https://sid.black/tools/best-tools-for-saas).

Happy Building 😊