A full-stack inventory management system built with Node.js/Express backend and React frontend, featuring role-based access control, real-time stock tracking, and comprehensive movement history.
- User Authentication: JWT-based login with role-based access (Manager/Staff)
- Inventory Management: Track products, categories, and stock levels
- Stock Operations: Record IN, OUT, TRANSFER, and ADJUSTMENT movements
- Real-time Monitoring: KPI dashboard with key metrics
- Audit Trail: Complete movement history with user tracking
- Responsive UI: Modern, mobile-friendly interface with Tailwind CSS
odoo-hackathon-K-main/
├── backend/
│ ├── server.js # Main Express server
│ ├── package.json # Backend dependencies
│ ├── .env # Environment variables
│ ├── schema.sql # Database schema
│ ├── config/
│ │ └── db.js # MySQL database configuration
│ ├── middleware/
│ │ ├── authMiddleware.js # JWT authentication
│ │ └── roleMiddleware.js # Role-based authorization
│ └── routes/
│ ├── authRoutes.js # User registration/login
│ ├── productRoutes.js # Product CRUD operations
│ └── inventoryRoutes.js # Stock movement operations
│
├── frontend/
│ ├── index.html # HTML entry point
│ ├── package.json # Frontend dependencies
│ ├── vite.config.js # Vite configuration
│ ├── src/
│ │ ├── main.jsx # React entry point
│ │ ├── App.jsx # Main App component
│ │ ├── index.css # Global styles with Tailwind
│ │ ├── components/
│ │ │ ├── Layout.jsx # Protected layout wrapper
│ │ │ ├── Sidebar.jsx # Navigation sidebar
│ │ │ ├── KPICard.jsx # Dashboard metric cards
│ │ │ └── Table.jsx # Reusable table component
│ │ ├── pages/
│ │ │ ├── Login.jsx # Login page
│ │ │ ├── Dashboard.jsx # Overview dashboard
│ │ │ ├── Inventory.jsx # Product inventory view
│ │ │ ├── Operations.jsx # Stock movement form
│ │ │ └── History.jsx # Movement audit trail
│ │ ├── context/
│ │ │ └── AuthContext.jsx # Auth state management
│ │ └── utils/
│ │ └── axiosObs.js # API client with auth token
│ └── public/ # Static assets
│
└── README.md # Project documentation
- Express.js: Web framework
- MySQL2/Promise: Database with async support
- bcryptjs: Password hashing
- jsonwebtoken: JWT authentication
- cors: Cross-origin resource sharing
- dotenv: Environment variable management
- React 18: UI library
- React Router v6: Navigation
- Axios: HTTP client
- Tailwind CSS: Utility-first CSS framework
- Lucide React: Icon library
- Vite: Build tool & dev server
- Node.js (v16+)
- MySQL Server (v5.7+)
- npm or yarn
- Navigate to backend directory
cd backend- Install dependencies
npm install- Setup environment variables
Create
.envfile with:
DB_HOST=localhost
DB_USER=root
DB_PASS=your_password
DB_NAME=stockmaster
JWT_SECRET=your_secret_key_change_in_production
PORT=5000
- Initialize database
mysql -u root -p < schema.sql- Start backend server
npm start # Production mode
npm run dev # Development mode with nodemonServer will run on http://localhost:5000
- Navigate to frontend directory
cd frontend- Install dependencies
npm install- Start development server
npm run devApplication will open on http://localhost:5173
POST /api/auth/register- Register new userPOST /api/auth/login- Login and get JWT token
GET /api/products- List all products (requires auth)POST /api/products- Create product (manager only)
POST /api/inventory/move- Record stock movementGET /api/inventory/history- Get movement history
Manager Account:
- Email:
manager@test.com - Password:
password123
Staff Account:
- Email:
staff@test.com - Password:
password123
- users: User accounts with roles
- categories: Product categories
- products: Product master data
- locations: Storage locations/warehouses
- stock_levels: Current inventory at each location
- movements: Complete audit trail of all stock movements
- Real-time KPI metrics
- Total products count
- Total stock quantity
- Low stock alerts
- Recent movements summary
- View all products with current stock levels
- Create new products (Manager only)
- Search and filter products
- Stock level indicators
- IN: Receive stock from vendors
- OUT: Deliver stock to customers
- TRANSFER: Move stock between locations
- ADJUSTMENT: Correct stock discrepancies
- Complete movement ledger
- User tracking for accountability
- Movement type indicators
- Location-to-location tracking
- Timestamp and reference tracking
- JWT-based stateless authentication
- Password hashing with bcryptjs
- Role-based authorization
- CORS protection
- HTTP-only token storage (recommended)
- SQL injection prevention with prepared statements
- Comprehensive error messages
- Input validation
- Transaction rollback on database errors
- User-friendly error notifications
- MySQL connection pooling
- Indexed database queries
- Memoized API calls
- Lazy loading of routes
- Efficient state management
Error: connect ECONNREFUSED
- Ensure MySQL is running
- Verify DB credentials in
.env - Check database exists
- Verify backend is running on port 5000
- Check CORS configuration in
server.js
- Clear localStorage and login again
- JWT expires in 24 hours by default
- Advanced analytics and reporting
- Barcode/QR code scanning
- Multi-warehouse support
- Supplier management
- Email notifications
- Mobile app
- Real-time notifications via WebSocket
ISC License
For issues and questions, please check the documentation or contact the development team.
Version: 1.0.0
Last Updated: January 2026