Engineering notes

How to Build a Custom ERP System with Laravel

By Taha Rafi · 2026-11-24 · 11 min read

How to Build a Custom ERP System with Laravel

Laravel is a reasonable default for a custom ERP — Eloquent, queues, and a mature permissions ecosystem cover most of the plumbing. But the framework choice is the easy part. What actually determines whether the system holds up at 50+ corporate tenants or a few hundred thousand records is a handful of architectural decisions made in the first few weeks. This is what mattered building Raad Enterprise (a 57-table coworking ERP replacing 3 legacy apps), Fleetlyst (a 77-model fleet and accounting ERP), and Afzal Mangoes (a 140-file legacy codebase re-architected into 34 Laravel models).

1. Module boundaries before models

An ERP is really several loosely related applications sharing one database — billing, inventory, HR, bookings, reporting. Deciding those boundaries before writing migrations matters more than any individual table design, because it determines which tables ever need to reference each other directly versus through an event or a job. Raad Enterprise's 57 migrations map cleanly onto distinct modules (contracts, bookings, cafe inventory, biometric attendance) specifically so that a change in one doesn't ripple through the others.

2. A repository layer earns its keep in an ERP specifically

Putting query logic directly in controllers is fine for a small app; in an ERP with 70+ models and dozens of controllers, it becomes impossible to find where a given business rule actually lives. Fleetlyst's architecture uses 15 decoupled repository classes behind 44 controllers for exactly this reason — not as a textbook pattern for its own sake, but because the alternative is duplicated query logic every time two features need the same data shaped slightly differently.

3. Model the ledger, not just the balance

If the ERP touches money at all — invoicing, payroll, commissions — store the transactions, not just a running balance column. A proper double-entry Chart of Accounts and General Ledger (as in Fleetlyst's accounting engine) means every number on a financial statement is reconstructable from the underlying journal entries, which is the difference between a report you can audit and one you can only hope is correct.

4. RBAC from day one, not retrofitted later

Multi-portal ERPs (admin, operations staff, corporate tenant users, in Raad Enterprise's case) need permissions scoped per role before the first real feature ships, not bolted on afterward. spatie/laravel-permission covers the mechanics; the actual work is deciding the role boundaries up front, since retrofitting them into controllers that assumed a single user type is expensive.

5. Legacy migration is its own project, not a side task

If the ERP is replacing something that already has real data in it — as with Afzal Mangoes' 140+ legacy PHP files — budget dedicated Artisan ETL commands (12 of them, in that case) to clean and normalize the old schema into the new one, rather than a single ad-hoc import script. Legacy data is inconsistent in ways you won't discover until you try to migrate it, and a set of idempotent, re-runnable commands makes that discovery process survivable.

6. Decide what's really real-time

Not every ERP view needs to be live. Deciding upfront which screens genuinely need real-time data (a live dispatch board, for example) versus which can be refreshed on request keeps the caching and query-optimization work scoped to where it actually matters, instead of over-engineering the whole system for a requirement most of it doesn't have.

None of this is framework-specific wisdom unique to Laravel — it's what tends to separate an ERP that's still maintainable at year two from one that isn't, regardless of stack. Laravel just makes the plumbing around these decisions (migrations, queues, Eloquent relationships, query optimization and caching) fast enough that the architecture decisions are what's left to get right.

Related services

Related case studies

Planning a custom ERP build?

Share your requirements and we'll discuss a practical scope, approach, and next steps.

All articles