How sathwik-0111/last_mile_delivery works
Last Mile Delivery Tracker is a role-based delivery management application. Customers register, price and create orders, then track progress and notifications; administrators review orders and assign agents manually or automatically; agents manage availability and advance deliveries, including failed-delivery handling. The React application calls a FastAPI API backed by SQLAlchemy and a relational database. The README documents tracking, rescheduling, dashboards and charge calculation; several backend route and service implementations were not sampled, so their detailed call paths are not asserted.
Main entry points: App.jsx Role-based screens · main.py FastAPI application · assignment_service.py Agent assignment · rate_engine.py Rate calculation
Components 32
Web application
- Role-based screens
frontend/src/App.jsx - Customer orders
frontend/src/pages/customer/CreateOrder.jsx - Customer tracking
frontend/src/pages/customer/OrderTracking.jsx - Customer dashboard
frontend/src/pages/customer/CustomerDashboard.jsx - Agent operations
frontend/src/pages/agent/AgentDashboard.jsx - Admin overview
frontend/src/pages/admin/AdminDashboard.jsx - Assignment screens
frontend/src/pages/admin/Assignment.jsx - HTTP API client
frontend/src/api/axios.js
API and access
- FastAPI application
backend/app/main.py - Authentication
backend/app/routes/auth.py - Order endpoints
backend/app/routes/orders.py - Agent endpoints
backend/app/routes/agent.py - Admin endpoints
backend/app/routes/admin.py
Delivery operations
- Order workflow
backend/app/services/order_service.py - Agent assignment
backend/app/services/assignment_service.py - Status transitions
backend/app/services/status_service.py - Tracking history
backend/app/services/tracking_service.py - Notifications
backend/app/services/notification_service.py - Rate calculation
backend/app/services/rate_engine.py - Zone lookup
backend/app/services/zone_service.py
Persistence and pricing
- SQL database
backend/app/database.py - Order records
backend/app/models/order.py - Agent records
backend/app/models/agent.py - User records
backend/app/models/user.py - Rate configuration
backend/app/models/rate_card.py - COD charges
backend/app/models/cod_charge.py - Zones and areas
backend/app/models/zone.py - Tracking records
backend/app/models/tracking_history.py - Notification records
backend/app/models/notification.py
Other components
- Customer
- Delivery agent
- Administrator
Connections 40
- Customer → Role-based screens: use
README.md - Delivery agent → Role-based screens: use
README.md - Administrator → Role-based screens: use
README.md - Role-based screens → Customer orders: routes to
frontend/src/App.jsx - Role-based screens → Customer tracking: routes to
frontend/src/App.jsx - Role-based screens → Customer dashboard: routes to
frontend/src/App.jsx - Role-based screens → Agent operations: routes to
frontend/src/App.jsx - Role-based screens → Admin overview: routes to
frontend/src/App.jsx - Role-based screens → Assignment screens: routes to
frontend/src/App.jsx - Customer orders → HTTP API client: calls
frontend/src/pages/customer/CreateOrder.jsx - Customer dashboard → HTTP API client: calls
frontend/src/pages/customer/CustomerDashboard.jsx - Agent operations → HTTP API client: calls
frontend/src/pages/agent/AgentDashboard.jsx - Admin overview → HTTP API client: calls
frontend/src/pages/admin/AdminDashboard.jsx - HTTP API client → FastAPI application: HTTP requests
README.md - FastAPI application → Authentication: registers router
backend/app/main.py - FastAPI application → Order endpoints: registers router
backend/app/main.py - FastAPI application → Agent endpoints: registers router
backend/app/main.py - FastAPI application → Admin endpoints: registers router
backend/app/main.py - Order endpoints → Order workflow: delegates to
- Order endpoints → Rate calculation: requests pricing
- Admin endpoints → Agent assignment: requests assignment
- Agent endpoints → Status transitions: requests transitions
- Order workflow → Rate calculation: calculates charge
backend/app/services/order_service.py - Order workflow → Tracking history: records event
backend/app/services/order_service.py - Agent assignment → Tracking history: records event
backend/app/services/assignment_service.py - Agent assignment → Notifications: creates notification
backend/app/services/assignment_service.py - Status transitions → Tracking history: records event
backend/app/services/status_service.py - Status transitions → Notifications: creates notification
backend/app/services/status_service.py - Rate calculation → Zone lookup: looks up zones
backend/app/services/rate_engine.py - Rate calculation → Rate configuration: queries rates
backend/app/services/rate_engine.py - Rate calculation → COD charges: queries surcharge
backend/app/services/rate_engine.py - Zone lookup → Zones and areas: reads areas
backend/app/services/zone_service.py - Order workflow → Order records: uses records
backend/app/services/order_service.py - Agent assignment → Order records: loads and updates
backend/app/services/assignment_service.py - Agent assignment → Agent records: checks availability
backend/app/services/assignment_service.py - Tracking history → Tracking records: persists events
- Notifications → Notification records: persists notifications
- Authentication → User records: queries users
backend/app/routes/auth.py - Authentication → SQL database: gets session
backend/app/routes/auth.py - SQL database → Order records: provides ORM base
backend/app/models/order.py