There are 3 architectures your can implement when develop on my.saas.
- the stand-alone architecture,
- the distributed database architecture; and
- the master-slave-worker architecture.
Outline:
- Stand-Alone Architecture
- Stack
- Extensibility
- Pre-Built Extensions
- Distributed Database Architecture
- Master-Slave-Worker Architecture
In the stand-alone architecture, all My.SaaS components are deployed on a single server, running locally. This configuration is ideal for small-scale applications or development environments, where simplicity and low overhead are key.
The stack represented in the picture belows illustrates the underlying technologies that power a My.SaaS implementation. It includes the following components:
-
Nginx 1.18: A high-performance web server responsible for handling HTTP requests and serving static and dynamic content.
-
Sinatra / Puma: Sinatra is a lightweight Ruby web framework, while Puma is a concurrent web server designed for running Ruby/Rack applications, ensuring efficient request handling.
-
BlackStack Framework: A custom framework tailored specifically for My.SaaS, providing the core application logic and structure.
-
Ruby 3.1.2: The programming language used for developing the My.SaaS application, known for its simplicity and productivity.
-
PostgreSQL 12.20: A powerful, open-source relational database management system, used to store and manage application data.
-
Ubuntu 20.04: The operating system on which the entire stack runs, providing a stable and secure environment.
This stack forms the foundation of the My.SaaS platform, enabling it to deliver a reliable and scalable service.
In this stack, Nginx runs on top of Sinatra/Puma with the sole purpose of handling HTTPS requests on port 443. It forwards these requests to Sinatra, which operates over HTTPS and typically listens on port 3000. This setup ensures secure and efficient request processing in the My.SaaS implementation.
The image below showcases the various extensions that can be added to a My.SaaS implementation, enhancing its functionality.
The purpose of extensions is to add functionalities to My.SaaS in a modularized way, without needing to alter the core of the platform.
The image below displays the full list of pre-built My.SaaS extensions, showcasing a range of modular features that can be easily integrated into the platform.
These extensions provide ready-to-use functionalities, enhancing the capabilities of My.SaaS without requiring modifications to its core architecture.
The distributed database architecture consists on connecting my.saas to a serverless database instance of CockroachDB.
It is an effective approach if your SaaS platform requires interaction between all users, necessitating the bundling of all user data into a single database.
However, there are some drawbacks to using a serverless service:
-
Cost Scaling: Serverless databases can lead to rapidly increasing costs, especially if your SaaS performs heavy backend processing, as usage scales with demand.
-
Cost Tracking: It can be challenging to track and predict costs when working with serverless databases, making budget management more complex.
-
Despite these cons, the benefits of scalability and ease of use make serverless databases a strong option for SaaS platforms that need to manage a unified data structure across all users.
The master-slave-worker architecture, shown in image below, is designed for cost-effective resource deployment by assigning each user to a specific server, simplifying cost management.
-
Master: This server handles user signups, logins, invoice creation, and payment processing. It also allows users to create subaccounts, which are stored on the slave nodes.
-
Slaves: These servers host the subaccounts created by users. Typically, each subaccount is assigned to its own dedicated slave node, ensuring isolated and efficient resource usage.
-
Workers: Worker nodes are dedicated servers that handle offline processing tasks for subaccounts. Each worker node is typically assigned to one specific subaccount, managing its background processing tasks.
This architecture ensures straightforward cost control while providing scalable and efficient resource management for My.SaaS deployments.