A comprehensive, full-stack Transport Management System designed to bridge the gap between Farmers, Transporters, and Traders. It facilitates the booking of transportation for agricultural goods, real-time fleet tracking, and automated route optimization.
- Role-Based Access Control: Secure user registration and login for Farmers, Transporters, Traders, and Admins.
- Goods Management: Farmers can easily list and manage available agricultural goods.
- Purchase Orders: Traders can place purchase orders for listed goods directly from Farmers.
- Transport Booking: Seamless booking process allowing Farmers to hire Transporters.
- Real-Time Fleet Tracking: Integrated
Socket.ioallows real-time location updates for in-transit shipments. - Route Optimization: Built-in route optimization service calculations for distance and cost efficiency during the booking phase.
- TypeScript Backend: The server is fully built with TypeScript, ensuring high type safety, stability, and maintainability.
- Framework: React + Vite
- Styling/UI: Tailwind CSS / Custom CSS
- State Management & API: Axios for HTTP requests
- Real-time: Socket.io-client (to be added to frontend for real-time tracking)
- Runtime: Node.js
- Language: TypeScript
- Framework: Express.js
- Database: MongoDB (via Mongoose)
- Authentication: JSON Web Tokens (JWT) & bcryptjs
- Real-time: Socket.io
Transport-Managment-System-main/
├── client/ # React frontend application
│ ├── src/
│ │ ├── api/ # Axios instance and API call definitions
│ │ ├── components/ # React UI components
│ │ └── ...
│ ├── package.json
│ └── vite.config.js
└── server/ # Express + TypeScript backend application
├── config/ # Database connection setup
├── controllers/ # Route logic and business operations
├── middlewares/ # Authentication and authorization guards
├── models/ # Mongoose schemas (TypeScript interfaces)
├── routes/ # API endpoint definitions
├── services/ # External logic (e.g., Route Optimization)
├── index.ts # Entry point of the server
├── package.json
└── tsconfig.json
Navigate to the server directory:
cd serverInstall dependencies:
npm installCreate a .env file in the server directory and add the following:
PORT=5000
MONGO_URI=mongodb://127.0.0.1:27017/Transportation_System
JWT_SECRET=your_jwt_secret_key
ALLOW_ORIGIN=http://localhost:5173Compile TypeScript and start the server:
npm run build
npm run dev(The API will be available at http://localhost:5000/api)
Open a new terminal and navigate to the client directory:
cd clientInstall dependencies:
npm installStart the Vite development server:
npm run dev(The frontend will be available at http://localhost:5173)
- Auth:
/api/login,/api/signUp - Users:
/api/getAllUsers,/api/getUserById/:id,/api/updateUser/:id - Goods:
/api/createGoods,/api/getAllGoods,/api/getFarmerGoods/:id - Transporters:
/api/createtransporter,/api/getAllTransporters - Bookings:
/api/book,/api/bookings,/api/getBookingsByFarmerId/:id - Orders:
/api/purchase-orders,/api/getPurchaseOrdersByFarmer/:id
MIT License