A simple, secure and scalable API for managing customer orders — from creation to real-time status updates.
OrderHub is a RESTful API built with Node.js, Express, PostgreSQL, and Prisma ORM, following Object-Oriented Programming (OOP) principles. The system enables buyers and sellers to efficiently manage and track orders through a scalable, maintainable, and intuitive architecture.
- Receive Orders: Sellers can receive incoming orders from users.
- Update Order Status: Sellers can update order statuses through stages:
- Order Accepted
- In Production
- Out for Delivery
- Place Orders: Buyers can place new orders for items.
- Track Orders: Buyers can monitor the real-time status of their orders.
| Category | Technologies |
|---|---|
| API | Node.js, Express.js |
| Database | PostgreSQL, Prisma ORM |
| Validation | Zod |
| Authentication | JSON Web Tokens (JWT) |
| Testing | Vitest, Supertest |
| Containerization | Docker, Docker Compose |
Before running this project, make sure you have installed:
- Docker
- Docker Compose
- Node.js
- npm (comes with Node.js)
npm installdocker compose up -dThis will spin up the PostgreSQL container required by the app.
At the root of the project, create a .env file with the following content:
DATABASE_URL='postgresql://postgres:postgres@localhost:5432/orderhub_db'
JWT_SECRET='something_like_your_super_secret_key'
PORT=3333
Notes:
- Adjust the DATABASE_URL if your database credentials are different.
- PORT is optional if you don't set it, default value will be 3333
npx prisma migrate devThis will apply migrations and generate the Prisma Client.
npm run devYou can use Prisma Studio to visualize and manage your database easily:
npx prisma studioPrisma Studio will open a browser window where you can explore your tables and records.
Migration Issues:
If you encounter migration errors, you can reset the database:
npx prisma migrate reset| Endpoint | Description |
|---|---|
| /users | Create a new user |
| /sessions | Start a new user session |
| /deliveries | Deliveries control |
| /delivery-logs | Delivery logs control |
💡 Full API documentation coming soon!
Integrate Frontend with React: Implement a React frontend to make the project full-stack. This will involve creating an intuitive user interface where buyers can place and track orders, and sellers can manage and update order statuses.
Real-time Order Updates: Add WebSocket support for real-time order status updates, ensuring both buyers and sellers can see live updates on their orders.
User Notifications: Implement email or push notifications to inform users about the status of their orders, such as when an order is out for delivery or when there’s an issue with the order.
This project is open source and available under the MIT License.
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.