HomeBlogHow to Build an ERP System...

Engineering Guide · 9 min read · October 15, 2026

How to Build an ERP System for a Growing Business

Growing companies outgrow off-the-shelf ERPs when multi-warehouse inventory, bespoke approval chains, and margin rules collide with rigid SaaS schemas. This architectural blueprint shows how to build a custom ERP module by module using an append-only ledger, transactional outbox queues, and clear security boundaries without halting live operations.

Author
Smit Desai
Published
October 15, 2026
Read time
9 min read
Topic
Business & Strategy
Services
Custom Web · Mobile Apps · All Services

Every multi-department company hits the same operational wall sooner or later. Sales closes orders in one tool, warehouse supervisors track stock adjustments in shared spreadsheets, finance reconciles invoices manually at month-end, and leadership waits three days for an accurate margin report.

Buying an enterprise ERP suite seems like the obvious fix until implementation begins. Six months later, you are paying hefty per-seat licensing while your operations team still exports CSVs every afternoon because the vendor cannot model your split shipments, custom BOM revisions, or regional approval thresholds cleanly.

Building a custom ERP does not mean rewriting SAP over two years. In practice, the systems that survive production start small, anchor around an immutable financial and inventory core, and replace spreadsheets one bounded domain at a time.


Build vs. Buy vs. Hybrid Operational Core

Before writing migrations, decide which parts of your enterprise genuinely need custom software and which parts are commodity compliance. Payroll and statutory tax engines rarely differentiate a business; order orchestration, warehouse allocation, and job costing often do.

Dimension Off-the-Shelf SaaS ERP Open-Source ERP Customization Custom Modular ERP
Workflow Fit Forces business rules into vendor templates Flexible, but upgrades break custom hooks Built around exact approval and pricing logic
Per-Seat Economics Escalates sharply as warehouse & temp staff grow Server + engineering cost only Predictable infra + targeted engineering
Upgrade & Patch Risk Vendor controls cadence; API limits apply High merge conflicts on core upgrades Full control over dependencies and schema
Time to First Value Fast for standard retail; slow for custom ops 3–6 months of framework wiring 4–8 weeks for the first isolated module
Data Ownership Locked behind export limits and rate caps Full database access Full ownership of schemas, logs, and backups

A hybrid architecture wins most often: keep a standard accounting package as your statutory book of record while building a custom operational ERP for purchasing, inventory, production, and fulfillment.


Designing the Schema Around an Append-Only Ledger

The single most expensive mistake in custom ERP engineering is modeling stock or balances as mutable columns (products.stock_qty = stock_qty - 5). Under concurrent warehouse scans, partial returns, and retried webhook jobs, mutable counters lose history and silently drift.

Immutable Inventory and Financial Movements

Treat physical stock and internal cost allocations like a double-entry accounting journal. Never overwrite a balance; append a signed movement row tied to a source document and an idempotency_key:

CREATE TABLE stock_movements (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    tenant_id BIGINT UNSIGNED NOT NULL,
    warehouse_id BIGINT UNSIGNED NOT NULL,
    sku_id BIGINT UNSIGNED NOT NULL,
    delta_qty DECIMAL(14, 4) NOT NULL,
    unit_cost_cents BIGINT NOT NULL,
    reference_type VARCHAR(64) NOT NULL, -- 'purchase_receipt', 'sales_shipment', 'cycle_count'
    reference_id BIGINT UNSIGNED NOT NULL,
    idempotency_key VARCHAR(128) NOT NULL,
    created_by BIGINT UNSIGNED NOT NULL,
    created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
    UNIQUE KEY uniq_tenant_idempotency (tenant_id, idempotency_key),
    INDEX idx_lookup_balance (tenant_id, warehouse_id, sku_id)
);

Materialized Snapshots Without Losing Auditability

Reading SUM(delta_qty) across ten million rows on every product page will eventually slow down checkout and picking screens. Maintain a stock_balances projection table updated inside the same database transaction as the stock_movements insert, using SELECT ... FOR UPDATE on the balance row when reserving outbound inventory so two pickers cannot allocate the last unit simultaneously.

If a bug ever corrupts a projected balance, you can verify or rebuild stock_balances directly from stock_movements.


Handling Latency, Queues, and Integration Failure Modes

ERPs sit at the center of flaky external dependencies: accounting APIs, shipping carriers, barcode printers, and supplier EDI portals. If an HTTP request from a warehouse scanner blocks while waiting on an external accounting API, a 15-second upstream timeout locks database connections and stalls your floor staff.

The Transactional Outbox Pattern

Never dispatch a queue job before your database transaction commits, and never rely on a naive "fire-and-forget" HTTP call after commit—if Redis blips or the worker dies mid-request, your ERP and accounting software diverge quietly.

Instead, write an outbox_events record inside the business transaction, then let a dedicated worker relay and mark events complete:

DB::transaction(function () use ($receipt, $userId): void {
    $movement = StockMovement::create([
        'tenant_id' => $receipt->tenant_id,
        'warehouse_id' => $receipt->warehouse_id,
        'sku_id' => $receipt->sku_id,
        'delta_qty' => $receipt->received_qty,
        'unit_cost_cents' => $receipt->unit_cost_cents,
        'reference_type' => 'purchase_receipt',
        'reference_id' => $receipt->id,
        'idempotency_key' => "po-receipt:{$receipt->id}:{$receipt->sku_id}",
        'created_by' => $userId,
    ]);

    OutboxEvent::create([
        'aggregate_type' => 'StockMovement',
        'aggregate_id' => $movement->id,
        'event_name' => 'inventory.received',
        'payload' => $movement->only(['id', 'sku_id', 'delta_qty', 'unit_cost_cents']),
        'status' => 'pending',
    ]);
});

