A robust, high-performance fleet management and delivery tracking backend system built with Laravel. This API handles the complete lifecycle of delivery orders, real-time driver tracking, and dynamic pricing using spatial data and routing engines.
- 🔒 Secure Authentication & OTP: Multi-guard authentication for Shops and Drivers using Laravel Sanctum, reinforced with OTP verification.
- 📍 Real-Time Spatial Tracking: Utilizes Redis Geo-Radius to instantly track driver locations and efficiently filter available drivers within a 5km radius of the pickup point.
- 🗺️ Dynamic Routing & Pricing: Integrated with OSRM (Open Source Routing Machine) to calculate precise distances and generate dynamic order pricing based on real routes.
- 📦 Order Lifecycle Management: Complete state machine for orders (Pending, Accepted, Delivered) with secure proof-of-delivery uploads.
- 🐳 Dockerized Environment: Fully containerized development environment using Laravel Sail (Docker + WSL).
- Framework: Laravel 11 (PHP 8.x)
- Database: MySQL
- In-Memory Store: Redis (for queue management and spatial data)
- Routing Engine: OSRM (Open Source Routing Machine)
- Containerization: Docker & Laravel Sail
- API Documentation: Knuckles Scribe & Postman
To get this project up and running on your local machine, follow these steps:
Make sure you have Docker Desktop and WSL2 (if on Windows) installed.
- Clone the repository:
git clone https://github.com/omar-920/smart-fleet-api.git
cd smart-fleet-api- Install Composer dependencies:
docker run --rm \
-u "$(id -u):$(id -g)" \
-v "$(pwd):/var/www/html" \
-w /var/www/html \
laravelsail/php83-composer:latest \
composer install --ignore-platform-reqs- Environment Setup:
cp .env.example .env(Ensure you configure your database and Redis settings in the .env file)
- Start the Docker containers using Sail:
./vendor/bin/sail up -d- Generate App Key & Run Migrations:
./vendor/bin/sail artisan key:generate
./vendor/bin/sail artisan migrateThis project features comprehensive API documentation generated automatically.
- Scribe Web Docs: Once the server is running, visit
http://localhost/docsto view the interactive API documentation. - Postman Collection: A fully configured Postman collection (
smart_fleet.postman_collection.json) is included in the repository root for immediate API testing. Import it directly into Postman.
Omar Tarek