DLVR Logistics API is a backend system designed to manage dispatch riders and orders for a logistics service. It facilitates user authentication, rider management, and efficient order processing by automatically assigning the nearest available rider to new orders. Built with TypeScript, this API ensures a robust and scalable solution for managing deliveries.
- User authentication and authorization with roles (user, rider, admin)
- CRUD operations for users, riders, and orders
- Automatic assignment of nearest available rider for new orders
- Geospatial querying for efficient rider selection
- API documentation with Swagger
- TypeScript for improved developer experience and type safety
- Node.js (v14 or later)
- MongoDB: A MongoDB instance (cloud or local)
- pnpm: Package manager
-
Clone the repository:
git clone https://github.com/prudentbird-dev/dlvr.git cd dlvr-logistics-api
-
Install dependencies:
pnpm install
-
Set up environment variables: Create a
.env
file in the root directory with the following variables:PORT=3000 MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret
-
Run the server:
pnpm run dev
The server will be accessible at http://localhost:3000
src/
config/
: Contains configuration filescontrollers/
: Defines the logic for handling HTTP requestsmiddlewares/
: Contains middleware functionsmodels/
: Defines the data models for MongoDBroutes/
: API endpoint definitions and routingservices/
: Contains the core business logictypes/
: TypeScript types for strict type safetyutils/
: Contains utility functions and classesapp.ts
: The main entry point of the application
The API is documented using Swagger for easy reference. Once the server is running, you can access the API documentation at:
http://localhost:3000/api/docs
This will provide detailed information on each available endpoint, request parameters, and response formats.
We welcome contributions to improve the DLVR Logistics API! Please feel free to fork the repository and submit pull requests with improvements.
This project is licensed under the Apache License. See the LICENSE file for details.