- π Overview
- β¨ Key Features
- π οΈ Tech Stack
- π Project Structure
- π Environment Variables
- π¦ Prerequisites
- π Local Development
- π³ Docker Configuration
- π Deployment
- π API Highlights
- π Security Notes
- π€ Contributing
- π₯ Contributors
- π License
- π¬ Support
Fleetiva Roadlines is a production-ready logistics platform for load posting, truck assignment, booking management, and Bilty (LR) generation. It supports role-based access for Customers, Drivers, and Admins, with real-time shipment status updates and printable documentation.
- Role-Based Access Control (RBAC) for customers, drivers, and admins.
- JWT Authentication with secure password hashing (bcrypt).
- Load Posting & Matching to assign available trucks.
- Booking Management with shipment status workflow.
- Real Bilty (LR) Generation stored in MongoDB and printable as PDF.
- Payment Tracking with balance calculations and status updates.
- OTP Password Recovery via Redis + Twilio.
- Centralized Error Handling and audit logs.
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React + Vite | Fast, modern UI framework |
| Axios | HTTP client with interceptors | |
| React Router | Role-based routing | |
| CSS Modules | Component-scoped styling | |
| Backend | Node.js + Express | RESTful API server |
| MongoDB + Mongoose | NoSQL database & ODM | |
| JWT + bcrypt | Authentication & password hashing | |
| PDFKit | Bilty/Invoice PDF generation | |
| Infrastructure | Render | Backend hosting |
| Vercel | Frontend hosting | |
| Redis | OTP caching | |
| Twilio | SMS notifications |
backend/
config/
middleware/
models/
routes/
utils/
frontend/
src/
api/
components/
context/
pages/
MONGO_URIβ MongoDB Atlas connection stringACCESS_TOKEN_SECRETβ JWT secretACCESS_TOKEN_TTLβ JWT TTL (e.g.,7d)FRONTEND_URLβ production frontend URLFRONTEND_PREVIEW_URLβ preview URL (optional)CORS_ORIGINSβ comma-separated CORS allowlistVERCEL_PREVIEW_SUFFIXβ e.g.,.vercel.appFREIGHT_RATE_PER_TONβ base freight rateOTP_TTL_SECONDSβ OTP expiration (default 600)TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN,TWILIO_FROM_NUMBERβ Twilio SMSREDIS_URLβ Redis connection stringSKIP_MONGOβ settrueto skip DB (not for production)SKIP_FIREBASEβ settrueif not using Firebase
VITE_API_BASE_URLβ backend API base (e.g.,https://your-backend.onrender.com/api)VITE_RENDER_SERVICE_NAMEβ Render service name for preview URLsVITE_RENDER_SERVICE_URLβ Render base URLVITE_FIREBASE_API_KEY,VITE_FIREBASE_AUTH_DOMAIN,VITE_FIREBASE_PROJECT_IDVITE_FIREBASE_STORAGE_BUCKET,VITE_FIREBASE_MESSAGING_SENDER_ID,VITE_FIREBASE_APP_ID
Before running this project locally, ensure you have:
- Node.js (v16 or higher)
- npm or yarn
- MongoDB Atlas account (or local MongoDB instance)
- Git installed
- Redis (optional, for OTP functionality)
- Twilio account (optional, for SMS)
The easiest way to get started is using Docker Compose, which sets up the entire stack with a single command:
- Docker and Docker Compose installed
- At least 4GB of free disk space
We provide convenient scripts for easy setup:
Linux/Mac:
git clone https://github.com/sarojit049/Fleetiva-Roadlines.git
cd Fleetiva-Roadlines
./docker-start.shWindows:
git clone https://github.com/sarojit049/Fleetiva-Roadlines.git
cd Fleetiva-Roadlines
docker-start.batThe script will:
- β Check if Docker is installed
- β
Create
.envfile from.env.exampleif needed - β Provide an interactive menu for managing services
-
Clone the repository
git clone https://github.com/sarojit049/Fleetiva-Roadlines.git cd Fleetiva-Roadlines -
Set up environment variables
cp .env.example .env # Edit .env file with your configuration (optional - defaults are set) -
Start all services
docker-compose up --build
This command will:
- Build the Node.js backend container
- Start MongoDB with persistent storage
- Start Redis for caching/OTP
- Connect all services automatically
-
Access the application
- Backend API:
http://localhost:5000 - MongoDB:
localhost:27017(username:admin, password:password) - Redis:
localhost:6379(password:redispassword)
- Backend API:
-
Stop the services
docker-compose down
To remove volumes (database data):
docker-compose down -v
The docker-compose.yml includes:
- backend: Node.js Express API server
- mongo: MongoDB 7.0 with persistent volumes
- redis: Redis 7 Alpine with persistence
# View logs
docker-compose logs -f backend
# Restart a specific service
docker-compose restart backend
# Run commands in backend container
docker-compose exec backend npm test
# Check service status
docker-compose psπ For detailed Docker documentation, see DOCKER_SETUP.md
If you prefer to run services manually or need more control:
cd backend
npm install
cp .env.example .env
# Make sure MongoDB and Redis are running locally
npm run devcd frontend
npm install
cp .env.example .env
npm run devThe .env.example file is configured with Docker-friendly defaults. Key differences from manual setup:
- MONGO_URI: Uses Docker service name
mongo:27017instead oflocalhost - REDIS_URL: Uses Docker service name
redis:6379instead oflocalhost - MongoDB credentials are set via
MONGO_ROOT_USERNAMEandMONGO_ROOT_PASSWORD - Redis password is set via
REDIS_PASSWORD
Docker volumes ensure your data persists across container restarts:
mongo_data: MongoDB database filesmongo_config: MongoDB configurationredis_data: Redis persistence files
All services communicate through the fleetiva-network bridge network, ensuring:
- Isolated network environment
- Service discovery by container name
- No need for external IP addresses
For production deployment with Docker:
- Change default passwords in
.env - Use Docker secrets for sensitive data
- Consider using Docker Swarm or Kubernetes for orchestration
- Set up proper backup strategies for volumes
- Configure resource limits in
docker-compose.yml
- Create a new Web Service on Render.
- Set build command:
npm install - Set start command:
npm start - Add environment variables from
backend/.env.example. - Ensure MongoDB Atlas IP allowlist includes Render.
- Import the
frontend/project into Vercel. - Set
VITE_API_BASE_URLto the Render backend URL +/api. - Deploy.
To enable Google/Firebase authentication:
- Go to Firebase Console β Authentication β Settings β Authorized domains
- Add your deployed Vercel URL (e.g.,
your-app.vercel.app) - Add any custom domains you're using
| Method | Endpoint | Role | Description |
|---|---|---|---|
POST |
/api/auth/register |
Public | Register new user |
POST |
/api/auth/login |
Public | User login |
GET |
/api/auth/me |
Authenticated | Get current user |
POST |
/api/load/post |
Customer | Post new load |
GET |
/api/load/available |
Admin | View available loads |
POST |
/api/truck/post |
Driver | Post truck availability |
GET |
/api/match/:loadId |
Admin | Match trucks to load |
POST |
/api/booking/create |
Admin | Create booking + Bilty |
GET |
/api/booking/all |
Admin | View all bookings |
GET |
/api/booking/customer/bookings |
Customer | View own bookings |
GET |
/api/booking/driver/bookings |
Driver | View assigned bookings |
PATCH |
/api/booking/:id/status |
Driver | Update shipment status |
GET |
/api/booking/:id/bilty |
Authenticated | Download Bilty PDF |
GET |
/api/booking/:id/invoice |
Authenticated | Download Invoice PDF |
- Secrets are stored in
.envonly. - Passwords are hashed with bcrypt.
- JWTs are validated on every protected route.
- CORS and HTTP-only cookies are supported.
If you prefer a quick setup without Docker, you can run the backend and frontend manually.
cd backend
npm install
npm run dev
We welcome contributions! Follow these steps to contribute:
### Git Workflow
1. **Fork the repository**
```bash
# Click the 'Fork' button on GitHub-
Clone your fork
git clone https://github.com/YOUR_USERNAME/Fleetiva-Roadlines.git cd Fleetiva-Roadlines -
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes and commit
git add . git commit -m "feat: add your feature description"
-
Push to your fork
git push origin feature/your-feature-name
-
Open a Pull Request
- Go to the original repository
- Click "New Pull Request"
- Select your branch and submit
- Follow existing code style and conventions
- Write clear commit messages (use conventional commits)
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting PR
Thanks to all the amazing people who have contributed to Fleetiva Roadlines! π
Want to see your avatar here? Check out the Contributing section to get started!
This project is licensed under the MIT License - see the LICENSE file for details.
If you have questions or need help:
- π§ Open an issue on GitHub
- π‘ Check existing issues and discussions
- π Star this repo if you find it helpful!
Made with β€οΈ by the Fleetiva Team