TransitOps is a comprehensive, full-stack logistics and fleet management platform designed to streamline the operations of transport and logistics companies. It provides tools for managing vehicles, drivers, trips, fuel consumption, maintenance, and expenses, all within a role-based access control system.
- Fleet Management: Track vehicle status, details, capacity, and cost.
- Driver Management: Monitor driver statuses, safety scores, licenses, and contact information.
- Trip Tracking: Create, dispatch, and track trips from source to destination with real-time status updates.
- Fuel & Expense Tracking: Log fuel consumption and trip-related expenses (maintenance, toll, others) to calculate operating costs.
- Maintenance Records: Schedule and track vehicle maintenance (routine, oil changes, brake service, etc.).
- Role-Based Access Control (RBAC): Secure access with distinct roles (
ADMIN,DRIVER,FLEET_MANAGER,DISPATCHER,SAFETY_OFFICER,FINANCIAL_ANALYST) and granular permissions. - Company Multi-tenancy: Designed to support organizational structures and company-specific configurations.
The application is built on a modern stack featuring a Next.js frontend and an Express.js backend powered by Prisma and PostgreSQL.
graph TD
Client[Web Browser] -->|HTTP / REST API| NextJS[Next.js Frontend]
NextJS -->|API Requests| Express[Express.js API Backend]
Express -->|Prisma Client Queries| Prisma[Prisma ORM]
Prisma -->|SQL Queries| Postgres[(PostgreSQL Database)]
subgraph Frontend [Frontend - Next.js App Router]
NextJS
Tailwind[Tailwind CSS]
Lucide[Lucide Icons]
end
subgraph Backend [Backend - Express API]
Express
Auth[Auth Middleware JWT]
RBAC[RBAC / Permissions Middleware]
Controllers[Controllers & Services]
end
The relational database is carefully structured to handle complex fleet operations. View the detailed Database Design Document
erDiagram
COMPANIES ||--o{ USERS : "has"
COMPANIES ||--o{ VEHICLES : "owns"
ROLES ||--o{ USERS : "assigned to"
ROLES ||--o{ ROLE_PERMISSIONS : "grants"
USERS ||--o| DRIVER : "is a"
VEHICLES ||--o{ TRIP : "performs"
VEHICLES ||--o{ FUEL_LOGS : "consumes"
VEHICLES ||--o{ EXPENSES : "incurs"
VEHICLES ||--o{ MAINTENANCE : "undergoes"
DRIVER ||--o{ TRIP : "drives"
TRIP ||--o{ EXPENSES : "incurs"
COMPANIES {
int id PK
string name
string currency
string distance_unit
}
USERS {
int id PK
int company_id FK
int role_id FK
string name
string email
string password
}
ROLES {
int id PK
string role "Enum: ADMIN, DRIVER, etc."
}
VEHICLES {
string reg_no PK
int company_id FK
string vehicle_model
string type
float load_capacity
string status "Enum: Available, On_Trip, etc."
}
DRIVER {
string license_no PK
int driver_id FK "References Users"
string status
float safety_score
}
TRIP {
int id PK
string reg_no FK
int driver_id FK
string src
string dest
string trip_status "Enum: Draft, Dispatched, etc."
}
- Framework: Next.js (App Router)
- Library: React 19
- Styling: Tailwind CSS v4
- Icons: Lucide React
- Framework: Express.js
- Language: TypeScript
- ORM: Prisma
- Database: PostgreSQL
- Security: JWT Authentication, Custom Role & Permission Middleware
- Node.js (v20+)
- pnpm (recommended) or npm/yarn
- PostgreSQL Database
- Docker (optional, for running the database)
- Navigate to the backend directory:
cd backend - Install dependencies:
pnpm install
- Set up your
.envfile (copy from.env.exampleif available) and ensureDATABASE_URLis set. - Run Prisma migrations:
pnpm dlx prisma migrate dev
- Start the development server:
pnpm dev
- Navigate to the frontend directory:
cd frontend - Install dependencies:
pnpm install
- Start the Next.js development server:
pnpm dev
The frontend will be available at http://localhost:3000 and the API backend typically at http://localhost:5000 (depending on your .env configuration).
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request