How We Built an ERP with 50+ Tables in 12 Weeks
A deep dive into building the Southern Cargo ERP — from database schema design to production deployment serving two logistics companies.
The Challenge
Southern Cargo Logistics came to us with a problem that's common in Indian logistics: their entire operation — trip tracking, billing, fleet management, HR — was spread across Excel sheets, WhatsApp groups, and manual processes. And they weren't just one company. They were two sister companies (SCL and SCC) with shared operations but different billing requirements.
Why 50+ Tables?
When you're building an ERP that manages the full lifecycle of a logistics operation, the data model gets complex fast. Here's a breakdown of the major domains:
- Trip Management — trips, trip items, routes, drivers, vehicles, trip status history
- Billing — invoices, invoice items, GST records, RCM records, payment tracking
- Fleet — vehicles, maintenance records, tyre lifecycle, fuel logs
- HR — employees, attendance, payroll, leave management
- Access Control — roles, permissions, role templates, audit logs
Each domain required 8-12 tables with proper foreign key relationships, indexes, and Row Level Security policies.
The Architecture Decision
We chose Supabase PostgreSQL for the database layer. The key reasons:
- Row Level Security — essential for multi-company data isolation
- Real-time subscriptions — for live dashboard updates
- Built-in auth — saved weeks of implementation time
- PostgreSQL — the most reliable relational database, period
The frontend is React 18 with TypeScript, using Zustand for state management and TanStack Query for server state.
Shipping in 12 Weeks
The secret wasn't working faster — it was working smarter. We built module by module, with each module going through user acceptance testing before moving to the next:
- Weeks 1-3: Core data model, authentication, trip management
- Weeks 4-6: Billing engine (GST + RCM), invoice generation
- Weeks 7-9: Fleet management, tyre lifecycle, maintenance scheduling
- Weeks 10-11: HR module, reporting, analytics dashboard
- Week 12: Production deployment, data migration, training
Results
Today, the Southern Cargo ERP manages 10,000+ trip records, serves 50+ active users across both companies, and maintains 99.9% uptime. The dual billing engine handles both GST and RCM compliance automatically — something that used to take hours of manual work each week.