The Perfect SaaS Tech Stack
Learn how to create your Perfect SaaS tech stack with the best programming language and build a multi tenant architecture on AWS for your SaaS web app.
Join the DZone community and get the full member experience.
Join For FreeEntrepreneurs, CEOs, CTOs, and IT leaders are generally tasked with choosing the ideal SaaS tech stack. Ultimately, this will be a deal-breaker in the success of your application. You can have a fantastic idea, marketing, and sales team. However, if your SaaS tech stack doesn’t scale, evolve, and continuously transform, you might be ending refactoring your entire SaaS web application every other year. This approach usually results in a waste of time, resources, and money.
A quick look at SaaS communities and questions usually arise about what would constitute the perfect SaaS technology stack. The right answer to this question would be one that includes the combination of language and tools that get the job done.
This post explores some of the most common Saas tech stacks that are essential to incorporate in your SaaS company. It also shows you why we choose python over other programming languages.
We strongly recommend considering alternative options such as Java or Javascript (Node.js). There are different languages and tools that will make your developers’ lives easier and save web development costs. The following addresses some business capabilities that are essential for your SaaS tech stack and SaaS platform.
1. What Is a Tech Stack?
A tech stack is the combination of the programming languages, development tools, libraries, frameworks, and software used to develop a web or mobile application. It is an essential element of the development process and one of the first steps to create your app.
The tech stack is divided into two different sides including, the front end and the back end.
The front end or the client-side of the application refers to everything the user can see on the screen and interact with, including the app’s format and design. The frontend technologies include HTML, CSS, JavaScript, UI frameworks, and libraries.
On the other hand, the back end or the server-side refers to the invisible part for the users that require frameworks, programming languages, servers, and operating systems.
2. Why Your Tech Stack Is Important?
We’ve understood what is precisely a tech stack, but why is it a significant consideration for building an app? Well, its importance lies in the fact that your tech stack will determine your application’s scalability, functionality, and viability. Hence the relevance of making the right decision about the best tech stack based on your company needs.
Like I mentioned before, it is paramount to choose the right tech stack before starting your project because once you start using it, it will be challenging to make changes and may require extra amounts of money and time.
3. How To Choose the Best SaaS Tech Stack?
The criteria for selecting the best SaaS tech stack is usually based on:
1. The predominant current developers’ language at your company.
2. The community size of software language and platforms.
3. Lower learning curve. For example, Python is easier to learn than other programming languages, from simple syntax, versatility, and very intuitive reading python code.
4. Current technology adoption by SaaS companies. For instance, the SaaS community widely uses AWS.
5. Ease of hiring developers to match your SaaS tech stack (Critical).
6. Potential future and long-term support.
In addition, your SaaS tech stack approach must allow you to remain agile, simplify development maintenance, and optimize costs.
4. SaaS Technology Stack Diagram and Example
5. Programming Language
5.1 Back-End Language: Python
Python is the world’s fastest-growing language for software engineers, mathematicians, network engineers, and even kids. People from different disciplines use python for a variety of different tasks, including data analysis, artificial intelligence, machine learning, and web and mobile applications – even Desktop apps!
Python is leveraged by multiple known companies, including Youtube, Google, Quora, bitbucket, Instagram, and much more. It seems to be the de-facto solution for your SaaS platform if your business requires a lot of back-end logic, including high-computing algorithms, statistics, data science, high performant API REST apps, and web scraping.
Python advantages
✔ Strong ecosystem, including libraries, and framework.
✔ You can create fewer lines of code with python VS any other language.
✔ The environment can be very stable VS other languages like javascript, PHP, and Ruby.
✔ The ability to modify the code while it is running is a significant advantage.
✔ The Machine Learning and Artificial Intelligence (ML / AI) integration is a big plus with Python. The most disruptive ML/AI frameworks are based on python and this makes developers comfortable working with this language.
Alternatives: Java or Node.js. Read the Basics of Multi-tenant Node.js and PostgreSQL to learn more about it!
Python Framework
Don’t forget about your Python Framework. Nowadays, there are two top-notch python frameworks to develop your next-gen SaaS solution; Django or Flask. They are both powerful, rich, and widely adopted.
Let’s explore both options.
Django
Django contains an all-inclusive python framework. You get the ORM, directory structure, database interfaces, and admin panel all out of the box. It is easier to learn and has a wider community compared to Flask. It’s also very agile to troubleshoot through the Django shell, can be integrated with multiple SQL tools, and offers an admin interface.
If you are a new python developer, go for Flask to understand the foundational concepts and then decide to go to Django or stick with Flask. But if you need to develop fast, have no time for a lot of research, and have the ease of finding local developers, go with Django.
The bottom line is that Django is widely used as more developers are familiar with it. Django is also relatively quicker for building MVPs.
Flask
According to the Python developers learning the language from scratch, Flask is a better option. Still, after your development gets extended and customized, Flask can become more complex to maintain. Flask is the typical choice by developers (pythonists) who love learning the backbone of every back-end logic.
Developers prefer to understand every piece of the backend, but this ends with lower development in the first instance. On the other hand, with Django, you create production systems without understanding the whole concept of python and its framework.
5.2 Front-End Programming Language: React
I have found a common denominator across startups, fintech, and SaaS companies in the last two years, and it’s React. We get product development requests with specific technology requirements from python, go, java, and Node.js in the back-end, but the front-end concern is usually React.
Our experience based on our projects' range speaks volumes. Six out of ten of them include React, two are angular, and the rest are either Vue.js or Jquery. Based on current trends in 2020, perhaps in 1-2 years, Vue.js will take a larger piece of the cake. However, a quick look at Google search trends and Stack Overflow questions seem similar that React beats every front-end language by 2-3X.
Similarly, React has become a buzzword where web developers that fortune 500 companies including Netflix, Airbnb, and Dropbox are looking to move towards. On the other hand, sadly, Angular is going down.
In this graph, you can see the Reactjs trend, look at how it is climbing, and taking the lead regarding the Stack Overflow questions
Google Trends comparing Angular vs React vs Vue
In this case, Reactjs has been for a while the number one in Google searches; comparing to Angular or Vue, it’s almost 3X times!
React
Now that you understand that React is a top-trend and widely used front-end programming language. Let’s learn a little bit about why it is your best option. Facebook developed this front-end Javascript framework, a library used for UI/UX and to create beautiful interfaces. Its main feature is that it is divided into different modules and components, allowing it to make fast and efficient front-end applications with very little effort. If you know Javascript, your learning curve on React will probably be more comfortable and friendly.
Use cases for React
- Social networks.
- E-commerce sites.
- Landing pages.
- Dashboards.
- Front-end and UI websites.
React features
✔ Client-side development
One key differentiator for choosing your front-end programming language is developing and building features on the client-side (visitor’s browser). This was revolutionary and came by a disruptive ecosystem from Angular.
Have you noticed that you need more CPU and memory in your browser recently or in the past? Have you realized that Chrome or Firefox consumes a lot of RAM or computer resources? Well, here’s your answer, React is processed mainly on the client-side, leaving all computing to the visitor (end-user).
✔ React Virtual DOM
Another vital component is the use of its virtual DOM, which facilitates the update of “components” and views without the need to update the whole “view” when a visitor is interacting with the application. React is not eliminating Server-Side-Rendering, it is just using it whenever it needs to, just like it’s serverless! It consumes server CPU/resources whenever it needs.
✔ Hybrid mobile development
React can be used for mobile development as a hybrid mobile platform. When utilizing the React Native platform, you can develop your mobile features and remain compatible with both IOS and Android platforms. Remember when you had to develop an IOS version with Objective-C or Swift; then develop the Android mobile version with Java, Kotlin? — so expensive.
With React Native, you have one mobile solution, which enables you to develop faster, reduce web development costs, and time to market. I’m not saying that React native is the only platform to build hybrid mobile solutions, but it has this capability, which isn’t available in other front-end frameworks.
✔ React components and their reusability
With React, you are allowed to develop your interfaces with “components” and re-use the features/functionalities, just like your back-end development as modules. Why reinvent the wheel when you could group your interface functionalities (menu, dropdown, etc.) and re-utilize them to speed your web development?
6. Cloud Provider: Amazon Web Services
For Owners/Founders, CEOs, and IT Directors, it’s important to understand this. The Cloud’s real value is not about reducing “Hosting costs”. Instead, it reduces 20-40% of your web development costs, which means less man labor costs and faster time to market. So, forget about the idea of a cheaper hosting solution with Godaddy, Digital Ocean, or on-premise, in the long run, the Cloud will be more cost-effective when you compare the whole equation.
Let’s examine a practical approach. Let’s say that you have a SaaS project with an estimated nine months of development and three months of DevOps practices. If we introduce this in a nearshore model, it would cost around USD 288,000 (4 senior developers – costs can vary, it depends on the number of developers, complexity, and type of technology).
If you estimate this with a cloud provider (Amazon Web Services), including its pre-configured and built-in technologies that Amazon provides, you would probably reduce web development costs up to 30%, meaning 86.5K USD of cost reduction. Now, do you understand the real value of the cloud?
Don’t worry about paying $1000 – 2,000 USD per month of your web hosting on AWS or even thinking that going on-premises, Bluehost, or Digital Ocean will help you reduce costs. The latter still minimal reductions and these savings are crumbs VS your team’s web development labor costs, and even much more if you have an in-house team or with U.S/CA/Aus Talent.
6.1 Why Choose AWS For Your SaaS?
According to Gartner, Amazon Web Services has been a leader in the IaaS market for 13 years and is ranked with the highest score. From the market view, AWS is without a doubt your best option.
Important Facts About SaaS Tech Stack on AWS
✔ AWS is five years ahead of the rest of the Cloud providers, which means they started five years early, and hence, they have a much more mature cloud service ecosystem than the rest.
✔ All communities and niches use AWS. If you consult a Fintech, bank, or software company, they are using AWS 70% of the time.
✔ AWS disrupted and revolutionized the world with Amazon S3 in 2007, Ec2 instances, Amazon ECS, and the serverless ecosystem with Amazon Lambda.
✔ I have consulted multiple SaaS companies, young startups, and most of them are in the AWS cloud.
6.2 Alternatives: Azure and GCP
- Microsoft Azure. If it is Windows-based, go for Azure.
- Google Cloud Platform. Free Credits or Big data solutions can be a good choice.
6.3 Monolithic, Microservices, or Serverless Ecosystem
Monolith: This is a pure unit system deployed together and can’t be de-coupled or decomposed into pieces of software (modules). Consequently, monoliths are obsolete.
A single system of deployment (where you can’t de-couple or decompose your system), pure EC2 instances, physical servers, VMware virtual machines without docker or microservices, Godaddy virtual servers, WHM/Cpanel servers, etc. Monoliths are hard to scale, waste a lot of CPU resources, and take longer to deploy to production.
Now, let’s move to microservices.
6.4 Docker Microservice Architecture for your SaaS tech stack
What are microservices?
Microservice architecture is an architectural ecosystem where you have independent services. Each of them has a well-defined role (API, database, backend, cache, etc.), and can be independently developed, tested, and deployed.
Microservices is about a very flexible development environment that allows you to take features, develop, and deploy independently from one to another. They can also be leveraged with multiple programming languages and platforms in the same previous ecosystem.
You should definitely be leveraging microservices for your MVP or at the beginning of your SaaS product development. Otherwise, you will face multiple issues, including:
- Slow time to market.
- A decrease in web development productivity (slow web development).
- Low technology attraction by software engineers.
- Software failures (due to lack of undependability of your services).
Docker
Docker is an essential tool for running containers on Linux, Windows, and Mac. It can be installed on any local machine, cloud server, or data center. Docker was a revolutionary Open source tool/software in the middle of 2014. It is a platform that virtualizes and separates containers, fully isolated from one to another and packaged with their own software, libraries, and operating system. Docker allows you to move from physical and virtual machines into containers and microservices.
The latter (Containers and Microservices) is the next-generation application system where every container is an isolated operating system and logically separated across multiple containers with a corresponding container role within an environment. Docker can logically label and split every container as one server, one app, and one operating system.
Let’s say you are a new software developer in a company. In the past, you had to install Linux, Nginx, libraries needed for your web application, python framework, databases, Redis, Apache Spark, and finally, a git pull to get the latest code from your SaaS application. In addition to this, troubleshoot to make the local development environment work with your workstation. This process could take 3-4 days.
What about if you just run “Docker up” and you have that development environment ready to start coding in a few seconds? Do you see the difference between working days to seconds? Well, that’s how Docker, containers, and microservices are so revolutionary.
Another example that I enjoy describing to my clients is:
- A Physical server used to load in 5-10 min.
- A virtual server usually loads in around 1-2 minutes.
- A Container usually takes around 1-3 seconds to load.
Do you see the difference in development? Time to market? Speed and agility? Amazing.
Here’s another example. Imagine that you need to reboot an e-commerce server because there is a new library update. If the e-commerce was on a physical server, how much money could you lose? On the other hand, including containers will make your server very smooth to reboot in a few seconds. That’s the beauty when you need to deploy new code, reboot the system, and troubleshoot. It is 10X faster when compared with a physical/virtual environment.
Another good example is the lack of parity between your software, libraries, file configurations, and OS with your local dev workstation (developer’s dev environment), development environment, testing env, and production environment. Previously, without Docker, it was difficult to pair/sync all these pieces, setup time for your local dev env, setup time for your dev/test/prod environment, and always missing software or configurations.
Likewise, the possibility of human error due to the manual configuration of every environment. Now, with Docker in place, whatever you set up in your local dev environment will work for the rest of the enterprise environments without too much effort, actually NO effort.
Why Do You Need Containers or Microservices in Your SaaS Product?
Several reasons
✔ Faster software development for your SaaS application.
✔ By decoupling (splitting) your application into microservices, you can use fewer resources and reduce your hosting costs.
✔ It gives you the ability to work on independent services where each developer can develop in parallel.
✔ Enables you to troubleshoot independent services and reduce the point-of-failure.
✔ SaaS Services can scale independently. API, shopping cart, payment gateway, backend, database, etc.
✔ Microservices can use different technology stacks, and this brings flexibility. You could be running python 3.7 in your microservice architecture and a PHP application with PHP 7.0 version, totally independent and flexible.
✔ Containers make it easy to launch a local dev environment. “Docker up,” and you are ready to develop your SaaS product.
✔ Microservices helps with the 12-factor methodology about the parity between dev, test, and production. The ability to standardize production environments.
Microservice Clustering System (Container Orchestration Tool) For Your SaaS Tech Stack
When scaling and growing microservices with Docker, the de-facto solution is to implement Kubernetes, an awesome open-source orchestration platform for microservices. This however comes with a larger learning curve than other alternatives like Amazon ECS or Fargate. In this section, we’ll explore very quickly which container orchestration platform is better for your SaaS.
In this particular section, you need to know if you are including Docker and microservices in your Saas technology stack. The next technology is an orchestration system to manage your microservices and containers that allows you to scale and grow your SaaS application. In this case: Amazon ECS, Fargate, or amazon EKS (Kubernetes).
I won’t dive too much into this battle (Kubernetes vs. Amazon ECS) since I have already talked extensively about this on a Youtube video.
Go for Amazon ECS/Fargate for a lower learning curve and speed up your microservice clustering setup. Otherwise, take Kubernetes with Amazon EKS whenever you have a DevOps team or want to have a fine-grained and customized SaaS multi-tenant solution.
Container Orchestration Tools
- Amazon ECS. It is the natural Amazon container orchestration system in the AWS ecosystem. (Highly recommended for startups, small SaaS, and medium SaaS).
- Amazon Fargate. Almost Serverless, price, and management are per task. Minimal operational effort vs. ECS. In terms of performance, Fargate can be slower than ECS, so for this particular case, I would recommend Amazon ECS.
- Amazon EKS (Kubernetes). It is a managed service that makes Kubernetes on AWS easy to manage. Use Amazon EKS instead of deploying a Kubernetes cluster on an EC2 instance, set up the Kubernetes networking and worker nodes. (Recommended for large SaaS apps and a sophisticated DevOps and web development Team).
The winner for your SaaS is Amazon ECS, as stated in our previous video, but for the enterprise, Kubernetes might be a great fit.
6.5 Multi-tenant Architecture for Your SaaS Tech Stack
After understanding the basic SaaS technology stack for your SaaS product, you need to design your SaaS application utilizing a multi-tenant architecture approach. Multi-tenant architecture is a software architecture that allows you to run multiple single software instances on a single application system. Each instance is a tenant application coming from the same software architecture.
A tenant is also called an organization, and multi-tenancy is a term for this same architecture. As a result, multiple tenants share the same memory, CPU, code, software, and hardware resources but are logically isolated, dynamically allocated, and cleaned up as needed.
Adopting a multi-tenant architecture approach brings multiple benefits including the following:
✔ Multi-tenancy
Described above. Link
✔ Single codebase
One single source code of trust, instead of getting concurrently code repositories per each tenant or organization, now with this approach you have a single repository for the entire SaaS product, which will bring agility, and less maintenance and complexity.
✔ Innovation speed
The ability to maintain one repository and a single codebase, as a consequence, allows you to innovate faster and improve development productivity.
✔ Microservices and serverless adoption
Adopting a precise multi-tenant architecture strategy allows you to leverage modern enterprise cloud-native ecosystems, including Docker, containers, microservices, and Kubernetes – the top DevOps and cloud-native trends for the next years.
✔ Automation. Adopting a multi-tenant approach allows you to automatically bring new tenants, clean up tenant subscribers that are not within the SaaS, and reduce maintenance costs.
6.6 Database software for your SaaS Tech Stack
There are two natural choices, Amazon DynamoDB or Amazon RDS with Postgresql.
Amazon DynamoDB
Amazon DynamoDB is based on the open-source database named Mongodb and is a NoSQL database, which means Amazon DynamoDB is an API-driven database and doesn’t use SQL.
Benefits of Adopting Amazon Dynamodb
Amazon DynamoDB is an extremely high performant and fast database, easier to scale VS other traditional databases, more comfortable to manage vs. a pure MongoDB database. if your SaaS product needs high reads and writes into your database, AmazonDB is your best buddy. Another classic scenario is when you need to structure your data as documents or a few tables with a lot of information.
Amazon DynamoDB Use Cases
1. For applications requiring to support document-oriented tables.
2. For Large-scalable applications
3. Applications for saving and storing large data objects Millions and Billions.
4. Applications that require reading and write data streams and data transactions in microseconds.
5. Required applications to save user profile, user events, user activity, and any activity.
6. Track Order activities and create Data Lakes (along with Amazon S3, AWS Glue, and AWS Data Pipeline)
When Not To Use DynamoDB
1. When storing more than 400KB of data. Ex. Storing files or images of more than 400 KB. In this case, Amazon S3 would be the perfect fit to store this type of file.
2. For entity relationships across different tables.
3. For OLAP processes as it can be challenging to run on DynamoDB.
Database Alternative (Highly recommended to consider)
Amazon RDS with PostgreSQL. PostgreSQL is a mature, open-source, and enterprise SQL database, and It is the preferred SQL database from various enterprises and startups. Overall, it’s a highly scalable, transactional, and distributed database.
The de-facto solution for building enterprise software and mobile applications. Amazon RDS took the open-source Postgresql database and transformed it into a Database Managed service, which comes pre-configured, pre-optimized, and ready for the enterprise labeled as Amazon RDS with Postgresql.
Winner: By default, go with Postgresql, but if you own a sophisticated development team, determine which queries and data can be moved to DynamoDB/MongoDB and use both.
6.7 Database Multi-tenancy
Database multi-tenancy per se has the same theory as a multi-tenant architecture, except for the database layer.
Quick definition: “Database multi-tenancy is the ability that has a single database system to serve multiple tenants/organizations within a database environment.“
In addition, to design your SaaS technology stack with a multi-tenant architect at the application layer, the database layer also needs a multi-tenant architecture but in the database.
There are a few options to design your multi-tenant database, which are described as next.
- Single database: Multiple tables and identified by tenantID.
- Single database: Single database: a table per tenant
- Single database: a schema per tenant (bridge model)
- Multiple databases: a database per tenant (siloed model)
7. Cloud storage: Amazon S3
7.1 What is Amazon S3?
Amazon S3 is a simple cloud storage service, redundant, highly scalable, and available. You can store and retrieve any type of file and can be served from the web. The service can be accessed as an API, and every file is an object within a bucket or resources. It is elemental that all your static content, including images, media, and HTML, or even if is possible your Angular, React application (front-end) should be hosted on Amazon S3.
Amazon S3 was the second revolutionary service from Amazon Web services, after creating the EC2 instances back in 2006. Amazon S3 changed the game of how to store files and host to serve those files and HTML. Removing the need to have a server running to serve a file or serving an HTML, was totally disruptive.
Note: Hosting your Angular, React front-end application in Amazon S3 can be challenging and requires a fair amount of expertise by a DevOps engineer or Software engineer. I would leave this solution as the second stage of your growth.
8. CDN – Amazon CloudFront CDN
After setting up your cloud storage, the next step is to incorporate a CDN in front of your Amazon S3 or any static content within your Application stack, which will allow you to save bandwidth costs, increase speed, and high performance to your SaaS tech stack application.
Amazon CloudFront CDN is a fantastic component with numerous features to highlight and collaborates commonly along with Amazon S3. Amazon CloudFront, it’s a Content Delivery network aimed to cache content, distribute requests, serve video content, and offer many more features.
8.1 Some CloudFront capabilities
✔ This CDN is globally distributed, consequently, traffic is routed to the nearest edge location helping to improve user experience and speed.
✔ It helps improve application speed by caching static/dynamic content coming from the Amazon S3 or EC2 (origins).
✔ It helps reduce AWS bandwidth costs coming from the Amazon S3 due to its caching magic.
✔ Similarly, It’s used as a video hosting solution for Media/Video streaming.
✔ It’s built to improve application performance and scalability by granting low latency.
✔ CloudFront can help to secure your back-end instances and filter common botnets/DDoS attacks. This is achieved with the help of an AWS WAF.
✔ It decreases the load on web instances, enabling us to use fewer AWS resources.
✔ It has support for security certificates (SSL/TLS).
8.2 Alternative CDN
Cloudflare CDN is recommended for its cost-effective pricing. If your saas application consumes a fair amount of bandwidth, you should consider starting with Cloudflare CDN.
8.3 Caching system
AWS ElastiCache is a caching and data storage system that is fully scalable, available, and managed. It aims to improve the application performance of distributed cache data and in-memory data structure stores. It’s an in-memory key-value store for Memcached and Redis engines. With a few clicks, you can run this AWS component entirely self-managed. It is essential to include a caching system for your SaaS application.
If you have any questions about your SaaS technology stack diagram:
9. Closing thoughts
This guide explores the perfect SaaS tech stack and is aimed at helping you understand the merits and drawbacks of every IT layer involved. On a final note, you should aim to avoid the typical mistakes that founders and CTOs make when setting out. For instance, starting out with technologies and platforms that have small communities, are hard to learn, or show no real signs or trends of long-term growth.
Staying informed as well as incorporating ready-made or preconfigured solutions like Amazon Cognito, and leveraging popular programming languages such as Python should ideally help to set you on the right path.
Published at DZone with permission of Alfonso Valdes. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments