Key takeaways
- An ERP has five layers: data, domain modules, workflow, integration and the interface people use.
- For most custom ERPs built for one company, a modular monolith beats microservices, because one posting touches several modules.
- Give every table exactly one module allowed to write to it, and let the others read through that module's interface.
- Post each document in one database transaction, lock it afterwards, and correct mistakes by reversal, never by edit.
- Put the legal entity on every document and ledger row from day one, even with one company.
- Split a part into its own service only when its load, its team or its release clock differs from the rest.

It is written for owners weighing a custom build and for the developers they hire. If you need the module list first, read our guide to what each ERP module does. ERP architecture and data design is a phase of its own in our custom ERP development process. It takes two to four weeks and ends with an approved data model before any module is built, because these choices are the hardest to undo.
ERP system architecture in five layers
Every ERP, packaged or custom, has the same five layers. What differs is where each one draws its lines. The diagram below stacks them in the order a request travels, from the screen down to the database, with integrations along the side.

| Layer | What it holds | The rule that keeps it cheap to change |
|---|---|---|
| Interface | Screens, lists, dashboards, barcode flows | No business rule exists only in a screen |
| Workflow | Document states, approvals, alerts | Rules sit in one place |
| Domain modules | Inventory, purchase, sales, production, finance, HR | Each table has one module that may write to it |
| Integration | Accounting sync, e-invoicing, banks, online shop | One component owns every external call |
| Data | Masters, documents and ledgers | The database enforces what must always be true |
The data layer: masters, documents and ledgers
Three kinds of record live here. Masters change slowly: items, customers, suppliers, locations, accounts. Documents record events, such as a goods receipt or an invoice. Ledgers record the effect of each event as rows that are only ever added. Keep the three apart and most reports become plain queries. Mix them, however, and every report turns into a reconciliation.
The database itself should guard what must always hold. A stock movement needs an item and a location, and a journal must balance. The stack on our ERP page pairs PostgreSQL or MySQL with strict constraints for stock and money. A rule kept only in application code is one bug away from being broken.
Domain modules: each record has one owner
A module is a slice of the business with its own tables, documents and rules. Inventory owns stock movements, purchase owns purchase orders, and finance owns the journals. The test of a boundary is simple: for any table, you can name the one module allowed to write to it.
Other modules still read that data, but they go through the owner. Sales never inserts rows into the stock ledger. Instead, it asks inventory to reserve or issue stock, and inventory decides. In code this is a published interface per module, a short list of commands and queries. Everything behind it stays private, so you can rewrite the costing logic without touching sales.
The workflow layer: states and approvals
Workflow decides what may happen next. A purchase order moves from draft to approved to received, and above a set value it needs a second approver. Rules like these change more often than anything else, so they belong in one place rather than spread across screens. Workflow says who may act and when, while the module decides what the action means. Even so, resist turning every rule into a setting, because each setting adds a screen that someone must build, test and document.
The integration layer of an ERP system
An ERP seldom replaces the accounting package. Finance and the auditors already rely on it, so the new system connects to it instead. Add e-invoicing, banks, payment gateways and an online shop, and the edge of the system gets crowded. So let one component own every external call. It holds the credentials, queues requests, retries failures and records what went out and what came back.
How hard that is depends on the other side. Products such as Xero, Zoho Books and QuickBooks Online expose REST APIs and webhooks, so a two-way sync is routine. TallyPrime, by contrast, has no webhooks, so the ERP polls it on a schedule and checks that both sides agree. Requests go over HTTP as XML or, from release 7.0, JSON, according to Tally’s JSON integration guide (updated 20 May 2026). It is the same craft as any backend development work: written contracts, one auth pattern and one log of every exchange.
The interface layer: screens for each role
People judge the system by its interface, yet this layer should hold the least logic. Office staff want keyboard-first entry, stores want barcode scanning on a phone, and owners want a dashboard. When all three call the same module interfaces, a rule fixed once is fixed everywhere. A mobile app added in year three then needs no second copy of the logic.
Modular monolith vs microservices in ERP architecture
A modular monolith is one deployable application with one database, divided inside into modules that keep to their own tables. Microservices split those modules into separate applications, each with its own database, talking over the network. Our general post on monoliths and microservices covers the trade-off for any kind of system. For ERP system architecture, one difference outweighs the rest: a single business event usually touches several modules at once.
Take a delivery note. Posting it takes stock out of a location, moves cost into the accounts and closes part of a sales order. In a monolith those writes commit together or not at all. Across services each one commits on its own, so you need extra machinery to undo the first write when the third fails.
| Question | Modular monolith | Microservices |
|---|---|---|
| Posting one document | One database transaction | Several commits, with compensating steps |
| Reports across modules | A query on one database | Data copied to a reporting store first |
| Moving a boundary | A refactor in one codebase | New APIs and a data migration |
| Team it suits | One team, or a few | Several teams releasing separately |
| Hosting | One app and one database | A platform that runs many services |
Martin Fowler put the rule bluntly in Microservice Premium, dated 13 May 2015: “don’t even consider microservices unless you have a system that’s too complex to manage as a monolith.” Most custom ERPs built for one company are not that complex. When we built Bloomford, a hiring portal rather than an ERP, we judged a modular monolith the right answer. It gave the client a single deployable to host wherever it chose, with clean seams for later integrations.
Where module boundaries go
Draw boundaries around documents and the decisions they carry, not around screens or departments. List every document the business produces, then name the module that creates it and the ledger it posts to. No document should need two modules to create it. Wherever one does, the boundary sits in the wrong place.
Shared masters need an owner too. Almost every module uses items and parties, so give them a small master-data module and let the others read from it. Otherwise each module grows its own item list, and the copies drift apart. Expect to move a few lines once the system is in use, which is cheap inside one codebase. In Monolith First, dated 3 June 2015, Fowler wrote: “Any refactoring of functionality between services is much harder than it is in a monolith.”
When splitting an ERP into services pays
Pulling a part out into its own service is worth it when that part has needs the rest does not share:
- Different load. A stock lookup that an online shop calls far more often than the back office does.
- A separate team. Another team owns the part and releases it on its own schedule.
- An outside clock. An e-invoicing connector that must change when a tax authority changes its format.
Fowler’s list in Microservice Premium is close: large teams, multi-tenancy, many user interaction models, functions that evolve independently and scaling, with sheer size the biggest factor. In practice the first split comes at the edge, such as an integration hub, while the posting core stays in one database. Our ERP page names Laravel for modular backends and NestJS where events and integrations dominate.
The posting model that keeps ERP modules consistent
The posting model is the part of ERP system architecture that keeps every module honest. A document starts as a draft that anyone with the right role can edit. Posting is a single step. It checks the rules, gives the document its final number and writes its effects to the ledgers. After that the document is locked, and its effects are facts.
The figure below follows one delivery note through that step. All of its writes sit in one database transaction, which the PostgreSQL documentation on transactions (read 25 November 2026) says “bundles multiple steps into a single, all-or-nothing operation”. So if the journal fails to balance, the stock rows go with it.

BEGIN;
-- post delivery note DN-1042 (draft to posted)
UPDATE delivery_note SET status = 'posted'
WHERE id = 1042 AND status = 'draft';
INSERT INTO stock_ledger (item_id, location_id, qty, doc)
VALUES (77, 3, -12, 'DN-1042');
INSERT INTO journal_line (account, debit, credit, doc) VALUES
('Cost of goods sold', 300.00, 0, 'DN-1042'),
('Inventory', 0, 300.00, 'DN-1042');
COMMIT;The values are only an example. The application aborts if the status update touches no row, so a document cannot post twice. Ledger rows are inserts, never updates, and the journal balances before the commit.
Correct by reversal, never by edit
Nobody edits a posted document. If a delivery note was wrong, you post a reversal that cancels its rows, then a corrected document, and the history keeps both. Auditors expect exactly this. It also means stock on any date comes from adding up the stock ledger rows to that date, so any figure traces back to its documents. Balances can sit in a cache for speed, but the cache is rebuilt from the ledger and never typed in.
Tenancy and hosting in ERP system architecture
Two choices sit outside the modules but shape all of them: who shares the installation, and where it runs.
Single-tenant, multi-entity or multi-tenant
| Model | What it means | Who it suits |
|---|---|---|
| Single-tenant | One company, its own application and database | A business commissioning its own ERP |
| Multi-entity | Several legal entities in one installation, each with its own books | A group with subsidiaries or free-zone companies |
| Multi-tenant | Many unrelated customers in one installation, walled off | A company selling an ERP as a product |
A business building its own ERP nearly always wants single-tenant with multi-entity support. Put the legal entity on every document and ledger row from day one, even with one company today, because adding it later touches every table and report. Multi-tenancy, on the other hand, is a product decision. It earns its cost only for a vendor that will sell the system to others.
Cloud or on-premise ERP system
For a modular monolith this is a hosting question more than an architecture one. One application and one database run on a cloud account or on your own server. Cloud suits most businesses, because automated backups and disaster recovery are simpler there. On-premise still fits a site with a weak connection or a policy that keeps data in-house.
Either way, the code and the hosting accounts should be yours. Our ERP terms hand you the full source, with documentation, in a repository you control, so moving hosting later is your call alone. The awkward case is a cloud ERP that must reach an accounting package on an office PC. That usually needs a small connector inside the office network, so plan it early.
ERP architecture mistakes that are expensive to change
These ERP system architecture mistakes look harmless in the first month. Each one, however, costs more with every module built on top of it:
- Editable posted documents. Fix an invoice in place and the ledger no longer explains the balance.
- Modules writing each other’s tables. A shortcut that lets sales change stock directly works once. After a year of them, no module can change without breaking another.
- Rules that live in screens. A discount limit checked only on the order form is skipped by the import and the API.
- Permissions added at the end. Roles limited to certain locations reach into every query. Bolted on late, they leak.
- One-off integration scripts. Each has its own credentials and retries, and each fails quietly at night.
- Microservices before the boundaries are known. Every wrong guess becomes an API to version and data to move.
- Heavy reports on live tables. Month-end reports compete with the warehouse for the same database. A read replica solves it.
Who should not commission a custom ERP architecture
All of this assumes that building custom makes sense, and often it does not. Our ERP page is plain about when to buy a package instead. That applies when your processes are ordinary and you must go live within eight weeks. It also applies with under fifteen users and no odd workflows. The same goes when nobody on your side will own the system after launch. In those cases the ERP system architecture a package ships with is good enough, and a design of your own spends money a package would have saved.
A software company planning to sell an ERP to many customers should also pause, since it needs a SaaS product design with tenancy and billing at its centre. Likewise, a team that wants microservices because the system might grow should reread the delivery note example. The cost arrives on day one, while the benefit may never come.
How to review an ERP system design before the build
Whoever builds your ERP, ask to see the ERP system architecture before the first module is coded. Six questions cover the essentials:
- For each main table, which module may write to it?
- What happens, row by row, when a goods receipt is posted, and is it one transaction?
- How does a user correct a posted document?
- Where do approval rules live, and who can change them?
- Which component makes each external call, and where are failures logged?
- Is the legal entity on every document and ledger row?
Clear answers usually mean the system will still be easy to change in its fifth year. That matters, because an ERP tends to outlive the team that built it. As our ERP page puts it, these systems stay in service for ten years or longer, which is why the stack should be proven technology a future team can maintain.




ERP system architecture is how an ERP is divided into five layers: the data, the domain modules, the workflow rules, the integrations and the interface. For most custom builds the right shape is a modular monolith, meaning one application and one database with hard walls between the modules. A posting model then keeps stock and accounts in step. This guide takes each layer in turn, shows where module boundaries go, and says when splitting into services is worth the cost.