As a developer, I am super impressed by the number of great open-source projects popping around. I think of Supabase (an open-source alternative to Firebase), Strapi (open-source headless CMS), Meilisearch (open-source search engine), Posthog (open-source product analytics tool), and so many others. For me, these are the tools that most developers will use in the future.
One common method to make those products financially sustainable is to provide a managed version. Meaning, you can enjoy using their product without the hassle of managing the product updates, the backups, the security, and the scaling. It is exactly what Hasura did with its cloud version - and it is pretty convenient to use their product in production. However, building a cloud version takes months (sometimes years).
What takes time? Hiring platform engineers, building the infrastructure, testing it, monitoring it... All of that takes a considerable amount of time and effort. Luckily, at Qovery, we provide the infrastructure stack that every open-source project needs to build 90% of their cloud-managed version. The remaining 10% are the UI and the business model logic. In this 6-part article series, I will attempt to explain how to build a cloud-managed version of AppWrite. Let’s go!
7-Part Article Series:
Since I launched Qovery in 2019, I have talked to dozens of founders from great open-source software companies. Most of them were looking to build their cloud-managed service at some point. Some of them even asked me for feedback on building one and asked me to use Qovery as a white-label technology when they discovered it was a full-time job. Qovery is a product simplifying app deployment and infrastructure management on AWS. Time flies, and as Qovery evolves, it is now possible for any open-source project to use Qovery as a white-label technology to provide a cloud version of an open-source project. No hidden cost. Just pick the plan that fits you best and build your cloud version in days instead of months. My team will be proud to help you in your success.
AppWrite is quite representative of a “modern web open-source project”. In this guide, AppWrite is used as a demo project to demonstrate the concept of building a cloud-managed version for an open-source web project. AppWrite is written in PHP for the backend and JS for the frontend. It provides a user-friendly web interface connected to a web API, and it stores the data in MariaDB and Redis databases. The idea is: if it works for AppWrite, then it is good to work for any other web open-source project with a similar technical stack. Feel free to contact me if you have any concerns.
AppWrite is a Backend as a Service open-source software. It is similar to Supabase and Firebase to create a backend in a few minutes.
Our goal is to provide a fully managed cloud version of AppWrite. Meaning we need to deliver to our customers a way to order their AppWrite instance and use it, while the maintenance is handled by us. It is the most common managed version out there - think MongoDB Atlas. To achieve this, we will use the following technologies:
This bunch of technologies combined enable us to build a cloud version for AppWrite. Let’s take a deeper look at how all of them are interconnected.
This schema represents the different layers composing the cloud version of AppWrite. From top to bottom, we will give the details of each layer.
Here is what happens when the customer requests a cloud AppWrite instance:
cloud.appwrite.com
(fake domain to represent “AppWrite cloud frontend”).
Let’s say our customer now wants to delete his cloud AppWrite instance; this is what happens:
cloud.appwrite.com
(fake domain to represent “AppWrite cloud frontend”).
We can add other steps like payment (part 5), notifications (part 6), and everything you want - they are not required to make our cloud version functional. Let’s now take a deeper look at the infrastructure.
The AppWrite cloud frontend and backend are the two components that we have to build from scratch. It includes our business logic and customer management system. We will use Hasura for the backend and GatsbyJS for the frontend. We will connect the frontend to the backend via a GraphQL API. The advantage of using Hasura instead of coding our web backend is that we have access to many features (Auth0, Stripe support...) right away. Saving days of work.
The goal here is to provide to the customers a web interface to:
Qovery is the simplest way to deploy apps and manage your infrastructure on AWS. We will use Qovery as an Infrastructure as Code (IaC) API.
Qovery provides a production-ready infrastructure on our AWS account in 30 minutes that we will use to host our customers’ instances. The Qovery API provides a high-level abstraction to create for each customer an isolated Environment including:
Each Environment is isolated and will be accessible for only one customer. And as admin, Qovery provides a web interface to manage all our customers’ instances and troubleshoot any of their issues.
Curious to know more about how Qovery works? Take a look at this page.
Qovery supports AWS, Digital Ocean, and Scaleway. In this guide, we will focus on AWS to make it simpler. But keep in mind that you can use another supported cloud provider. You can even imagine a feature where your customers can choose the cloud provider of their choice. This is exactly what “MongoDB Atlas” and “Hasura Cloud” do.
Side note: Qovery will support Google Cloud Platform and Microsoft Azure for S1 2022.
Our customers expect us to provide a reliable service and manage the database backups by using a cloud version. For AppWrite, MariaDB is the persistent database and needs to be backed up. Four options with pros and cons do exist:
Pros:
Cons:
Pros:
Cons:
Pros:
Cons:
Pros:
Cons:
We will pick the third option (single-tenant with managed MariaDB database) to create a state-of-the-art cloud version, but you are free to choose the one you want for your customer. Do not forget your customer expects you to take care of their business.
Side note: AppWrite uses Redis as a caching system. Then, we will use a Redis container instance which is the cheapest.
Here is the list of contributors to this first part:
Thank you to our contributors for their review and suggestions.
Thank you all for taking the time to read until the end. We will build our AppWrite cloud backend and integrate it into the Qovery API in the next part.