A modern delivery management system that allows customers to place delivery orders and delivery personnel to view and update their delivery tasks. Built with React, Express, Socket.IO, and Leaflet Maps integration.
- Account Management: Register and login as a customer
- Order Creation: Place delivery requests with pickup and drop-off addresses
- Address Input: Leaflet Maps integration with OpenStreetMap for accurate address selection
- Real-time Tracking: Track order status in real-time
- Order History: View all placed orders with detailed status
- Dashboard: View assigned delivery tasks
- Status Updates: Update order status (Picked Up, Delivered)
- GPS Integration: Real-time location tracking during deliveries
- Navigation: Get directions using OpenStreetMap
- Real-time Notifications: Receive new assignments instantly
- Order Management: View all orders in the system
- Assignment: Assign delivery personnel to pending orders
- Analytics: Overview of system performance and statistics
- Personnel Management: View registered delivery personnel
- Real-time Monitoring: Monitor all deliveries in real-time
- Real-time Updates: WebSocket-based live updates
- Map Integration: Leaflet Maps with OpenStreetMap for address selection and tracking
- Responsive Design: Modern, mobile-friendly interface
- Authentication: JWT-based secure authentication
- API-first: RESTful API with comprehensive endpoints
- React 19 - Modern UI library
- Vite - Fast build tool
- TailwindCSS - Utility-first CSS framework
- React Router - Client-side routing
- Socket.IO Client - Real-time communication
- Leaflet - Open-source maps and geocoding
- React Leaflet - React components for Leaflet
- React Hot Toast - Notifications
- Framer Motion - Animations
- Node.js - Runtime environment
- Express.js - Web framework
- Socket.IO - Real-time communication
- JWT - Authentication
- bcryptjs - Password hashing
- CORS - Cross-origin resource sharing
- UUID - Unique identifiers
Before running this application, make sure you have:
- Node.js (v18 or higher)
- npm or yarn
```bash git clone cd mini-delivery ```
```bash npm install ```
```bash cd server npm install cd .. ```
Create `.env` file in the root directory: ```env VITE_API_URL=http://localhost:3001/api VITE_SOCKET_URL=http://localhost:3001 VITE_MAP_PROVIDER=openstreetmap VITE_NODE_ENV=development ```
Create `server/.env` file: ```env PORT=3001 CLIENT_URL=http://localhost:5173 JWT_SECRET=your-super-secret-jwt-key NODE_ENV=development ```
```bash cd server npm run dev
npm start ```
```bash npm run dev ```
- Frontend: http://localhost:5173
- Backend API: http://localhost:3001
This application uses Leaflet with OpenStreetMap for mapping functionality:
- No API Key Required: OpenStreetMap is free and open-source
- Address Autocomplete: Using Nominatim geocoding service
- Real-time Tracking: GPS location tracking during deliveries
- Route Directions: Integration with OpenStreetMap routing
- Interactive maps for address selection
- Real-time location tracking
- Route calculation and directions
- Geocoding and reverse geocoding
- No usage limits or API costs
You can register new accounts through the app, or create them directly:
- Role: Customer
- Features: Place orders, track deliveries
- Role: Delivery
- Features: View assignments, update status
- Role: Admin
- Features: Manage orders, assign personnel
- Register/Login with role "Customer"
- Place Order by clicking "New Order"
- Enter Addresses using the map-integrated inputs
- Track Progress in real-time on your dashboard
- View History of all your orders
- Register/Login with role "Delivery"
- View Assignments on your dashboard
- Update Status as you pick up and deliver items
- Use Navigation to get directions via OpenStreetMap
- Track Earnings and performance
- Register/Login with role "Admin"
- Monitor Orders in real-time
- Assign Orders to available delivery personnel
- View Analytics and system statistics
- Manage Personnel and system performance
```bash npm run dev # Start development server npm run build # Build for production npm run preview # Preview production build npm run lint # Run ESLint ```
```bash npm start # Start production server npm run dev # Start development server with auto-reload ```
``` mini-delivery/ βββ src/ # Frontend source β βββ components/ # Reusable components β βββ contexts/ # React contexts β βββ pages/ # Page components β βββ services/ # API & external services β βββ ... βββ server/ # Backend source β βββ routes/ # API routes β βββ middleware/ # Express middleware β βββ utils/ # Utilities β βββ ... βββ ... ```
- `POST /api/auth/register` - Register new user
- `POST /api/auth/login` - Login user
- `POST /api/auth/verify` - Verify JWT token
- `GET /api/orders` - Get user's orders
- `POST /api/orders` - Create new order
- `PUT /api/orders/:id/assign` - Assign order (admin)
- `PUT /api/orders/:id/status` - Update status (delivery)
- `GET /api/users/profile` - Get user profile
- `PUT /api/users/profile` - Update profile
- `GET /api/users/delivery-personnel` - Get delivery personnel (admin)
- `GET /api/users/stats` - Get user statistics
The app uses WebSocket connections for:
- Order Updates: Real-time status changes
- Notifications: Instant alerts for new orders/assignments
- Location Tracking: Live delivery personnel location
- Admin Monitoring: Real-time system overview
- Responsive Design: Works on all device sizes
- Modern Interface: Clean, intuitive design
- Real-time Updates: Live data without page refreshes
- Interactive Maps: Google Maps integration
- Toast Notifications: User-friendly feedback
- Loading States: Smooth user experience
- Error Handling: Graceful error management
- JWT Authentication: Secure token-based auth
- Password Hashing: bcrypt for password security
- Role-based Access: Different permissions per role
- CORS Protection: Configured cross-origin policies
- Input Validation: Server-side validation
Set production values for:
- `JWT_SECRET` - Strong, unique secret
- `NODE_ENV=production`
- `CLIENT_URL` - Your frontend domain
- API keys and database URLs
```bash
npm run build
npm start ```
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For issues and questions:
- Check the documentation
- Search existing issues
- Create a new issue with details
- Push notifications
- Advanced analytics dashboard
- Multi-language support
- Mobile app (React Native)
- Payment integration
- Advanced routing optimization
- Customer rating system
- Delivery cost calculation
Built with β€οΈ for efficient delivery management.