Dead-Letter Recovery and Rate-Limit Backoff

External APIs impose strict burst limits. Configure exponential backoff with jitter (30s, 2m, 10m, 1h) and push permanent validation errors (such as a missing tax code in the accounting system) to an operator dead-letter queue with clear error messages so finance can fix the mapping and click "Replay" without engineering intervention.


Security Boundaries and Approval Governance

An internal ERP concentrates financial risk: someone who can both create a vendor and approve a vendor payout represents an immediate audit finding.

Enforce Authorization Inside Domain Services

Do not rely solely on hiding buttons in the frontend UI. Every state transition—approving a purchase order above $5,000, issuing a credit memo, or adjusting damaged stock—must pass through a server-side policy check verifying:

  • Role and Separation of Duties: The approved_by user ID cannot match created_by on high-value requisitions.
  • Tenant and Warehouse Scoping: Regional managers only query and mutate rows belonging to their assigned warehouse_ids.
  • Immutable Audit Context: Record actor_id, ip_address, before_state, and after_state on every sensitive mutation so annual audits take minutes instead of days.

For deeper architectural patterns on isolating bounded contexts as systems scale, Martin Fowler's architecture collection remains one of the clearest technical references available.


Phased Rollout Without Halting Daily Operations

Big-bang ERP cutovers fail because teams try to migrate purchasing, manufacturing, CRM, and accounting over a single holiday weekend. When one edge case breaks on Monday morning, operations freeze.

Sequence Modules by Pain and Coupling

  1. Phase 1 — Procurement & Receiving: Replace emailed PDFs and receiving spreadsheets with vendor POs, three-way matching, and barcode-friendly goods receipt.
  2. Phase 2 — Inventory & Order Fulfillment: Turn on reservation rules, pick/pack workflows, and carrier label generation while syncing finalized invoices nightly to your existing accounting tool.
  3. Phase 3 — Production / Costing / Custom Reporting: Layer work-order BOM consumption, landed-cost allocation, and real-time margin dashboards onto verified movement data.

If you are transitioning off an aging internal codebase rather than starting completely greenfield, review our guide on rebuild vs refactor legacy software before choosing your cutover boundary.


Scoping Your Custom ERP With SmitDev

I have shipped 170+ production case studies since 2017 across the USA, UK, Europe, UAE, Australia, and Singapore—ranging from bespoke operational platforms to managing 300+ WordPress sites at server level for a Finnish partner where uptime and predictable deploys are non-negotiable.

At SmitDev, we do not pitch vague six-figure discovery phases. Through growth consulting, we map your highest-friction operational workflow first, lock down your ledger schema and integration contracts, and ship working production modules incrementally—either at $1,999/month for dedicated delivery or $55/day for 8–9 hours of focused engineering work via our dedicated developer model.

Ready to replace brittle spreadsheets with an ERP your team actually trusts? Share your current workflow bottlenecks on our contact page and we will outline a realistic phase-one architecture and delivery schedule.

Written by Smit Desai · Principal Full-Stack & FDSE

8+ years shipping production systems · 171 case studies · 300+ WordPress servers managed for Finland partners.

Next Steps and Recommended Resources

Next Steps · Recommended Resources

Pillar 1 · Custom Web & SaaS

Custom Web Application Development

Production Laravel, Next.js, API, and multi-tenant SaaS systems engineered end to end at $55/day (8–9 hrs) or $1,999/mo.

Comparison · Buyer Guide

SmitDev vs Software Agencies

See side-by-side economics, senior code ownership, and onboarding speed vs traditional dev shops and marketplaces.

01 — Frequently asked questions

business & strategy

Should a growing business build an ERP from scratch or customize an existing platform?

If your workflows match standard accounting and basic stock tracking, off-the-shelf or open-source software is cheaper. Build a custom operational ERP when your core competitive advantage—such as multi-stage manufacturing, custom landed-cost pricing, or specialized fulfillment—forces staff back into spreadsheets despite paying per-seat SaaS fees.

Which ERP module should we build first?

Start with the highest-friction operational bottleneck that still preserves clean boundaries—most often Purchase Orders paired with an immutable Inventory Movement ledger. Keep payroll, statutory tax filing, and general ledger reconciliation connected via scheduled exports or APIs until operational modules stabilize.

Why do custom ERP inventory counts drift out of sync?

Inventory drifts when engineers store a single mutable quantity column and update it directly across concurrent web requests and background jobs. Replacing direct updates with an append-only movement ledger and idempotency keys makes every stock change auditable and replay-safe.

How long does it take to ship the first usable custom ERP module?

A tightly scoped first domain—such as supplier purchasing, warehouse receiving, and role-based approvals—typically ships to production in 4 to 8 weeks when built by a dedicated senior engineer without agency handoff layers.

03 — Have an engineering need?

hire the right expertise

Let's talk tech.

Deciding between an embedded forward deployed engineer or a senior full stack developer? Share your technical context and timeline.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.