-
Notifications
You must be signed in to change notification settings - Fork 0
Home
- Overview
- Getting Started
- Configuration
- Running the Server
- Project Structure
- API Documentation
- Models
- Routes
- Controllers
- Middleware
- Utilities
- Environment Setup
- Branching Strategy
- Contribution Guidelines
The Nufacturing API is a Node.js-based backend service that provides various functionalities for managing the Nufacturing application, including customer management, order processing, inventory management, and more. This API uses MongoDB as its database and follows a RESTful architecture.
- Node.js (v14.x or higher)
- npm (v6.x or higher)
- MongoDB (v4.x or higher)
Clone the repository:
git clone https://github.com/yourusername/nufacturing-api.git
cd nufacturing-api
Install dependencies:
npm install
The API uses environment variables for configuration. Create a .env
file in the root directory with the following variables:
PORT=3000
MONGODB_URI=<your-mongodb-uri>
JWT_SECRET=<your-jwt-secret>
To start the server, run:
npm start
The server will start on the port defined in your .env
file. By default, it will run on http://localhost:3000
.
The project follows a modular structure with separate folders for models, controllers, routes, middleware, and utilities.
nufacturing-api/
├── .env
├── .gitignore
├── README.md
├── app.js
├── package.json
├── src/
│ ├── config/
│ │ ├── db.js
│ │ └── logger.js
│ ├── controllers/
│ │ ├── product-development-controller/
│ │ │ ├── formulaController.js
│ │ │ ├── productSkuController.js
│ │ │ └── productTypeController.js
│ │ ├── sales-controller/
│ │ │ ├── customerController.js
│ │ │ ├── orderController.js
│ │ │ └── quoteController.js
│ │ ├── authController.js
│ │ ├── inventoryController.js
│ │ └── userController.js
│ ├── middleware/
│ │ ├── authMiddleware.js
│ │ └── roleMiddleware.js
│ ├── models/
│ │ ├── product-development-model/
│ │ │ ├── formulasModel.js
│ │ │ ├── productSkuModel.js
│ │ │ └── productTypeModel.js
│ │ ├── sales-model/
│ │ │ ├── customerModel.js
│ │ │ ├── orderModel.js
│ │ │ └── quoteModel.js
│ │ ├── inventoryModel.js
│ │ └── userModel.js
│ ├── routes/
│ │ ├── product-development-routes/
│ │ │ ├── formulaRoutes.js
│ │ │ ├── productSkusRoutes.js
│ │ │ └── productTypeRoutes.js
│ │ ├── sales-routes/
│ │ │ ├── customerRoutes.js
│ │ │ ├── orderRoutes.js
│ │ │ └── quoteRoutes.js
│ │ ├── inventoryRoutes.js
│ │ └── userRoutes.js
│ ├── utils/
│ │ ├── scheduledTasks.js
│ │ └── sendEmail.js
└── swagger.js
Swagger documentation is available for the API. To view the documentation, start the server and navigate to http://localhost:3000/api-docs
.
Manages customer information.
Handles customer orders.
Manages quotes provided to customers.
Handles inventory items, including raw materials and finished products.
Defines different product types.
Manages product SKUs.
Routes are defined for different modules of the application, including product development, sales, inventory, and user management.
Controllers contain the logic for handling API requests and responses.
Middleware functions are used for authentication and role-based access control.
Utility functions include scheduled tasks and email sending functionality.
The Nufacturing API employs a multi-environment setup to facilitate streamlined development, testing, and deployment. The environments include Local, Development, Testing, Staging, and Production.
- Feature Branches: For new features or enhancements.
- Hotfix Branches: For urgent fixes.
- Staging Branch: For pre-production testing.
- Production Branch: For production deployment.
- Enforce Branch Naming Policies: Use Git hooks and GitHub Actions.
- Commit Message Pattern: Follow conventional commit standards.
- Pull Requests: Require pull requests for merging into development, staging, and production branches.
- Fork the repository.
- Create a new feature branch (
git checkout -b feature/NFG-<issue-number>-<short-description>
). - Commit your changes with descriptive messages.
- Push your branch (
git push origin feature/NFG-<issue-number>-<short-description>
). - Create a pull request.