GMS App is a comprehensive Ginning Management System designed to streamline cotton ginning business operations. It provides a complete solution for managing products, clients, vendors, invoicing, and order tracking.
π Live Preview: https://gms-apk.vercel.app/
- Features
- How It Works
- Tech Stack
- System Architecture
- Installation
- Environment Variables
- API Endpoints
- Screenshots
- Contributing
- License
- Real-time overview of business metrics
- Track revenue, expenses, sales, and purchases
- Monitor total clients, vendors, and products
- Visual representation of business performance
- Create and manage cotton products with detailed pricing
- Support for multiple processing stages:
- Cleaning Price - Cotton cleaning charges
- Granding Price - Grading service charges
- Chrai Price - Processing fees
- Pinjai Price - Ginning charges
- Filling Price - Filling service charges
- Stitching Price - Packaging charges
- Stock quantity tracking
- Automatic total price calculation
- Update and delete products
- Complete client database with contact information
- Store client details: Name, Father's Name, Contact, CNIC
- Client profile pages with invoice history
- Auto-fill client information when creating invoices
- View all client transactions in one place
- Maintain vendor database for raw material purchases
- Track vendor information and contact details
- Vendor profile pages with purchase history
- Manage vendor invoices and payments
- Create detailed invoices for client orders
- Automatic invoice ID generation (7-digit unique ID)
- Barcode generation for each invoice (Code128 format)
- Track multiple order details:
- Customer information
- Product/Item name
- Item weight
- Process-wise pricing breakdown
- Total price calculation
- Invoice status tracking:
- Ordered - New order received
- Working - Order in processing
- Packed - Order ready for delivery
- Delivered - Order completed
- Print-friendly invoice view
- Update and delete invoices
- Record purchases from vendors
- Track product purchases with quantity and pricing
- Calculate total purchase costs
- Maintain complete purchase history
- Price per unit tracking
- Real-time order status monitoring
- Track all client orders in one place
- Filter and search orders
- Visual status indicators
- Quick access to order details
- Quick search functionality across all modules
- Filter invoices by client/vendor
- Auto-complete for client/vendor details
- Intelligent data matching
First, set up your products with their processing prices:
1. Navigate to Products page
2. Click "Add Product"
3. Enter product name and pricing for each process stage
4. System automatically calculates total price
5. Product is now available for invoicing
Register your clients and vendors:
1. Go to Clients or Vendors page
2. Click "Add Client/Vendor"
3. Fill in details (Name, Father's Name, Contact, CNIC)
4. Save to database
5. Profile is created with dedicated history page
Generate invoices for client orders:
1. Navigate to Invoices page (Sell Tab)
2. Click "Create Invoice"
3. Enter or auto-fill client details (search by contact)
4. Select product from dropdown
5. Enter item weight and cutting weight
6. System calculates remaining weight
7. Select applicable processes (cleaning, granding, etc.)
8. System auto-calculates total price
9. Submit invoice
10. Unique 7-digit ID and barcode are generated
11. Invoice status set to "Ordered"
Record purchases from vendors:
1. Navigate to Invoices page (Buy Tab)
2. Click "Create Purchase Invoice"
3. Enter or auto-fill vendor details
4. Enter product name, quantity, and price per unit
5. System calculates total purchase cost
6. Submit to record purchase
Monitor order status in real-time:
1. Go to Tracking page
2. View all client orders with current status
3. Click on any order to view details
4. Update status as order progresses
5. Mark as Delivered when completed
View and manage all invoices:
1. Click on any invoice card
2. View detailed invoice with barcode
3. Print invoice for client
4. Update order status
5. Delete if needed
Access complete client/vendor history:
1. Click "Profile" button on any client/vendor card
2. View personal information
3. See complete invoice/purchase history
4. Filter transactions by date or status
5. Access individual invoice details
- Node.js - JavaScript runtime
- Express.js - Web application framework
- MongoDB - NoSQL database
- Mongoose - MongoDB object modeling
- EJS - Templating engine
- Tailwind CSS - Utility-first CSS framework
- Vanilla JavaScript - Client-side scripting
- Helmet - HTTP security headers
- CORS - Cross-origin resource sharing
- Express Rate Limit - API rate limiting
- Morgan - HTTP request logger
- DOMPurify - XSS protection
- bwip-js - Barcode generation (Code128)
- QRCode - QR code generation
- dotenv - Environment variable management
- rotating-file-stream - Log rotation
- Nodemon - Auto-restart on file changes
- PostCSS & Autoprefixer - CSS processing
GMS-App/
β
βββ app.js # Application entry point
βββ config/
β βββ db.config.js # MongoDB connection setup
β
βββ models/ # Mongoose schemas
β βββ product.model.js # Product schema with pricing
β βββ client.model.js # Client information schema
β βββ vendor.model.js # Vendor information schema
β βββ client-invoice.model.js # Client order/invoice schema
β βββ vendor-invoice.model.js # Vendor purchase schema
β
βββ controllers/ # Business logic
β βββ product.controller.js # Product CRUD operations
β βββ client.controller.js # Client management
β βββ vendor.controller.js # Vendor management
β βββ client-invoice.controller.js # Client invoice operations
β βββ vendor-invoice.controller.js # Vendor invoice operations
β
βββ routes/ # API routes
β βββ product.route.js # Product endpoints
β βββ client.route.js # Client endpoints
β βββ vendor.route.js # Vendor endpoints
β βββ client-invoice.route.js # Client invoice endpoints
β βββ vendor-invoice.route.js # Vendor invoice endpoints
β
βββ middlewares/ # Custom middleware
β βββ errorHandler.middleware.js # Error handling
β βββ logger.middleware.js # Request logging
β
βββ services/
β βββ ApiError.service.js # Custom error handling
β
βββ public/ # Static assets
β βββ javascripts/ # Client-side JS
β βββ icons/ # SVG icons
β
βββ views/ # EJS templates
βββ index.ejs # Dashboard
βββ product.ejs # Products page
βββ client.ejs # Clients page
βββ vendor.ejs # Vendors page
βββ invoice.ejs # Invoices page
βββ tracking.ejs # Order tracking page
- Client Request β Express Server
- Route Handler β Validates request
- Controller β Business logic execution
- Model β Database interaction (MongoDB)
- Response β JSON data or rendered view
- Client Update β Real-time UI updates
- Node.js (v18 or higher)
- MongoDB (local or cloud instance)
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/yourusername/gms-apk.git cd gms-apk -
Install dependencies
npm install
-
Set up environment variables Create a
.envfile in the root directory:PORT=8000 MONGODB_URI=your_mongodb_connection_string NODE_ENV=development
-
Build Tailwind CSS
npm run build
-
Start the development server
npm start
-
Access the application Open your browser and navigate to:
http://localhost:8000
For production deployment:
NODE_ENV=production npm startCreate a .env file with the following variables:
# Server Configuration
PORT=8000
NODE_ENV=development
# Database Configuration
MONGODB_URI=mongodb://localhost:27017/gms-app
# Or for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:[email protected]/gms-app
# Application Settings
SESSION_SECRET=your_secret_key_hereGET /api/products- Get all productsGET /api/products/:id- Get product by IDPOST /api/products- Create new productPUT /api/products/:id- Update productDELETE /api/products/:id- Delete product
GET /api/clients- Get all clientsGET /api/clients/:id- Get client by IDPOST /api/clients- Create new clientPUT /api/clients/:id- Update clientDELETE /api/clients/:id- Delete client
GET /api/vendors- Get all vendorsGET /api/vendors/:id- Get vendor by IDPOST /api/vendors- Create new vendorPUT /api/vendors/:id- Update vendorDELETE /api/vendors/:id- Delete vendor
GET /api/client-invoices- Get all client invoicesGET /api/client-invoices/:id- Get invoice by IDGET /api/client-invoices?client=:clientId- Get invoices by clientPOST /api/client-invoices- Create new invoicePUT /api/client-invoices/:id- Update invoiceDELETE /api/client-invoices/:id- Delete invoice
GET /api/vendor-invoices- Get all vendor invoicesGET /api/vendor-invoices/:id- Get invoice by IDGET /api/vendor-invoices?vendor=:vendorId- Get invoices by vendorPOST /api/vendor-invoices- Create new invoicePUT /api/vendor-invoices/:id- Update invoiceDELETE /api/vendor-invoices/:id- Delete invoice
All API endpoints return data in the following format:
{
"success": true,
"message": "Operation successful",
"data": { ... }
}Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow existing code style and conventions
- Write meaningful commit messages
- Test your changes thoroughly
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
Developed with β€οΈ for the cotton ginning industry
If you encounter any bugs or have feature requests, please:
- Check existing issues
- Create a new issue with detailed description
- Include steps to reproduce (for bugs)
- Add screenshots if applicable
For support and questions:
- Create an issue in the repository
- Visit the live demo to see the app in action
- Built with modern web technologies
- Designed for efficiency and ease of use
- Tailored for cotton ginning business operations
β Star this repository if you find it helpful!


