A comprehensive Inventory Management System built with PERN Stack (PostgreSQL, Express, React, Node.js) that digitizes and streamlines all stock-related operations within a business.
- Product Management: Create, update, and manage products with SKU, categories, units of measure, and reorder levels
- Receipts (Incoming Stock): Manage incoming goods from suppliers with automatic stock updates
- Delivery Orders (Outgoing Stock): Handle outgoing stock for customer shipments
- Internal Transfers: Move stock between warehouses/locations within the company
- Stock Adjustments: Fix mismatches between recorded and physical stock counts
- Multi-Warehouse Support: Manage stock across multiple warehouse locations
- Stock Ledger: Complete movement history tracking for all inventory transactions
- Real-time KPIs (Total Products, Low Stock Items, Out of Stock Items, Pending Receipts/Deliveries/Transfers)
- Recent activities feed
- Low stock alerts
- Dynamic filters by warehouse, status, and document type
- User signup/login
- OTP-based password reset
- JWT token-based authentication
- Protected routes
- Node.js with Express.js
- PostgreSQL database
- JWT for authentication
- bcryptjs for password hashing
- nodemailer for OTP emails
- React 19 with React Router
- Tailwind CSS for styling
- Axios for API calls
- Vite for build tooling
- Node.js (v16 or higher)
- PostgreSQL database
- npm or yarn package manager
git clone <repository-url>
cd StockMastercd server
npm installCreate a .env file in the server directory:
DATABASE_URL=your_postgresql_connection_string
JWT_SECRET=your-secret-key-change-this-in-production
PORT=5000
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=[email protected]
SMTP_PASS=your-email-password
NODE_ENV=developmentStart the backend server:
npm run devThe server will run on http://localhost:5000
cd client
npm installCreate a .env file in the client directory (optional, as proxy is configured):
VITE_API_URL=http://localhost:5000/apiStart the frontend development server:
npm run devThe frontend will run on http://localhost:3000
The database tables will be automatically created when you first start the server. The initialization script creates:
- Users table
- Products table with categories
- Warehouses table
- Stock table (tracks stock per product per warehouse)
- Receipts and receipt items tables
- Deliveries and delivery items tables
- Transfers and transfer items tables
- Adjustments and adjustment items tables
- Stock ledger table (movement history)
A default warehouse and category will be created on first run.
- Sign Up: Create a new account at
/signup - Login: Access the dashboard after login
- Create Products: Navigate to Products and add your inventory items
- Set Up Warehouses: Go to Settings to add warehouse locations
- Manage Stock:
- Create receipts for incoming stock
- Create deliveries for outgoing stock
- Transfer stock between warehouses
- Adjust stock when physical counts differ
StockMaster/
├── server/
│ ├── config/
│ │ └── db.js # Database connection and initialization
│ ├── middleware/
│ │ └── auth.js # Authentication middleware
│ ├── routes/
│ │ ├── auth.js # Authentication routes
│ │ ├── products.js # Product routes
│ │ ├── warehouses.js # Warehouse routes
│ │ ├── receipts.js # Receipt routes
│ │ ├── deliveries.js # Delivery routes
│ │ ├── transfers.js # Transfer routes
│ │ ├── adjustments.js # Adjustment routes
│ │ ├── dashboard.js # Dashboard KPIs routes
│ │ └── history.js # Stock ledger routes
│ ├── index.js # Server entry point
│ └── package.json
├── client/
│ ├── src/
│ │ ├── components/ # Reusable components
│ │ ├── config/ # API configuration
│ │ ├── context/ # React context providers
│ │ ├── pages/ # Page components
│ │ ├── App.jsx # Main app component
│ │ └── main.jsx # Entry point
│ └── package.json
└── README.md
POST /api/auth/signup- User registrationPOST /api/auth/login- User loginPOST /api/auth/forgot-password- Request OTPPOST /api/auth/reset-password- Reset password with OTPGET /api/auth/me- Get current user
GET /api/products- Get all productsGET /api/products/:id- Get single productPOST /api/products- Create productPUT /api/products/:id- Update productDELETE /api/products/:id- Delete product
GET /api/warehouses- Get all warehousesPOST /api/warehouses- Create warehousePUT /api/warehouses/:id- Update warehouseDELETE /api/warehouses/:id- Delete warehouse
GET /api/receipts- Get all receiptsGET /api/receipts/:id- Get single receiptPOST /api/receipts- Create receiptPUT /api/receipts/:id- Update receiptDELETE /api/receipts/:id- Delete receipt
GET /api/deliveries- Get all deliveriesGET /api/deliveries/:id- Get single deliveryPOST /api/deliveries- Create deliveryPUT /api/deliveries/:id- Update deliveryDELETE /api/deliveries/:id- Delete delivery
GET /api/transfers- Get all transfersGET /api/transfers/:id- Get single transferPOST /api/transfers- Create transferPUT /api/transfers/:id- Update transferDELETE /api/transfers/:id- Delete transfer
GET /api/adjustments- Get all adjustmentsGET /api/adjustments/:id- Get single adjustmentPOST /api/adjustments- Create adjustmentPUT /api/adjustments/:id- Update adjustmentDELETE /api/adjustments/:id- Delete adjustment
GET /api/dashboard/kpis- Get dashboard KPIsGET /api/dashboard/recent-activities- Get recent activitiesGET /api/dashboard/low-stock- Get low stock products
GET /api/history/moves- Get stock movement history
- All API routes except
/api/auth/*require authentication via JWT token - Stock is automatically updated when receipts/deliveries/transfers/adjustments are marked as "done"
- The stock ledger logs all movements for audit purposes
- OTP emails require SMTP configuration in
.env
ISC