No lock-in
Plain VPS and open source software on every site: any provider that rents a Linux server can host one.
The framework for AI era
Level 4 · ResilientArchitecture 11 of 13
The same API Maker on VPS of several providers, joined by encrypted tunnels. No provider can take you down.
Run API Maker on plain VPS of two or three providers at once. DNS spreads the users over the sites, WireGuard joins their private networks, and the databases keep a copy on every site. Lose a provider, or leave one, without downtime.
Every request is drawn as it travels. Slow it down, pause, go step by step, or open the full canvas and zoom in.
One API, served by two providers. The same API Maker runs on VPS of Provider A and Provider B. DNS answers with both load balancers.
The same steps as the diagram, in more detail.
API Maker runs on plain VPS, so nothing ties it to one provider. Here sites 1 and 2 each run a load balancer and two API servers with the same .env, and DNS answers with the address of both load balancers. Every server serves every API, whichever provider it runs on.
Each site has a WireGuard gateway, and the gateways join the private networks of the providers into one. MongoDB replication, Redis traffic and writes to a primary on another site travel only inside these encrypted tunnels: no database port is ever open to the internet.
The replica set has a member on each of the three sites, and the Redis Cluster a master on each, with the replica of another site's master. Site 3 runs no API server: it only holds the vote that keeps a majority when a whole provider is lost. Servers read from the nearest member and write to the primary.
When site 1 is lost, its address is removed from DNS by the health checks of your DNS provider, or by a script. mongo-2 and mongo-3 are still a majority and elect mongo-2, and the replica of redis-1 kept on site 2 is promoted. Users on site 2 carry on; the others move over when their DNS answer expires.
Create VPS at the new provider, install API Maker with the same .env, add the new MongoDB member and Redis node to their clusters, and let them copy the data from the other sites. Then add the new load balancer to DNS. No export, no import, no downtime: leaving a provider works the same way.
Plain VPS and open source software on every site: any provider that rents a Linux server can host one.
A whole provider can go dark: the other sites keep the majority, elect a primary and carry the traffic.
Sites talk only through WireGuard tunnels. No database port is ever open to the internet.
Add a site at a new provider, let it copy the data, then retire the old one. No export, no import.
A site can be your own data center: keep databases on premises and serve them through the same APIs.
Cheap compute from one, fast disks from another. Mix them by what they do best and what they cost.
Plain VPS from any provider, or your own servers, with Ubuntu 22.04 LTS. Sizes are a starting point: measure and adjust.
Runs
Ports
Runs
Ports
Runs
Ports
Three sites, not two: with two, losing either one also loses the majority.
Runs
Ports
am__serverName="site1-api-1" # site and server, to find it in the dashboards# Private addresses of the three sites, reached through the tunnelsam__mongo_db_connection="mongodb://api_maker:***@10.10.1.20:27017,10.10.2.20:27017,10.10.3.20:27017/api_maker_db?authSource=admin&replicaSet=rs0"am__redisInternal='{"nodes": [{host: "10.10.1.21", port: 6379, pass: "***"}, {host: "10.10.2.21", port: 6379, pass: "***"}, {host: "10.10.3.21", port: 6379, pass: "***"}]}'am__redisExternal='{"nodes": [{host: "10.10.1.21", port: 6379, pass: "***"}, {host: "10.10.2.21", port: 6379, pass: "***"}, {host: "10.10.3.21", port: 6379, pass: "***"}]}'[Interface]Address = 10.10.1.1/24ListenPort = 51820PrivateKey = ***[Peer] # gateway of site 2, the way to site 3 tooPublicKey = ***Endpoint = 192.0.2.30:51820AllowedIPs = 10.10.2.0/24, 10.10.3.0/24PersistentKeepalive = 25The machines of each site route 10.10.0.0/16 through their gateway.
mongodb://app:***@10.10.1.20:27017,10.10.2.20:27017,10.10.3.20:27017/shop?replicaSet=rs0&readPreference=nearestNearest reads can be a moment behind the primary. Leave readPreference out where a read must see the latest write.
Yes. A site is any set of Linux machines: VPS of a provider or servers of your own. Join it with the same WireGuard tunnels and it works like any other site.
MongoDB and Redis work best with a few milliseconds between sites, such as neighbouring cities or countries. Farther apart, every write waits longer: for users on several continents, see the Geo-routing architecture.
It removes a lost site from the answers by itself. Without it, a script on a surviving site can update the record through the API of your DNS provider, or you switch it by hand.