A backend is rarely the star of a product. Nobody downloads it, nobody sees it, and when it works nobody thinks about it. Yet everything else talks to it: the phone app, the web shop, the merchant portal, the partner who integrated two years ago, the payment provider, the spreadsheet finance still keeps, the job that runs every night.
It sits in the middle of all of them, and it is usually the part that stays the longest. That position shaped every choice we made in the Backend Suite. This article is about the thinking behind those choices; for the apps themselves, see One backend, many perspectives.
Clients come and go; the backend stays
Look at how long each part of a system really lives.
A mobile app version, once released, stays on phones for years. Some users never update. You cannot recall it; at best you can ask it to stop working. A web front end is redesigned every few years, often rewritten in whatever framework is current. A partner integrates once, against the API they found that month, and then moves on to their own priorities. A tool on a warehouse PC may run the same build for a decade.
The backend is different. It is deployed in one place, by the team that owns it, in minutes. Its data outlives every client that ever read it. Its API is a contract that many parties rely on at the same time.
So the question "where should this rule live?" mostly answers itself. Take a refund may not exceed what was paid. Written into the iOS app, the Android app, the web shop and the partner's integration, it becomes four copies, at four versions, released on four schedules. The day the rule changes, one of them is always late, and the bug lives in the gap. Written once in the backend, it changes once, and every client follows at its next call, including the ones nobody has updated.
Clients should be thin where they can be, and the business should live in the backend. Not because clients matter less, but because they are the most expensive place to change anything.
Coherence is what keeps a long-lived system alive
A system that stays for years collects callers, data and people. The people change; the data does not go away. What keeps such a system workable is coherence: the same thing has the same name, the same shape and the same rules everywhere.
When coherence is missing, the bugs are rarely dramatic. They are translations. One service calls it cust_id and stores a number. Another calls it customerId and expects a string. A spreadsheet writes C-00012. A queue message carries the whole customer as an object. Each piece works on its own; the bug appears where two of them meet, months later, in production.
Domain-driven design has a name for the cure: a bounded context, a part of the business inside which every word has one meaning and one model. The Backend Suite makes that context explicit and shares it between every app:
- A project's domain is defined once, in strims PM: its scopes (
payments,checkout,settlement), its models, typed shapes such asCustomer,OrderorPaymentIntent, and the field types they share. - A customer id has one format, written once. The domain names it as a field type,
customerId: a string matching^cus_[a-z0-9]{4,24}$, andCustomer's key is acustomerId. A model that mentions a customer does not declare its own: its field is typed#Customer, and takes the key's type and format from there. Change the format once and every reference follows. - The same models are checked where data comes in. A q10 queue can refuse every message that does not match its model, and a Kombi operation every request that does not match its request model, before the first line of its script runs: a customer id written
4471instead ofcus_4471is refused, with the reason. popfile maps a spreadsheet's columns onto a model and marks every cell that breaks a rule, as it marks a price that is not a number; theCustomerIDcolumn of an orders sheet is the key of a customer, and each order is served with its customer inline. - The conventions around the models are the same in every app: keys written
<scope>.<name>, one shape of error ({"message": "..."}), times in epoch milliseconds in fields ending inAt, the same environments and the same promotion fromdevtoprd.
The point is not strictness for its own sake. A backend that keeps one vocabulary can still be read by the person who joins the team in three years. A message refused at the door, with a clear reason, is a bug found in a minute instead of a broken record found in a quarter.
Serving everyone as well as possible
Coherence does not mean that everyone gets the same answer. A backend in the middle serves very different callers, and serving them well means answering each one for what it is.
The usual shortcut is a backend per audience: one for the mobile app, one for the web, one for partners, one per country. It works until their rules drift apart, which they always do. We prefer one backend that knows who is asking. In the suite, every call carries four kinds of context, and each is worked out the same way in every app.
- Where. The zone, worked out from the country header, then the IP address, then the project's default zone. A setting can have one value in
eu-west-1and another everywhere else; a file can have a variant per zone; a pressi collection can keep each zone's rows apart, so a caller only sees the rows written from its own zone. - Which client. Every client is declared once in the project, with its platform (web, mobile, backend…) and the API key keybe made for it. A configuration file, a file variant, a queue or an API can be meant for some clients only. The mobile app and the merchant portal call the same address, and each gets what is meant for it.
- Which context. Scopes. A client works in the scopes it is given and reads the
<scope>.*keys, types and files of those scopes; for the rest it gets a clear403. A reporting tool can see the settlement part of the domain and nothing of checkout. - Who. Roles, at two levels. The team's own members are owners, admins, developers or viewers, and that decides what they may change in every app; a protected environment such as
prdcan ask for approvals from owners or admins, on their phones, before an edit or a promotion goes through. The project's end users sign in through keybe, or through an identity provider you already trust. Their token is signed, checked by every app, and carries their own claims, roles included, so your services read who the user is and what they may do without another call. A pressi collection can keep one row per end user, so each user only ever reaches their own.
None of this is code in a client. It is the project's configuration, visible in the dashboards and promoted like the rest. A new market, a new client or a partner who should see less is a change of configuration, not a new backend.
Close to everyone
A backend that serves everyone also has to be near them. A user in Sydney should not wait for a round trip to Frankfurt to read a label, and an outage in one data centre should not stop users on another continent.
The suite runs the same backend on a cluster of nodes in three regions, Europe, the Americas and Asia-Pacific, on several providers. The nodes answer DNS themselves: an app's address leads each caller to the healthy nodes of its own region, and to any healthy node when its region has none. A node that stops drops out of the answers within about a minute.
Being close is not only about speed. The caller's location is also part of the answer: it is the zone that picks a setting, a file or a row. And it has to stay coherent. A customer's data can be copied to nodes in several regions, which answer reads from their own copy, but only one node writes it. A write that reaches another node is passed on to that one, and the caller then reads its own write wherever it reads next. There is one place where an order changes, so two regions never disagree about it. When the data has to stay in one region, it is kept by nodes of that region only.
Asking little of everyone else
A system in the middle has one more duty: being easy to connect to. Every requirement it puts on its callers is paid by each of them, and paid again each time one of them changes. So the suite asks as little as it can.
- Plain HTTPS and JSON. One header for a client's key, one shape of error. Any language calls it with what it already has; there is nothing to install.
- Standard sign-in. keybe is an OpenID Connect provider per environment, with discovery, so any OIDC library signs users in. If your users already sign in elsewhere, with Google or your own provider, the suite accepts that provider's tokens as a trusted issuer: nobody has to move their users.
- Heavy systems stay where they are. Your database, your object storage, a partner's API: a kfig key names each one per environment, real in
prdand mocked indev, and your code asks for the same key everywhere. - Data stays in the tools people use. The sheets finance already keeps, CSV or Excel, become typed, read-only APIs in popfile. They upload a new version; the API follows.
- Workers come to the work. Your own workers fetch their scheduled jobs from srun and their messages from q10 over HTTPS, or receive them on a WebSocket they open themselves. Nothing has to reach into your network.
- One app, or all of them. Each app stands alone, with its own dashboard and API and the same sign-in. Starting with one asks nothing of the rest of your backend.
Generous to callers, strict with the data
That is the philosophy in one line. The backend in the middle should bend for its callers: answer each one for where it is, what it runs, what it works on and who it acts for, from the closest place and through the plainest protocols. And it should not bend on its data: one vocabulary, one definition of a customer, one place where a record changes, and rules kept where they will still be in five years.
The Backend Suite is in development. Its apps, their APIs and their documentation are written, and the cluster runs on our own nodes while we finish what has to be true before the first customers. If your backend sits between more parties than it used to, tell us about it.