API Maker

The framework for AI era

Level 2 · GrowArchitecture 04 of 13

Environments with Git

DEV, QA, UAT and PROD, each with its own servers and data. Git pull is the deployment.

Developers build on API Maker Local Run or on DEV and push to Git. Each environment pulls its branch and is live in about 15 seconds, with its own secrets and data. PROD pulls once, and every PROD server follows.

See it live

Every request is drawn as it travels. Slow it down, pause, go step by step, or open the full canvas and zoom in.

api-maker/architectures/environmentsLive
  • Request
  • Response
  • Cache hit
  • Git push
  • Git pull and events
Environments
4DEV · QA · UAT · PROD
PROD version
v2.4
PROD servers
2/2up
PROD capacity
~5,518req/s

Build on your computer, push to Git. Developers build APIs in API Maker Local Run or on the DEV server, and push their work to Git for review.

How it works

The same steps as the diagram, in more detail.

  1. Build on your computer, push to Git.

    Each developer has an account of their own, with their own secrets, and builds APIs in API Maker Local Run on their computer or on the DEV server. The definitions of the APIs are committed and pushed to your Git repository from the admin panel, and reviewed in a pull request like any other code.

  2. Git pull is the deployment.

    On the DEV server, a git pull of the DEV branch applies the changes. API Maker writes them in a MongoDB transaction, so a pull is applied completely or not at all, and the new version is live in about 15 seconds. No build, no pipeline, no restart.

  3. Promote through QA and UAT.

    Promoting a change is a merge from one branch to the next, reviewed in a pull request, then a pull on the server of that environment. QA runs the inbuilt tests of API Maker, UAT lets the business try the change, each on a server and data of its own.

  4. One pull updates every PROD server.

    Production runs on several servers. The pull happens once, on any of them: the new definitions land in the shared MongoDB, and a cluster event through Redis makes every worker of every server reload them and recycle their sandboxes. Users do not see two versions for long.

  5. The same APIs, each environment its own data.

    Connection strings, keys and settings that differ between environments live in secrets, one set per environment and one per developer. The same instance "shop" reads the DEV database on DEV and the production database on PROD. Values that travel in Git are encrypted with passDBEncryptDecrypt, the same on every environment of the project.

  6. Roll back in seconds.

    Every item in API Maker has its Git history: compare two versions side by side and revert in one click, then commit and pull. Rolling back is the same 15-second pull as a deployment, on every server of the environment at once.

Why choose this architecture

Live in ~15 seconds

A git pull is the whole deployment: no build, no pipeline, no restart. It applies completely or not at all.

Reviewed like code

Every change goes through a pull request on GitHub, GitLab, Bitbucket or your own Git server before it moves on.

Each environment its own data

Secrets point the same APIs to the DEV, QA, UAT or production databases. Developers have secrets of their own.

Every PROD server at once

Pull on one PROD server and a cluster event through Redis reloads every worker of every other server.

Rollback in one click

Every item has its Git history. Revert, commit and pull: the previous version is back in seconds.

Develop anywhere

API Maker Local Run brings the whole platform to the computer of each developer, on macOS, Windows or Linux.

Server configuration

Plain VPS from any provider, or your own servers, with Ubuntu 22.04 LTS. Sizes are a starting point: measure and adjust.

DEV and QA servers

×1 each
CPU
2 vCPU
Memory
4 GB
Storage
40 GB SSD

Runs

  • API Maker with its MongoDB and Redis
  • Test data of the environment

Ports

  • 38246 and 38245: your team only
  • 4626: admin panel

DEV can also be API Maker Local Run on each computer.

UAT server

×1
CPU
2 – 4 vCPU
Memory
8 GB
Storage
80 GB SSD

Runs

  • API Maker with its MongoDB and Redis
  • A copy of production data, masked if needed

Ports

  • 38246 and 38245: testers only

PROD

2+ servers
CPU
4 – 8 vCPU each
Memory
8 – 16 GB each
Storage
40 GB SSD each

Runs

  • A load balancer in front
  • API Maker on every server, same .env
  • Shared MongoDB, Redis and your databases

Ports

  • 443: the load balancer
  • 38246 and 38245: from the load balancer only

See the Load-balanced API servers architecture for the details of PROD.

A change from a feature branch to productionworkflow
# 1. In the admin panel of DEV or Local Run: commit and pushfeature/checkout  → pull request → DEV     # then Pull on the DEV server# 2. Promote, one merge and one pull per environmentDEV               → pull request → QA      # then Pull on the QA serverQA                → pull request → UAT     # then Pull on the UAT serverUAT               → pull request → PROD    # then Pull on any PROD server
The same on every server of every environment of the project.env
am__passJWT="***"              # tokens valid on every serveram__passDBEncryptDecrypt="***" # decrypts values stored in Git and MongoDBam__passCommunication="***"    # admin panel ↔ backend

Keep these three values identical everywhere, or encrypted values in Git cannot be read.

Good to know

  • More servers to run: at least one per environment. Small DEV and QA servers keep the cost low.
  • UAT is only as useful as its data: refresh it from production, masked where needed.
  • PROD pulls should be deliberate: protect the PROD branch and allow pulls to a few people only.
When you outgrow itPROD needs more capacity or more servers: see how they share the traffic. Load-balanced API servers

Questions

Do I need a CI/CD pipeline?

No. A git pull on the server of an environment is the deployment. API Maker applies the pulled changes in a MongoDB transaction, so they are applied completely or not at all, and the new version is live in about 15 seconds. A deployment hook URL can also trigger the pull, for example from a webhook of your Git host.

How does each environment reach its own database?

Connection strings live in secrets. Each environment has its own secrets, and each developer too, so the same instance and the same APIs read the DEV database on DEV and the production database on PROD.

Which Git hosts are supported?

Any Git repository: GitHub, GitLab, Bitbucket or your own Git server. The admin panel pulls, pushes, compares and reverts through it, and one repository can serve several admin users.