A comprehensive web-based inventory management system for tracking departmental items, managing issue/return workflows, role-based access control, and generating reports.
- Admin Login: Full system control and management
- Department/Staff Login: Department-specific access and permissions
- Password Authentication: Secure bcrypt hashing
- Role-Based Permissions: Admin, Department Staff, Auditor roles
- Password Reset: Email-based OTP system
- Total items and quantity KPIs
- Issued vs Available items visualization
- Low-stock alerts with configurable thresholds
- Department-wise charts (Chart.js)
- Recently added and issued items lists
- Quick search functionality
- Add items with comprehensive fields:
- Item Name, SKU, Category, Department
- Quantity, Price, Purchase Date
- Supplier, Location, Condition
- Image upload support
- Edit/Delete with soft-delete and audit trail
- Bulk CSV import/export
- Advanced search and filtering
- Pagination and sorting
- Issue items to departments/faculty/students
- Automatic quantity updates
- Return entry with condition tracking
- Partial returns support
- Complete history tracking
- Printable receipts
- Overdue alerts
- Create and manage departments
- Assign staff to departments
- Department-level inventory tracking
- Isolated department views for staff
- Pre-built reports (inventory, low-stock, issued items)
- CSV and PDF export
- Department-wise analysis
- Custom date range filtering
- Printable reports
- Complete audit trail for all actions
- Immutable logs with old/new values
- User activity tracking
- IP logging and timestamps
- Filter by entity, action, date
- Node.js with Express.js
- PostgreSQL database
- JWT authentication
- bcryptjs for password hashing
- Multer for file uploads
- PDFKit for PDF generation
- React 18 with React Router
- Tailwind CSS for styling
- Chart.js for visualizations
- Axios for API calls
- React Toastify for notifications
- Docker & Docker Compose
- GitHub Actions for CI/CD
- Environment-based configuration
- Node.js (v18 or higher)
- PostgreSQL (v14 or higher)
- npm or yarn
# Clone the repository
git clone <repository-url>
cd Railway Management System
# Install backend dependencies
npm install
# Install frontend dependencies
cd client
npm install
cd ..# Create PostgreSQL database
psql -U postgres
CREATE DATABASE inventory_db;
\q
# Run database schema
psql -U postgres -d inventory_db -f server/database/schema.sql
# (Optional) Seed sample data
npm run seed# Copy example environment file
cp .env.example .env
# Edit .env with your configuration
# Update DB credentials, JWT secret, email config# Development mode (runs both backend and frontend)
npm run dev
# Backend only
npm run server
# Frontend only
npm run client
# Production mode
npm run build
npm startThe application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
After running the seed script:
Admin Account:
- Email: [email protected]
- Password: Admin@123
Department Staff (Computer Science):
- Email: [email protected]
- Password: Staff@123
Change these passwords immediately in production!
Railway Management System/
βββ server/ # Backend (Node.js + Express)
β βββ config/ # Configuration files
β βββ controllers/ # Route controllers
β βββ middleware/ # Custom middleware (auth, RBAC)
β βββ models/ # Database models
β βββ routes/ # API routes
β βββ utils/ # Helper functions
β βββ database/ # DB schema and migrations
β βββ seeds/ # Seed data scripts
β βββ index.js # Server entry point
βββ client/ # Frontend (React)
β βββ public/ # Static files
β βββ src/
β βββ components/ # React components
β βββ pages/ # Page components
β βββ context/ # Context API (auth, etc.)
β βββ utils/ # Helper functions
β βββ services/ # API service layer
β βββ App.js # Main app component
βββ uploads/ # File uploads directory
βββ .env # Environment variables
βββ package.json # Backend dependencies
βββ docker-compose.yml # Docker configuration
βββ README.md # This file
POST /api/auth/login- User loginPOST /api/auth/logout- User logoutPOST /api/auth/forgot-password- Request password resetPOST /api/auth/reset-password- Reset password with token
GET /api/users- List all users (Admin)POST /api/users- Create new user (Admin)GET /api/users/:id- Get user detailsPUT /api/users/:id- Update userDELETE /api/users/:id- Soft delete user
GET /api/departments- List all departmentsPOST /api/departments- Create department (Admin)PUT /api/departments/:id- Update departmentDELETE /api/departments/:id- Delete department
GET /api/items- List items (with filters)POST /api/items- Add new itemGET /api/items/:id- Get item detailsPUT /api/items/:id- Update itemDELETE /api/items/:id- Soft delete itemPOST /api/items/bulk-upload- Bulk CSV upload
POST /api/issues- Create issueGET /api/issues- List issues (with filters)GET /api/issues/:id- Get issue detailsPOST /api/issues/:id/return- Process return
GET /api/reports/inventory- Inventory reportGET /api/reports/low-stock- Low stock itemsGET /api/reports/issued- Issued items reportGET /api/reports/export- Export to CSV/PDF
GET /api/audit- Get audit logs (with filters)
# Run all tests
npm test
# Run with coverage
npm test -- --coverage
# Run specific test file
npm test -- auth.test.js# Build and run with Docker Compose
docker-compose up -d
# View logs
docker-compose logs -f
# Stop containers
docker-compose down- Password hashing with bcryptjs (12 rounds)
- JWT token-based authentication
- Role-based access control (RBAC)
- Rate limiting on authentication endpoints
- Helmet.js for security headers
- Input validation and sanitization
- SQL injection protection with parameterized queries
- File upload validation (type, size)
- HTTPS enforcement in production
- CSRF protection
- Database indexing on frequently queried fields
- Connection pooling for PostgreSQL
- Response caching for reports
- Pagination for large datasets
- Lazy loading of images
- Optimized queries with joins
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
MIT License - see LICENSE file for details
- Your Name - Ashish Ranjan
For issues and questions:
- Create an issue in the repository
- Email: [email protected]
- Barcode/QR code scanning
- Mobile app (React Native)
- SMS notifications
- Advanced analytics dashboard
- Multi-language support
- Procurement workflow
- Asset depreciation tracking
- LDAP/SSO integration
- Mobile PWA
- Offline mode
Built with β€οΈ for efficient department inventory management