Architecture practices.
Tenant scoping, provisioning, configuration over code, order states, money snapshots, verified events, integrations, offline branches, additive change, audit history and scale: the decisions under every platform we build, and how we make each one.
Platform Architecture Decisions
A platform that many organisations share for years rests on a dozen architectural decisions made early, and each one is expensive to change once customers depend on it.
Multi-tenancy
How one codebase serves many organisations without them ever seeing each other.
Tenant Resolution and Scoping
In a shared platform every customer’s data sits in the same tables, so the boundary between them is only as strong as the code on every request. One missing filter, cache key or file path and one organisation sees another’s orders, files or settings. The tenant is resolved once, from the host name or the signed-in session, and then decides templates, media, cache, settings and payment credentials; every row carries the tenant key, with more than 1,100 permission checks on top.
Special-tenant Routing
Some tenants should not share storage with the rest, such as demonstration organisations or customers with their own isolation needs. Mixed into production tables, they put test data in real reports and prospects one bug away from real customers. One shared schema serves everyone by default, designated tenants are routed to a separate database through configuration, and custom domains map one-to-one to stores.
Template-based Provisioning
How a new customer is set up decides how consistent the platform stays for years. Hand-built tenants drift apart and a retried sign-up can quietly create a duplicate, and every difference becomes a support call. A new tenant is created from a verified sign-up, receives its defaults by copying a template tenant, can attach its own domain, and provisioning is idempotent, so a retry never creates a second tenant.
Configuration-driven Behaviour
A platform has to keep up with the businesses it serves without a developer for every change. Platforms that need code for every field, stage or rule end up as a backlog of small changes or a fork per large customer. Differences live in configuration: settings, templates, feature switches and workflows whose stages name their next stages, group and owner, dashboards built from five functions in seven chart types, and even AI model choices.
An engineer reviews how tenants, configuration and customisations are handled today, and where the platform will stop scaling.
Transactions and State
Where platforms most often lose money, history or trust.
Order State Machine
An order is far more than paid or unpaid, and every screen, report and integration has to agree on where it stands. Tracked as loose flags, orders end up shipped but unpaid, or refunded twice. Orders move through eleven explicit states with only allowed transitions, and payment runs on its own track of pending, paid, failed and refunded.
Transaction Snapshots
An invoice from last year must still add up the way it did on the day it was raised. Platforms that look prices and rates up live rewrite history every time a rate changes, and reconciliations stop matching. The price, tax, discount and, in partner networks, the commission rates in force are copied onto each transaction when it happens.
Verified Payment Events
A browser returning from a payment page proves nothing: it can be faked, refreshed or lost. Platforms that mark orders paid or upgrade plans on that redirect either give goods away or miss real payments. An order becomes paid only when the gateway’s proof is checked; the browser return and the server notification are both handled, the first wins, and billing events are stored by ID so retries never apply twice.
Integrations and Change
How a platform connects to everything around it, and how it changes without breaking.
Provider Abstraction Layer
Payment gateways, couriers, marketplaces and AI models change their terms and APIs, and every business wants a different one. Wired straight into checkout or features, each new provider means rewriting core code, and a failing provider leaves the platform stuck. Each kind of provider sits behind one contract: ten payment gateways implement the same module contract, delivery charges come from courier zones across more than 19,000 pincodes, and each AI role reads its model from configuration.
Offline Branch Sync
Shops, branches and field teams cannot stop billing when the internet drops. Records created offline in several places collide when they meet again, and renumbering afterwards breaks invoices and audits. Each branch is initialised with its own number series, so records never collide and merge without renumbering, and branches synchronise with head office in order.
An engineer reviews how your integrations and data flows are wired, and what will break as you add more.
Additive Schema Changes
Platforms that serve many customers for years change constantly, and the risk lies in how changes reach everyone. A fork per customer multiplies every fix, and a migration per tenant turns every release into a project. Every tenant runs the same codebase on the same release, each change is tried on a staging copy before it is merged, and database changes are additive so no release needs a per-tenant migration.
Audit Trail
Disputes, audits and support questions all come down to who changed what, when, and what it was before. Platforms that store only the current value cannot answer, usually months after it mattered. Every change to a record, form value, stage or setting is written with the field, old and new value, action, person and time across twenty-seven kinds of record, and form values are versioned per stage.
Scaling Patterns
When to cache, when to index, when to replicate.
Read Path Scaling
The database is the hardest part of a platform to scale, so every request that reaches it unnecessarily is borrowed time. Platforms that meet growth with a bigger database server still stall on sale days, large catalogues and AI features. Most traffic is answered before the database by a CDN, per-store page and widget caches and, past a few hundred thousand products, a dedicated search index, while AI retrieval reads only from a replica kept current every five minutes.
Self-assessment Questions
Questions worth asking of any platform you run today.
- If a customer changes an ID in a request, can they see another customer’s data?
- Does adding a new customer need a developer or a deployment?
- Does any large customer run on its own fork of your code?
- If a tax or commission rate changes today, do last year’s invoices change too?
- Is an order marked paid when the browser comes back from the payment page?
- How much core code changes when you add a payment gateway or courier?
- Can your branches keep billing when the internet drops, without duplicate numbers?
- Can you say who changed a record, when, and what it was before?
An engineer reviews your tenancy, data model, integrations and release process against the questions above, and gives you a prioritised plan.