Case study 03 / 05Live

CargoNepal
Logistics & Truck Booking Platform
A three-role logistics marketplace with realtime booking updates.
- Role
- Solo developer
- full-stack, API design, auth, realtime
- Timeline
- Sept 2025 – Dec 2025
- Full-Stack Application
- Status
- Live
- cargo-nepal-final.vercel.app
- Core stack
- Node.js · Express.js
- MongoDB, React.js, Socket.io
- User roles
- 3
- REST endpoints
- 15+
- Booking status (Socket.io)
- Live
- Invoices (PDFKit)
Gallery
Inside CargoNepal
01Overview
The problem, and what I built
The problem
Booking a truck in Nepal is mostly phone calls and brokers: customers can't compare trucks, owners can't manage bookings in one place, and nobody sees a live status.
What I built
A MERN truck booking platform for Nepal with fleet management, live Socket.io updates and PDF invoices.
A MERN platform for customers, truck owners and admins, with JWT auth and role middleware on every protected route.
15+ REST endpoints covering the booking lifecycle, fleet management and auth, from email OTP sign-up to PDF invoices.
Socket.io pushes booking status and notifications live, with conflict checks so a truck can't be double-booked.
Search and filters over location, capacity and vehicle type, so customers narrow the fleet instead of scrolling it.
02Architecture
How it fits together
Client
- React 18 + Vite SPA
- Tailwind CSS + Material UI
- React Query
- Role-based views
- Socket.io client
API
- Node.js + Express.js
- 15+ REST endpoints
- JWT auth + role middleware
- Socket.io server
Data & services
- MongoDB via Mongoose
- Bookings · Fleet · Users · Reviews
- Cloudinary uploads
- PDFKit invoices
Built with
- Node.js
- Express.js
- MongoDB
- React.js
- Socket.io
- JWT
- Vite
- Tailwind CSS
- Material UI
- Docker
03Decisions
Key engineering decisions
Fine-grained JWT role authorisation
Customer, truck owner and admin each have distinct permissions, enforced in middleware on protected routes.
Trade-offMore middleware than a single "logged in" check, but permissions are enforced on the server, not just hidden in the UI.
Socket.io instead of polling
Booking status changes and notifications are pushed over WebSockets, removing client-side polling.
Trade-offStateful connections need more care than plain REST, but both sides see changes as they happen.
04Lessons
What was hard, and what I learned
What was hard
- Keeping REST state and WebSocket events consistent so a booking never shows two different statuses to two users.
- Modelling the booking lifecycle across three roles without letting any role skip a step.
What I learned
- Model roles and state transitions before writing endpoints - the API almost designs itself afterwards.
- Real-time is a feature of the data model, not just the transport.
05Outcome
Where it landed
A deployed MERN platform covering the full booking lifecycle, fleet management and authentication end to end.
