Enterprise SaaS ArchitectureLaravel & MySQLDouble-Entry GL

Custom Enterprise Resource Planning (ERP) System

Designed and built a custom ERP to replace a legacy platform for a trading and distribution enterprise, replacing frequent stalls with a stable, real-time system across all modules.

01

Overview & Context

The Legacy Challenge

The enterprise was bottlenecked by a slow, monolithic legacy platform prone to database locks, calculation drift during concurrent inventory updates, and system stalls during peak trading hours.

The Engineering Goal

Deliver a modular ERP architecture with atomic transactions, real-time general ledger posting, and clear financial auditability across multi-warehouse operations.

02

Engineering Planning in Jira

As the sole developer on this project, I broke the requirements into epics and user stories in Jira to plan and track my own execution:

Jira Sprint Backlog & Epics
Click to expand

Figure 2.1: Sprint breakdown covering Procurement, Accounting Engine, Multi-Warehouse, and Treasury epics.

Jira Ticket Detail
Click to expand

Figure 2.2: User story for automated polymorphic journal entries on document release.

03

Core Functional Architecture & Key Achievements

Accounting Engine

Double-Entry General Ledger (GL)

Built a double-entry accounting engine from scratch. Journal entries, general ledgers, and trial balances update automatically from Sales, Purchases, and Safe Deposits.

Inventory Control

Multi-Warehouse Stock Ledger

An inventory engine with real-time balances and serialized stock movement logs ("manually adjusted" vs "system reconciled") for single-step transfers.

Procurement Workflow

Procurement-to-Pay (P2P)

A 3-way matching workflow (Purchase Order → Goods Receipt → AP Invoice), with automated supplier ledger postings and weighted average inventory costing.

Sales Pipeline

Order-to-Cash (O2C) & POS Engine

Sales pipelines (Quotations, Delivery Notes, AR, Cash Invoices) with automated ledger reconciliation and credit note handling for reversals.

Treasury Management

Multi-Safe Treasury & Bank Settlement

Tracks 4 cash flows (Cash Safes, Bank Transfers, Cheque Clearings, Credit Cards) with real-time safe-to-bank deposit tracking.

Payment Processing

Merchant Fee Processing

A settlement module that calculates gateway fees, routes net balances to company accounts, and logs processor fees to expense ledgers.

04

Database Schema & Relational Design

Normalized MySQL relational architecture, tightly coupling commercial documents to ledger lines and inventory ledgers to prevent data discrepancies.

ERD Database Schema
Click to expand

Figure 4.1: Schema coupling purchase_invoices, journal_entries, journal_entry_lines, finance_accounts, and stock_movements.

05

Transaction Safety & Execution Flow

Ensuring atomic operations across inventory adjustments, tax calculations, and general ledger posting:

Sequence Diagram
Click to expand

Figure 5.1: Sequence diagram mapping Controller, ProcurementService, Inventory Ledger, and GL commit cycles.

DB::transaction(function () use ($request, $tenant) {
    // 1. Create Purchase Invoice (P2P Workflow)
    $invoice = PurchaseInvoice::create([...]);

    // 2. Generate balanced double-entry ledger record
    $journalEntry = JournalEntry::create([...]);

    // 3. Update warehouse stock levels atomically & log movement
    foreach ($request->items as $item) {
        StockMovement::create([...]);
        ProductWarehouse::incrementStock($item['product_id'], $item['qty']);
    }
});
06

Administrative Modules & UI Proofs

Interfaces built for speed, accuracy, and real-time ledger auditing. Screens shown use demo data.

Supplier & Invoice MetadataDemo data
Click to expand

Supplier & Invoice Metadata

Supplier balances, licensed operators, credit limits, and destination warehouse targets.

Line Items & Tax CalculationsDemo data
Click to expand

Line Items & Dynamic Tax Calculations

Real-time sub-totals, item discounts, tax breakdowns, and ledger posting preview.

Manual Total OverrideDemo data
Click to expand

Manual Total Override & Audit Modal

Lets authorized accountants resolve rounding drift or reconcile manual invoice discrepancies, under authorization policies.

07

Inventory & Supplier Ledger Transparency

Tracking of item movements across warehouses, alongside supplier accounts payable statements.

Item Details & Pricing TiersDemo data
Click to expand

Item Details & Pricing Tiers

Multi-tier pricing, SKU identification, barcode assignment, and live multi-warehouse balances.

Serialized Stock Movement LogsDemo data
Click to expand

Serialized Stock Movement Logs

Audit trails distinguishing manual adjustments from automated system reconciliations.

Let's build your next system →