Back to portfolio
Flagship SaaS

Masar ERP — Multi-Tenant SaaS Architecture

Production-grade database-per-tenant cloud ERP platform on Laravel 13, orchestrating 17 plan-gated business modules, ZATCA e-invoicing, and Neoleap bank payments.

The challenge

Scale a multi-tenant business suite serving high-concurrency Saudi enterprises across finance, manufacturing, inventory, and POS while strictly isolating tenant databases and guaranteeing accounting consistency.

Architecture & solution

Architected database-per-tenant isolation using Laravel 13 and stancl/tenancy with landlord, per-tenant, and template clone planes. Owned 17 plan-gated modules across 2,000+ PHP files, engineered an idempotent General Ledger (GL) posting SSOT with synchronous inventory movements, and integrated Sanctum POS Desktop API (/api/pos/v1) with token rotation.

Architecture pipeline & data flow

1. Inbound Routing

Subdomain resolution, tenant context & SSL termination

2. Tenancy Core

stancl/tenancy database-per-tenant dynamic DB switching

3. 17 ERP Modules

Accounting, Tax, ZATCA, Inventory, Manufacturing MRP, HR & POS

4. GL Posting SSOT

Idempotent double-entry journal transactions with inventory issuance

5. FinTech & Gov

ZATCA Phase 1 & 2 XML signing and Neoleap / Al Rajhi 3DS checkout

Technical highlights

  • Database-per-tenant full data isolation with transactional tenant provisioning
  • 17 plan-gated modules (Accounting, ZATCA, Inventory, Manufacturing MRP, HR, POS)
  • Idempotent GL posting single-source-of-truth across all trade flows
  • Sanctum POS Desktop API (/api/pos/v1) documented with OpenAPI/Scribe
  • Neoleap / Al Rajhi 3DS checkout and webhook-driven subscription activation

Tech stack

  • Laravel 13
  • stancl/tenancy
  • MySQL
  • Redis
  • ZATCA
  • Neoleap
  • Vue
  • Vite