Skip to content

Venom-isofficial/Railway-Management-System

Repository files navigation

Department Inventory & Issue-Return Management System

A comprehensive web-based inventory management system for tracking departmental items, managing issue/return workflows, role-based access control, and generating reports.

πŸš€ Features

1. πŸ§β€β™‚οΈ User Management

  • 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

2. 🏠 Dashboard

  • 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

3. πŸ“¦ Item Management

  • 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

4. πŸ”„ Issue & Return System

  • Issue items to departments/faculty/students
  • Automatic quantity updates
  • Return entry with condition tracking
  • Partial returns support
  • Complete history tracking
  • Printable receipts
  • Overdue alerts

5. 🏫 Department Management

  • Create and manage departments
  • Assign staff to departments
  • Department-level inventory tracking
  • Isolated department views for staff

6. πŸ“Š Reporting & Analytics

  • Pre-built reports (inventory, low-stock, issued items)
  • CSV and PDF export
  • Department-wise analysis
  • Custom date range filtering
  • Printable reports

7. πŸ” Audit & History

  • Complete audit trail for all actions
  • Immutable logs with old/new values
  • User activity tracking
  • IP logging and timestamps
  • Filter by entity, action, date

πŸ› οΈ Tech Stack

Backend

  • Node.js with Express.js
  • PostgreSQL database
  • JWT authentication
  • bcryptjs for password hashing
  • Multer for file uploads
  • PDFKit for PDF generation

Frontend

  • React 18 with React Router
  • Tailwind CSS for styling
  • Chart.js for visualizations
  • Axios for API calls
  • React Toastify for notifications

DevOps

  • Docker & Docker Compose
  • GitHub Actions for CI/CD
  • Environment-based configuration

πŸ“‹ Prerequisites

  • Node.js (v18 or higher)
  • PostgreSQL (v14 or higher)
  • npm or yarn

πŸš€ Quick Start

1. Clone and Install

# Clone the repository
git clone <repository-url>
cd Railway Management System

# Install backend dependencies
npm install

# Install frontend dependencies
cd client
npm install
cd ..

2. Database Setup

# 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

3. Environment Configuration

# Copy example environment file
cp .env.example .env

# Edit .env with your configuration
# Update DB credentials, JWT secret, email config

4. Run the Application

# 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 start

The application will be available at:

πŸ” Default Credentials

After running the seed script:

Admin Account:

Department Staff (Computer Science):

Change these passwords immediately in production!

πŸ“ Project Structure

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

πŸ”Œ API Endpoints

Authentication

  • POST /api/auth/login - User login
  • POST /api/auth/logout - User logout
  • POST /api/auth/forgot-password - Request password reset
  • POST /api/auth/reset-password - Reset password with token

Users

  • GET /api/users - List all users (Admin)
  • POST /api/users - Create new user (Admin)
  • GET /api/users/:id - Get user details
  • PUT /api/users/:id - Update user
  • DELETE /api/users/:id - Soft delete user

Departments

  • GET /api/departments - List all departments
  • POST /api/departments - Create department (Admin)
  • PUT /api/departments/:id - Update department
  • DELETE /api/departments/:id - Delete department

Items

  • GET /api/items - List items (with filters)
  • POST /api/items - Add new item
  • GET /api/items/:id - Get item details
  • PUT /api/items/:id - Update item
  • DELETE /api/items/:id - Soft delete item
  • POST /api/items/bulk-upload - Bulk CSV upload

Issues & Returns

  • POST /api/issues - Create issue
  • GET /api/issues - List issues (with filters)
  • GET /api/issues/:id - Get issue details
  • POST /api/issues/:id/return - Process return

Reports

  • GET /api/reports/inventory - Inventory report
  • GET /api/reports/low-stock - Low stock items
  • GET /api/reports/issued - Issued items report
  • GET /api/reports/export - Export to CSV/PDF

Audit

  • GET /api/audit - Get audit logs (with filters)

πŸ§ͺ Testing

# Run all tests
npm test

# Run with coverage
npm test -- --coverage

# Run specific test file
npm test -- auth.test.js

🐳 Docker Deployment

# Build and run with Docker Compose
docker-compose up -d

# View logs
docker-compose logs -f

# Stop containers
docker-compose down

πŸ”’ Security Features

  • 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

πŸ“ˆ Performance Optimization

  • 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

🌐 Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

πŸ“ License

MIT License - see LICENSE file for details

πŸ‘₯ Contributors

  • Your Name - Ashish Ranjan

πŸ“ž Support

For issues and questions:

πŸ—ΊοΈ Roadmap

Phase 2 (Planned)

  • Barcode/QR code scanning
  • Mobile app (React Native)
  • SMS notifications
  • Advanced analytics dashboard
  • Multi-language support

Phase 3 (Future)

  • Procurement workflow
  • Asset depreciation tracking
  • LDAP/SSO integration
  • Mobile PWA
  • Offline mode

πŸ“š Documentation


Built with ❀️ for efficient department inventory management

About

A comprehensive web-based inventory management system for tracking departmental items, managing issue/return workflows, role-based access control, and generating reports.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors