FairRelay / ops /README.md
MouleeswaranM's picture
Upload folder using huggingface_hub
fcf8749 verified
|
raw
history blame
2.88 kB

πŸš› Hyper-Local Logistics & Relay Optimizer

An advanced, end-to-end logistics orchestration platform designed to maximize truck utilization and driver efficiency. This project features a unique Driver Relay (Handshake) System and an automated, API-free e-Way Bill Generator.


🌟 Key Features

πŸ”„ Driver Relay & Workload Balancing

Intelligent assignment logic based on custom business rules:

  • Experience-Based Assignment: Automatically matches long-haul missions (e.g., >300km) with experienced drivers (high historical totalDistanceKm).
  • Workload Balancing: Assigns shorter missions to newer drivers to ensure a fair and safe distribution of labor.
  • ID Resolution: Dispatchers use "Human-Readable" identifiers like Phone Numbers and License Plates instead of complex Database UUIDs.

🀝 Absorption Handshake System

A peer-to-peer "handover" mechanism allowing trucks to exchange goods at virtual hubs:

  • Offline Verification: Supports a "Digital Handshake" via cryptographic QR codes for areas with zero cellular connectivity.
  • Dual-Bill Updates: Automatically handles the transfer of responsibility between an "Exporter" driver and an "Importer" driver.

πŸ“„ Dynamic e-Way Bill Mimicry

Generates professional e-Way Bills using Node.js & Puppeteer:

  • No External APIs: Mimics the official government layout purely via HTML/CSS.
  • Auto-Data Resolution: Fetches GSTINs (Supplier/Recipient), License Plates, and Phone Numbers automatically from the database.
  • Dual Generation: Produces two updated PDFs (for both trucks) instantly during an absorption event, delivered in a single .zip file.

πŸ—οΈ Technical Architecture

Tech Stack

  • Backend: Node.js, Express.js
  • Database: PostgreSQL (Optimized with Prisma ORM)
  • PDF Engine: Puppeteer (Headless Chrome for high-fidelity rendering)
  • Auth: JWT with Role-Based Access Control (RBAC)
  • File Handling: archiver for ZIP generation and qrcode for local QR generation.

πŸ“‚ Project Structure

β”œβ”€β”€ config/
β”‚   └── prisma.js               # Prisma Client initialization
β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ routeController.js      # Relay logic & assignment
β”‚   └── ewayBillController.js   # PDF generation & absorption logic
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ puppeteer.service.js    # PDF rendering engine (Virtual Printer)
β”‚   └── qr.service.js           # Base64 QR code generation
β”œβ”€β”€ templates/
β”‚   └── ewayBill.html           # HTML layout mimicking official format
β”œβ”€β”€ public/
β”‚   └── css/ewayBill.css        # Print-optimized styles (@media print)
β”œβ”€β”€ routes/
β”‚   └── api.js                  # Protected API endpoints
└── prisma/
    └── schema.prisma           # Relational Database Models