freightdesk/README.md
FreightDesk ec6ec234ac
Some checks are pending
FreightDesk CI/CD / Lint & Test (push) Waiting to run
FreightDesk CI/CD / Build Docker Image (push) Blocked by required conditions
FreightDesk CI/CD / Deploy to Coolify (push) Blocked by required conditions
[OWL] Critical fixes: registration routes, duplicate payments mount, missing views
Critical Fixes:
- Registration routes: changed /shipper → /register/shipper, /driver → /register/driver
  (was causing 404s — landing page linked to /register/* but routes were /shipper and /driver)
- Registration form actions: fixed to match /register/shipper and /register/driver
- Removed duplicate /payments route mount in server.js (payments.js is escrow, mounted at /escrow)
- Supabase client: now uses service key (falls back to anon key)
- Created missing pages/errors/403.ejs view

Documentation:
- README.md: full project documentation
- .env.example: environment variable template
- .dockerignore: exclude dev files from Docker image
2026-06-08 02:27:28 +00:00

161 lines
4.8 KiB
Markdown

# 🚛 FreightDesk
**India's Freight Marketplace Platform** — Connect shippers with truck drivers, manage loads, track payments through escrow, and grow your freight business.
![FreightDesk](https://img.shields.io/badge/Node.js-20-green?style=flat-square)
![License](https://img.shields.io/badge/license-MIT-blue?style=flat-stack)
## Features
### For Everyone
- 🌐 Public landing page with registration
- 🔐 Secure authentication (admin + portal users)
- 📱 Mobile-responsive design
- 🌙 Dark mode
### Admin Panel
- 📊 Dashboard with Recharts visualizations
- 🚛 Load management (CRUD + WhatsApp parser)
- 🏢 Shipper & vehicle management
- 💳 Payment tracking & commission calculator
- 📋 Reports & audit logs
- 🧾 Invoice PDF generation
- 🛡️ User moderation (verify, dispute resolution)
- 📈 Prometheus metrics + Pino logging
### Shipper Portal
- 📦 Post loads to marketplace
- 💰 Deposit funds to escrow
- 📊 View bids, accept/counter-offer
- 💸 Release payment after delivery
- 📝 Rate drivers
- 🔔 Real-time notifications
### Driver Portal
- 🔍 Browse & filter available loads
- 💵 Place bids on loads
- 📍 GPS location tracking
- 📊 Earnings dashboard
- 💸 Request payouts (UPI/Bank)
- ⭐ View ratings & reviews
### Marketplace
- 🏪 Browse loads with filters (city, type, budget)
- 💲 Bidding system with negotiation
- 🔔 Real-time notifications
- 📊 Bid comparison with driver profiles
## Tech Stack
| Layer | Technology |
|-------|-----------|
| Backend | Node.js + Express |
| Frontend | EJS server-rendered + React (Recharts via CDN) |
| Database | Supabase PostgreSQL |
| Auth | bcrypt + express-session |
| Security | Helmet + CSRF + rate limiting |
| Logging | Pino structured logging |
| Metrics | Prometheus |
| Testing | Jest + Supertest |
| Deployment | Docker + Coolify + Forgejo CI/CD |
## Quick Start
### Prerequisites
- Node.js 20+
- Supabase project (self-hosted or cloud)
### 1. Clone & Install
```bash
git clone http://forgejo-vil3xyowqk0qsh4hiqy77e3h.187.127.178.110.sslip.io/iamcoolvivek007/freightdesk.git
cd freightdesk/webapp
npm install
```
### 2. Configure
```bash
cp .env.example .env
# Edit .env with your Supabase credentials
```
### 3. Run Migrations
Run `supabase/migrations/001_initial_schema.sql` through `007_location_tracking.sql` in your Supabase SQL editor.
### 4. Create Admin Account
Visit `http://localhost:3000/setup`
### 5. Seed Demo Data (optional)
```bash
node scripts/seed-demo.js
```
### 6. Start
```bash
npm run dev # Development with nodemon
npm start # Production
```
## Docker
```bash
cd webapp
docker build -t freightdesk .
docker run -p 3000:3000 --env-file .env freightdesk
```
## Project Structure
```
freightdesk/
├── .github/workflows/deploy.yml # CI/CD pipeline
├── DEPLOYMENT.md # Full deployment guide
├── supabase/migrations/ # 7 migrations (001-007)
└── webapp/
├── Dockerfile
├── package.json
├── scripts/seed-demo.js # Demo data seeder
└── src/
├── server.js # Express app entry
├── config/env.js # Environment config
├── middleware/ # CSRF, auth, security
├── routes/ # 14 route files
│ ├── dashboard.js
│ ├── loads.js
│ ├── payments.js # Escrow payments
│ ├── marketplace.js # Bidding system
│ ├── admin-moderation.js
│ └── ...
├── services/ # Business logic
│ ├── supabase.js
│ ├── parser.js # WhatsApp parser
│ ├── invoice-pdf.js
│ ├── logger.js
│ └── metrics.js
├── views/pages/ # EJS templates
│ ├── public/ # Landing, register
│ ├── marketplace/ # Browse, post, bid
│ ├── portal/ # Shipper/driver portal
│ ├── payments/ # Deposit, payout
│ └── admin/ # Moderation
├── public/ # Static assets
│ └── css/style.css # Govt-app aesthetic
└── lib/ # India locale helpers
```
## Database Schema
7 migrations totaling ~20 tables:
| Migration | Tables Added |
|-----------|-------------|
| 001 | loads, shippers, vehicles, payments, portal_users |
| 002 | parser config, city list |
| 003 | soft-delete columns |
| 004 | audit_logs |
| 005 | bids, negotiations, ratings, notifications, load_views |
| 006 | escrow_accounts, escrow_transactions, payout_requests, disputes, platform_config |
| 007 | vehicle_locations, GPS columns on vehicles |
## License
MIT