A comprehensive full-stack ERP system built with Node.js, Express.js, React, and MySQL for managing warehouse and hardware store operations.
- Authentication & Authorization: JWT-based authentication with role-based permissions
- Database Management: Prisma ORM with MySQL database
- RESTful API: Complete CRUD operations for all entities
- Stock Management: Real-time stock tracking, transfers, and movements
- Sales & Purchases: Complete sales and purchase order management
- Payment Processing: Multi-method payment handling with partial payments
- Reports & Analytics: Comprehensive reporting with Excel export
- Backup & Restore: Database backup and restore functionality
- Security: Rate limiting, CORS, helmet security headers
- Modern UI: React with TailwindCSS for responsive design
- State Management: React Query for server state management
- Navigation: React Router with protected routes
- Dashboard: Real-time KPIs and analytics
- Stock Management: Visual stock levels and transfer interface
- Sales Interface: Intuitive sales processing with payment handling
- Reports: Interactive reports with filtering and export
- Backup Management: File upload and download for database backups
- Runtime: Node.js
- Framework: Express.js
- Database: MySQL with Prisma ORM
- Authentication: JWT with bcrypt password hashing
- Validation: Express-validator
- Security: Helmet, CORS, Rate limiting
- File Processing: Multer for file uploads
- Excel Export: XLSX library
- Framework: React 18
- Build Tool: Vite
- Styling: TailwindCSS
- State Management: TanStack Query (React Query)
- Routing: React Router v6
- HTTP Client: Axios
- Icons: Lucide React
- Users & Roles: Role-based access control
- Products & Categories: Product catalog management
- Shops: Multi-location support
- Stock Management: Real-time inventory tracking
- Sales & Purchases: Transaction management
- Customers & Suppliers: Business relationship management
- Payments: Payment tracking and management
- Settings: System configuration
- Node.js (v18 or higher)
- MySQL (v8 or higher)
- npm or yarn
-
Navigate to backend directory:
cd backend -
Install dependencies:
npm install
-
Configure environment variables: Create
.envfile in backend directory:DATABASE_URL="mysql://root:@localhost:3306/erp" JWT_SECRET="your_super_secret_jwt_key_change_in_production" NODE_ENV="development" PORT=3001
-
Set up database:
# Generate Prisma client npx prisma generate # Run database migrations npx prisma migrate dev --name init # Seed the database npm run db:seed
-
Start the backend server:
npm run dev
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Access the application: Open http://localhost:3000 in your browser
- Email: admin@erp.com
- Password: admin123
POST /api/auth/login- User loginPOST /api/auth/register- User registrationPOST /api/auth/refresh- Refresh JWT token
GET /api/products- Get all productsPOST /api/products- Create productPUT /api/products/:id- Update productDELETE /api/products/:id- Delete product
GET /api/stock/levels- Get stock levelsGET /api/stock/movements- Get stock movementsPOST /api/stock/movements- Create stock movementPOST /api/stock/transfer- Transfer stock between shopsGET /api/stock/low-stock- Get low stock items
GET /api/sales- Get all salesPOST /api/sales- Create saleGET /api/sales/:id- Get sale by IDPOST /api/sales/:id/payments- Add payment to saleGET /api/sales/unpaid/invoices- Get unpaid invoices
GET /api/reports/sales- Sales reportGET /api/reports/stock- Stock reportGET /api/reports/purchases- Purchases reportGET /api/reports/unpaid-invoices- Unpaid invoices reportGET /api/reports/dashboard- Dashboard KPIs
POST /api/backup/create- Create database backupGET /api/backup/list- List available backupsGET /api/backup/download/:filename- Download backupPOST /api/backup/restore- Restore from backupDELETE /api/backup/:filename- Delete backup
- Real-time Tracking: Stock levels update automatically with sales and purchases
- Multi-location Support: Manage inventory across multiple shops
- Stock Transfers: Transfer products between locations
- Low Stock Alerts: Automatic notifications for items running low
- Stock Movements: Complete audit trail of all inventory changes
- Flexible Payments: Support for cash, card, bank transfer, and check payments
- Partial Payments: Handle partial payments for large orders
- Invoice Management: Track paid and unpaid invoices
- Customer Management: Complete customer database with contact information
- Dashboard KPIs: Real-time metrics including sales, stock value, and unpaid invoices
- Export Functionality: Export reports to Excel format
- Filtering: Advanced filtering options for all reports
- Date Range Selection: Custom date ranges for historical analysis
- Database Backups: Automated backup creation with download capability
- Restore Functionality: Restore database from backup files
- Role-based Access: Granular permissions for different user roles
- Security Headers: Comprehensive security measures
# Reset database
npm run db:reset
# Create new migration
npx prisma migrate dev --name migration_name
# Generate Prisma client
npx prisma generate
# Seed database
npm run db:seed# Development mode
npm run dev
# Production mode
npm start
# Create backup
npm run backup
# Restore backup
npm run restore# Development mode
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewerpmfumo/
βββ backend/
β βββ src/
β β βββ routes/ # API route handlers
β β βββ middleware/ # Authentication & validation
β β βββ index.js # Main server file
β βββ prisma/
β β βββ schema.prisma # Database schema
β β βββ seed.js # Database seeding
β βββ scripts/ # Backup/restore scripts
β βββ package.json
βββ frontend/
β βββ src/
β β βββ pages/ # React page components
β β βββ components/ # Reusable components
β β βββ context/ # React context providers
β β βββ utils/ # Utility functions
β βββ package.json
βββ README.md
DATABASE_URL="mysql://username:password@localhost:3306/database_name"
JWT_SECRET="your_jwt_secret_key"
NODE_ENV="development"
PORT=3001The frontend automatically connects to the backend API at http://localhost:3001
- Set production environment variables
- Run database migrations:
npx prisma migrate deploy - Start the server:
npm start
- Build the application:
npm run build - Deploy the
distfolder to your web server - Configure API endpoint for production
This project is licensed under the MIT License.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For support and questions, please open an issue in the repository.
Note: This is a comprehensive ERP system designed for warehouse and hardware store management. Make sure to configure proper security settings and database credentials before deploying to production.