A comprehensive Express.js backend API for managing contacts, products, orders, staff, and more.
- Contacts Management: CRUD operations for contacts
- Products Management: Product catalog with admin controls
- Orders Management: Order processing and tracking
- Staff Management: Staff registration and authentication
- Ratings & Reviews: Product rating system
- Inventory Management: Stock tracking and management
- Sales Management: Sales tracking and reporting
- Reports: Analytics and reporting features
This project includes comprehensive Swagger/OpenAPI documentation that is automatically generated from the code.
-
Start the server:
npm run dev
-
Open your browser and navigate to:
http://localhost:3000/api-docs
To regenerate the Swagger documentation after making changes to routes:
npm run swaggerThis will update the Docs/swagger-output.json file with the latest API documentation.
All endpoints require Bearer token authentication. Include the token in the Authorization header:
Authorization: Bearer your-token-here
- Contacts:
/api/contacts - Products:
/api/products(Admin only) - Orders:
/api/orders - Staff:
/api/staffs - Ratings:
/api/ratings - Stock:
/api/stocks - Sales:
/api/sales - Reports:
/api/reports
- Clone the repository
- Install dependencies:
npm install
- Set up your environment variables
- Run the development server:
npm run dev
Create a .env file with the following variables:
PORT=3000
DATABASE_URL=your_database_connection_string
JWT_SECRET=your_jwt_secret
- Express.js: Web framework
- Prisma: Database ORM
- JWT: Authentication
- Swagger: API documentation
- bcrypt: Password hashing
- express-rate-limit: Rate limiting
- Fork the repository
- Create a feature branch
- Make your changes
- Add Swagger documentation for new endpoints
- Submit a pull request
ISC