A modern, full-featured inventory management system built with React, Node.js, and PostgreSQL
Features β’ Tech Stack β’ Getting Started β’ Documentation β’ Contact
- Overview
- Features
- Tech Stack
- Architecture
- Getting Started
- API Documentation
- Features Deep Dive
- Deployment
- Author
StockPilot is a comprehensive, enterprise-grade inventory management system designed to streamline business operations for retailers, wholesalers, and manufacturers. The system provides real-time inventory tracking, sales management, purchase order processing, customer relationship management, and powerful analyticsβall in one unified platform.
- Complete Business Solution: Manage products, sales, purchases, customers, and suppliers in one place
- Real-time Analytics: Get instant insights into your business performance with interactive dashboards
- Multi-user Support: Role-based access control for different user types (Admin, Manager, Staff)
- Modern UI/UX: Beautiful, responsive interface built with the latest web technologies
- Scalable Architecture: Built to handle growing businesses with efficient database design
- API-First Design: RESTful API with comprehensive Swagger documentation
- Real-time Business Metrics: Track sales, purchases, revenue, and profit in real-time
- Interactive Charts: Visualize trends with Chart.js and Recharts
- Low Stock Alerts: Automatic notifications for products below reorder level
- Performance Reports: Comprehensive sales and purchase reports with date range filtering
- Top Products Analysis: Identify best-selling and slow-moving inventory
- Point of Sale (POS): Fast and intuitive sales interface
- Invoice Generation: Automatic invoice creation with PDF export
- Payment Tracking: Multiple payment methods support
- Sales History: Complete transaction history with search and filters
- Customer Assignment: Link sales to customer accounts for better CRM
- Product Catalog: Comprehensive product management with categories
- Stock Tracking: Real-time inventory levels across all locations
- Barcode Support: Quick product lookup and scanning
- Bulk Operations: Import/export products via CSV
- Image Management: Upload and manage product images
- Product Variants: Support for different sizes, colors, and variants
- Reorder Alerts: Automatic low-stock notifications
- Purchase Orders: Create and track purchase orders
- Supplier Management: Maintain supplier database with contact information
- Cost Tracking: Monitor purchase costs and profit margins
- Purchase History: Complete record of all purchases
- Supplier Performance: Track supplier reliability and pricing
- Customer Database: Store customer information and purchase history
- Supplier Directory: Manage supplier contacts and terms
- Credit Management: Track customer credit limits and balances
- Contact History: Maintain communication logs
- Loyalty Programs: Support for customer loyalty and rewards
- Sales Reports: Daily, weekly, monthly, and custom date range reports
- Purchase Reports: Analyze purchase patterns and costs
- Profit Analysis: Calculate and track profit margins
- Inventory Reports: Stock levels, movement, and valuation
- Export Options: PDF and Excel export for all reports
- Role-Based Access Control (RBAC): Admin, Manager, and Staff roles
- User Permissions: Granular control over feature access
- Authentication: Secure JWT-based authentication
- Password Management: Secure password hashing with bcrypt
- Account Lockout: Protection against brute force attacks
- Activity Logging: Track user actions and system events
- Responsive Design: Works seamlessly on desktop, tablet, and mobile
- Dark/Light Theme: User-preferred theme with system detection
- Modern UI Components: Built with Ant Design and custom components
- Real-time Notifications: Toast notifications and notification center
- Keyboard Shortcuts: Power user features for faster operations
- Print Support: Print-optimized layouts for invoices and reports
- Real-time Alerts: WebSocket-based instant notifications
- Email Notifications: Automated email alerts for important events
- Low Stock Warnings: Automatic alerts when inventory runs low
- User Mentions: Notify users when mentioned in notes or comments
- Business Profile: Configure company information and branding
- Logo Upload: Custom logo for invoices and reports
- Currency Settings: Multi-currency support
- Tax Configuration: Flexible tax rate settings
- Receipt Customization: Customize invoice and receipt templates
| Technology | Version | Purpose |
|---|---|---|
| React | 19.1.0 | UI Library |
| Redux Toolkit | 2.8.2 | State Management |
| React Router | 7.6.2 | Client-side Routing |
| Vite | 6.3.5 | Build Tool & Dev Server |
| Ant Design | 5.27.4 | UI Component Library |
| Tailwind CSS | 3.4.17 | Utility-first CSS Framework |
| Chart.js | 4.4.9 | Data Visualization |
| Recharts | 2.15.4 | React Chart Library |
| Axios | 1.9.0 | HTTP Client |
| React Query | 5.80.2 | Data Fetching & Caching |
| jsPDF | 3.0.1 | PDF Generation |
| ExcelJS | 4.4.0 | Excel Export |
| Socket.io Client | 4.8.1 | Real-time Communication |
| Technology | Version | Purpose |
|---|---|---|
| Node.js | 18+ | Runtime Environment |
| Express.js | 5.1.0 | Web Framework |
| Prisma | 6.13.0 | ORM & Database Toolkit |
| PostgreSQL | Latest | Relational Database |
| JWT | 9.0.2 | Authentication |
| Bcrypt | 6.0.0 | Password Hashing |
| Joi | 17.13.3 | Data Validation |
| Multer | 2.0.1 | File Upload Handling |
| Winston | 3.17.0 | Logging |
| Swagger | Latest | API Documentation |
| Nodemailer | 6.10.1 | Email Service |
| Redis | 5.8.2 | Caching & Session Store |
| Express Rate Limit | 8.1.0 | API Rate Limiting |
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 15.2.4 | React Framework |
| TypeScript | 5+ | Type Safety |
| Tailwind CSS | 3.4.17 | Styling |
| Radix UI | Latest | Headless UI Components |
| shadcn/ui | Latest | UI Component Library |
| Framer Motion | 11.0.0 | Animation Library |
| Lucide React | Latest | Icon Library |
| Next Themes | Latest | Theme Management |
| Formspree | 2.5.1 | Form Handling |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β StockPilot System β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββ β
β β Landing β β Frontend β β Backend β β
β β Page β β (React) ββββββββ (Node.js)β β
β β (Next.js) β β SPA β API β API β β
β ββββββββββββββββ ββββββββββββββββ βββββββ¬ββββββ β
β β β
β ββββββββ΄ββββββ β
β β PostgreSQL β β
β β Database β β
β ββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The backend follows a layered architecture pattern:
βββββββββββββββββββββββββββββββββββββββββββββββ
β Routes Layer β β HTTP Endpoints
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Middleware Layer β β Auth, Validation, Rate Limiting
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Controllers Layer β β Request/Response Handling
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Services Layer β β Business Logic
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Repositories Layer β β Data Access
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Database Layer (Prisma) β β ORM
βββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββ
β Redux Store (Global State) β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ Auth State β’ Products State β
β β’ User State β’ Sales State β
β β’ Settings State β’ Purchase State β
β β’ UI State β’ Reports State β
βββββββββββββββββββββββββββββββββββββββββββββββ
Before you begin, ensure you have the following installed:
- Node.js v18 or higher (Download)
- PostgreSQL v14 or higher (Download)
- npm or yarn package manager (comes with Node.js)
- Git (Download)
Optional but recommended:
- Redis for caching and session management
- Docker for containerized deployment
git clone https://github.com/zacktam12/StockPilot.git
cd StockPilot# Navigate to backend directory
cd backend
# Install dependencies
npm install
# Create .env file
cp .env.example .envConfigure your .env file with the following variables:
# Database Configuration
DATABASE_URL="postgresql://username:password@localhost:5432/stockpilot"
# JWT Configuration
JWT_SECRET="your-super-secret-jwt-key-change-this-in-production"
JWT_EXPIRE="7d"
# Server Configuration
PORT=5000
NODE_ENV=development
# Email Configuration (optional)
EMAIL_HOST="smtp.gmail.com"
EMAIL_PORT=587
EMAIL_USER="[email protected]"
EMAIL_PASSWORD="your-app-password"
# Redis Configuration (optional)
REDIS_URL="redis://localhost:6379"
# File Upload Configuration
MAX_FILE_SIZE=5242880
UPLOAD_DIR="uploads"
# CORS Configuration
CORS_ORIGIN="http://localhost:5173"
# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100# Generate Prisma Client
npx prisma generate
# Run database migrations
npx prisma migrate deploy
# Seed the database with initial data (optional)
npx prisma db seed# Navigate to frontend directory
cd ../frontend
# Install dependencies
npm install
# Create .env file
cp .env.example .envConfigure your frontend .env file:
VITE_API_URL=http://localhost:5000/api
VITE_APP_NAME=StockPilot
VITE_SOCKET_URL=http://localhost:5000# Navigate to landing page directory
cd ../stockLandingPage
# Install dependencies
npm installprisma/schema.prisma: Database schema definitionsrc/config/db.js: Database connection configurationsrc/config/jwt.js: JWT token configurationsrc/docs/swagger.js: API documentation configuration
vite.config.js: Vite build configurationtailwind.config.js: Tailwind CSS configurationsrc/config.js: Application-wide configuration
Terminal 1 - Backend:
cd backend
npm run devBackend will run on http://localhost:5000
Terminal 2 - Frontend:
cd frontend
npm run devFrontend will run on http://localhost:5173
Terminal 3 - Landing Page (Optional):
cd stockLandingPage
npm run devLanding page will run on http://localhost:3000
Backend:
cd backend
npm startFrontend:
cd frontend
npm run build
npm run previewLanding Page:
cd stockLandingPage
npm run build
npm startAfter seeding the database, you can login with:
- Email: [email protected]
- Password: admin123
The backend API is fully documented using Swagger/OpenAPI specification. Once the backend is running, you can access the interactive API documentation at:
http://localhost:5000/api-docs
Production: https://your-domain.com/api
Development: http://localhost:5000/api
All protected endpoints require a JWT token in the Authorization header:
Authorization: Bearer <your-jwt-token>
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/login |
User login |
| POST | /api/auth/register |
User registration |
| POST | /api/auth/refresh |
Refresh JWT token |
| POST | /api/auth/forgot-password |
Request password reset |
| POST | /api/auth/reset-password |
Reset password |
| GET | /api/auth/profile |
Get current user profile |
| PUT | /api/auth/profile |
Update user profile |
| GET | /api/users |
Get all users (Admin) |
| POST | /api/users |
Create user (Admin) |
| PUT | /api/users/:id |
Update user (Admin) |
| DELETE | /api/users/:id |
Delete user (Admin) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/products |
Get all products |
| GET | /api/products/:id |
Get product by ID |
| POST | /api/products |
Create product |
| PUT | /api/products/:id |
Update product |
| DELETE | /api/products/:id |
Delete product |
| POST | /api/products/bulk-import |
Import products via CSV |
| GET | /api/products/low-stock |
Get low stock products |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/sales |
Get all sales |
| GET | /api/sales/:id |
Get sale by ID |
| POST | /api/sales |
Create sale |
| PUT | /api/sales/:id |
Update sale |
| DELETE | /api/sales/:id |
Delete sale |
| GET | /api/sales/:id/invoice |
Generate invoice PDF |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/purchases |
Get all purchases |
| GET | /api/purchases/:id |
Get purchase by ID |
| POST | /api/purchases |
Create purchase |
| PUT | /api/purchases/:id |
Update purchase |
| DELETE | /api/purchases/:id |
Delete purchase |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/customers |
Get all customers |
| GET | /api/customers/:id |
Get customer by ID |
| POST | /api/customers |
Create customer |
| PUT | /api/customers/:id |
Update customer |
| DELETE | /api/customers/:id |
Delete customer |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/suppliers |
Get all suppliers |
| GET | /api/suppliers/:id |
Get supplier by ID |
| POST | /api/suppliers |
Create supplier |
| PUT | /api/suppliers/:id |
Update supplier |
| DELETE | /api/suppliers/:id |
Delete supplier |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/categories |
Get all categories |
| GET | /api/categories/:id |
Get category by ID |
| POST | /api/categories |
Create category |
| PUT | /api/categories/:id |
Update category |
| DELETE | /api/categories/:id |
Delete category |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/dashboard/stats |
Get dashboard statistics |
| GET | /api/dashboard/recent-sales |
Get recent sales |
| GET | /api/dashboard/top-products |
Get top-selling products |
| GET | /api/dashboard/low-stock |
Get low stock alerts |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/reports/sales |
Get sales report |
| GET | /api/reports/purchases |
Get purchases report |
| GET | /api/reports/profit |
Get profit analysis |
| GET | /api/reports/inventory |
Get inventory report |
| POST | /api/reports/export |
Export report (PDF/Excel) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/settings |
Get system settings |
| PUT | /api/settings |
Update settings |
| POST | /api/settings/logo |
Upload company logo |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/notifications |
Get user notifications |
| PUT | /api/notifications/:id/read |
Mark notification as read |
| DELETE | /api/notifications/:id |
Delete notification |
{
"success": true,
"data": {
// Response data
},
"message": "Operation successful"
}{
"success": false,
"error": "Error message",
"details": {
// Additional error details
}
}List endpoints support pagination with the following query parameters:
GET /api/products?page=1&limit=10&search=laptop&sortBy=createdAt&sortOrder=desc
Parameters:
page: Page number (default: 1)limit: Items per page (default: 10)search: Search querysortBy: Field to sort bysortOrder: Sort order (asc/desc)
The system implements a comprehensive RBAC system with three main roles:
- Full system access
- User management
- System settings configuration
- All CRUD operations
- Report generation and export
- Database backup and restore
- Product management
- Sales and purchase operations
- Customer and supplier management
- Report viewing
- Limited user management (view only)
- Sales operations (POS)
- View products and prices
- Basic customer operations
- Limited reporting
The application uses WebSockets (Socket.io) for real-time features:
- Live Notifications: Instant alerts for low stock, new orders, etc.
- Multi-user Updates: See changes made by other users in real-time
- Dashboard Updates: Automatic dashboard refresh with new data
- PDF: Invoices, receipts, reports
- Excel: Product catalogs, sales data, purchase records
- CSV: Bulk data export for analytics
- CSV Import: Bulk product import with validation
- Template Download: Pre-formatted CSV templates
- Error Handling: Detailed error messages for import failures
Advanced search and filtering capabilities:
- Full-text Search: Search across product names, SKUs, descriptions
- Multi-field Filtering: Filter by category, price range, stock level
- Date Range: Filter sales/purchases by date range
- Status Filtering: Filter by order status, payment status
Sophisticated inventory management:
- Real-time Stock Updates: Automatic stock adjustment on sales/purchases
- Stock Movement History: Complete audit trail of stock changes
- Multi-location Support: Track inventory across multiple warehouses
- Reorder Point Alerts: Automatic notifications when stock hits reorder level
- FIFO/LIFO Support: Flexible inventory valuation methods
cd backend
npm install --production
npx prisma generate
npx prisma migrate deploy
npm startcd frontend
npm install
npm run buildThe built files will be in the frontend/dist directory.
cd stockLandingPage
npm install
npm run build
npm start-
Backend + Database:
- Render.com
- Railway.app
- Heroku
- AWS Elastic Beanstalk
- DigitalOcean App Platform
-
Frontend:
- Vercel
- Netlify
- Cloudflare Pages
- AWS S3 + CloudFront
-
Landing Page:
- Vercel (recommended for Next.js)
- Netlify
- AWS Amplify
DATABASE_URL=
JWT_SECRET=
PORT=
NODE_ENV=production
CORS_ORIGIN=VITE_API_URL=
VITE_APP_NAME=The project includes render.yaml configuration for easy deployment to Render:
# Push to GitHub
git push origin main
# Connect repository to Render
# Render will automatically deploy using render.yamlCreate a docker-compose.yml:
version: '3.8'
services:
postgres:
image: postgres:14
environment:
POSTGRES_DB: stockpilot
POSTGRES_USER: stockpilot
POSTGRES_PASSWORD: yourpassword
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
backend:
build: ./backend
ports:
- "5000:5000"
environment:
DATABASE_URL: postgresql://stockpilot:yourpassword@postgres:5432/stockpilot
JWT_SECRET: your-jwt-secret
depends_on:
- postgres
frontend:
build: ./frontend
ports:
- "80:80"
depends_on:
- backend
volumes:
postgres_data:Run with:
docker-compose up -dZekarias Tamiru
- GitHub: @zacktam12
- LinkedIn: Zekarias Tamiru
- Email: [email protected]
- React - UI Library
- Node.js - Runtime Environment
- PostgreSQL - Database
- Prisma - Database ORM
- Next.js - React Framework
- Ant Design - UI Components
- Tailwind CSS - CSS Framework
- shadcn/ui - UI Components
- Chart.js - Charts Library
- Documentation: Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [email protected]
- Mobile app (React Native)
- Advanced analytics with ML predictions
- Multi-warehouse management
- Barcode scanning (mobile)
- Integration with e-commerce platforms
- Supplier portal
- Customer portal
- Advanced reporting dashboard
- Automated reordering
- Multi-currency support
- Multi-language support
- Offline mode support
- Advanced inventory tracking (serial numbers, batches)
- Performance optimizations
- Enhanced security features
- Better mobile responsiveness
- Export templates customization
- Bulk operations improvements
Made with β€οΈ by Zekarias Tamiru
β Star us on GitHub if you find this project useful!
