The Deliverify API powers the Deliverify delivery management ecosystem — handling authentication, deliveries, users, and roles.
It’s built with Node.js, Express.js, and MongoDB, with full JWT-based security and over 130 Jest test cases for reliability.
Before setting up this API, ensure you have the following installed:
- Node.js (v14 or higher)
- MongoDB (as the database)
- Postman (for testing the API)
- npm (Node Package Manager)
-
Clone this repository:
git clone https://github.com/Zaiidmo/deliverify-API.git cd deliverify-API -
Install the dependencies:
npm install
You need to set up environment variables in a .env file at the root of your project. Create a .env file based on the .env.example:
cp .env.example .envThen update the .env file with the needed variables
Start the development server:
node serverThe API will run on http://localhost:3000.
Documentation Please check the official API documentation to get to know all functionnalities and endpoints, on the following link Documentation
The Deliverify API uses JWT (JSON Web Tokens) for securing its endpoints.
-
Login to receive a JWT:
POST /auth/login
Use the JWT received in the response for all protected routes by including it in the
Authorizationheader:Authorization: Bearer <your_token> -
Token Verification is done automatically by middleware for protected routes.
The API has been tested using Jest. To run the test suites:
npm testTests include:
- Authentication tests.
- Role management tests.
- User and delivery operations.
- Error handling tests. Any many others of a count of 32 Test Suite, almost 132 tests
The API uses consistent error handling. Errors are returned with appropriate HTTP status codes and JSON response structure:
- 400 Bad Request: Returned when a request is malformed.
- 401 Unauthorized: Returned when authentication fails (e.g., missing or invalid JWT).
- 404 Not Found: Returned when a resource (e.g., user, order) is not found.
- 500 Internal Server Error: Returned when a server-side error occurs.
This project is licensed under the MIT License. See the LICENSE file for more details.