Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Transport Management System

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.

Features

  • 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.io allows 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.

Technology Stack

Frontend (Client)

  • 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)

Backend (Server)

  • Runtime: Node.js
  • Language: TypeScript
  • Framework: Express.js
  • Database: MongoDB (via Mongoose)
  • Authentication: JSON Web Tokens (JWT) & bcryptjs
  • Real-time: Socket.io

Project Structure

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

Getting Started

Prerequisites

1. Backend Setup

Navigate to the server directory:

cd server

Install dependencies:

npm install

Create 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:5173

Compile TypeScript and start the server:

npm run build
npm run dev

(The API will be available at http://localhost:5000/api)

2. Frontend Setup

Open a new terminal and navigate to the client directory:

cd client

Install dependencies:

npm install

Start the Vite development server:

npm run dev

(The frontend will be available at http://localhost:5173)

API Endpoints

  • 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

License

MIT License

Releases

Packages

Contributors

Languages