CargoTrack is a comprehensive Cargo Booking and Management System developed using the MERN stack (MongoDB, Express.js, React.js, and Node.js). The platform enables users to book cargo space on available containers, track shipments in real time, and provides an admin panel for efficient container and cargo management. The system ensures secure user interactions through multi-step authentication, middleware-based authorization, and seamless container allocation.
- React.js (18.2.0): Provides a responsive and dynamic user interface for cargo booking, payment processing, and profile management.
- Material UI (5.15.9): Enhances the UI with modern, pre-built React components.
- Framer Motion (11.0.3): Enables smooth animations and transitions for an engaging user experience.
- React-Toastify (10.0.4): Displays real-time notifications such as booking confirmations and system alerts.
- Node.js (20.11.0): Executes server-side logic, handling authentication, database management, and API routing.
- Express.js (4.18.2): Manages HTTP requests, routing, and RESTful API endpoints.
- MongoDB & Mongoose: Provides a NoSQL database for efficient storage of bookings, users, containers, and transactions.
- JWT (JSON Web Tokens): Ensures secure authentication and authorization through token-based access.
- Nodemailer (6.9.4): Facilitates OTP-based email authentication.
- Bcrypt.js (2.4.3): Encrypts passwords for secure storage.
- CORS (2.8.5): Enables secure cross-origin communication between frontend and backend.
- Dotenv (16.3.1): Manages environment variables for security-sensitive configurations.
- Nodemon (3.0.1): Enhances backend development efficiency by enabling live server reloads.
The admin panel provides comprehensive container management, booking oversight, and utilization tracking.
POST /cargo/admin/login
– Admin login with OTP-based authentication.POST /cargo/admin/register
– Admin registration with secure credentials.POST /cargo/admin/container
– Add a new container with route details and pricing.GET /cargo/admin/:adminId/containers
– Retrieve the list of containers managed by an admin.POST /cargo/admin/containerupdate
– Update container details such as location and capacity.
Users can book cargo space, track shipments, and manage their bookings securely.
POST /register
– User registration with email verification.POST /login
– User login with OTP authentication.POST /verify-otp
– OTP verification for secure login.POST /cargo/booking
– Submit a cargo booking request with parcel dimensions and route details.POST /cargo/booking/payment
– Securely process payments and confirm bookings.GET /cargo/booking
– Retrieve past bookings and track active shipments.
CargoTrack employs a structured schema design to ensure efficient management of bookings, containers, and user operations.
- Fields:
name
,email
,phone
,password
,bookings
(array of booking references). - Relationships: Users can have multiple bookings linked to their profile.
- Fields:
from
,to
,height
,width
,breadth
,cost
,destinedContainer
,status
. - Relationships: Each booking is associated with a user and, if confirmed, linked to a container.
- Fields:
length
,breadth
,height
,from
,to
. - Relationships: Cargo items are stored within containers and validated against space constraints.
- Fields:
length
,breadth
,height
,from
,to
,availableFrom
,availableUntil
,cargoItems
. - Relationships: Containers store multiple cargo items and are managed by admins.
- Fields:
name
,email
,phone
,password
,containers
. - Relationships: Admins oversee multiple containers and manage bookings.
- User registers, and credentials are securely stored.
- On booking, cargo details are saved, and an available container is allocated based on the route and dimensions.
- The backend matches bookings with suitable containers.
- Container space utilization is tracked, preventing overbooking.
- Admins create and manage containers, ensuring efficient allocation.
- Containers and bookings are monitored using real-time tracking and percentage utilization calculations.
# Clone backend and frontend repositories
git clone <backend-repo-url>
git clone <frontend-repo-url>
For the backend:
cd backend
npm install
For the frontend:
cd frontend
npm install
Create a .env
file in the backend directory and define the following:
MONGO_URI=mongodb://localhost:27017/cargo-track
JWT_SECRET=your-jwt-secret
NODEMAILER_EMAIL=your-email@example.com
NODEMAILER_PASSWORD=your-email-password
To start the backend and frontend in development mode:
# Backend
cd backend
npm run dev
# Frontend
cd frontend
npm run dev
For production deployment:
# Build frontend for production
cd frontend
npm run build
Consider using Docker for containerized deployment.
CargoTrack offers a robust solution for cargo booking and shipment management, ensuring secure, scalable, and efficient operations. Its modular architecture enables seamless user interactions, real-time tracking, and optimized resource management. Future enhancements could include AI-driven container allocation, predictive ETA calculations, and blockchain-based shipment security.
For contributions or inquiries, refer to the repository documentation or contact the development team.