Skip to content

IsMohit/Lab-Inventory-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ§ͺ Laboratory Inventory Management System (LIMS)

A modern, responsive full-stack web application designed to manage laboratory inventory, streamline stock tracking, and notify users of critical levels. Built with React, Flask, MongoDB, and Docker, LIMS provides secure authentication, real-time dashboards, and alert mechanisms for effective lab resource management.

Status: βœ… Production Ready | License: MIT


πŸš€ Quick Start

# Clone and navigate
git clone <repo-url>
cd "Lab Inventory Management System"

# Start all services with Docker Compose
docker-compose up --build

# Access the application
Frontend:  http://localhost:4000
Backend:   http://localhost:5000/api

πŸ“‹ Project Overview

LIMS helps laboratories efficiently manage their inventory by:

  • βœ… Tracking components and stock levels
  • βœ… Managing inward and outward stock movements
  • βœ… Notifying users about low or critical inventory levels
  • βœ… Providing role-based access control
  • βœ… Enabling secure user authentication with bcrypt password hashing
  • βœ… Supporting real-time dashboard and inventory management

Ideal for educational institutions, research labs, and any organization needing robust inventory management.


πŸ› οΈ Tech Stack

Layer Technology
Frontend React 19, Vite, TailwindCSS, Axios
Backend Python 3.11, Flask, Gunicorn
Database MongoDB 7.0
Authentication JWT, bcrypt (10-round hashing)
DevOps Docker & Docker Compose
UI Framework React Router, Lucide Icons

πŸ”’ Authentication System

Features

  • βœ… Email/Password Registration: New users can create accounts with secure bcrypt hashing
  • βœ… JWT Sessions: 24-hour token-based authentication
  • βœ… Role-Based Access: Admin and Staff roles with different permissions
  • βœ… Session Persistence: Automatic login on page refresh
  • βœ… Feedback Messages: Clear success/error notifications
  • βœ… Password Security: Minimum 6 characters, bcrypt 10-round hashing

API Endpoints

POST   /api/auth/register          Register new user
POST   /api/auth/login             Login with email/password
POST   /api/auth/verify-token      Verify JWT token
POST   /api/auth/logout            Logout and invalidate session

πŸ“¦ Project Structure

Lab Inventory Management System/
β”œβ”€β”€ client/                          # React Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/              # React components
β”‚   β”‚   β”œβ”€β”€ pages/                   # Login, Register, Dashboard
β”‚   β”‚   β”œβ”€β”€ context/                 # AuthContext for state
β”‚   β”‚   β”œβ”€β”€ utils/                   # Axios API client
β”‚   β”‚   └── constants/               # Sample data
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ backend/                         # Python Flask Backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ routes/                  # API endpoints
β”‚   β”‚   β”œβ”€β”€ models/                  # MongoDB models
β”‚   β”‚   β”œβ”€β”€ services/                # Business logic
β”‚   β”‚   └── utils/                   # Helpers
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ docker-compose.yml               # Docker orchestration
β”œβ”€β”€ .env                             # Environment variables
└── docs/                            # Documentation

πŸš€ Getting Started

Prerequisites

  • Docker and Docker Compose installed
  • Port 4000 (Frontend), 5000 (Backend), 27017 (MongoDB) available
  • Git

Installation

  1. Clone the repository
git clone <repo-url>
cd "Lab Inventory Management System"
  1. Create environment file
cp .env.example .env
  1. Start all services
docker-compose up --build
  1. Access the application

First-Time Setup

  1. Register a new account

  2. Login

  3. View Dashboard

    • Your name and avatar display in the navbar
    • Access inventory, notifications, and user management

✨ Features

πŸ” Authentication & Authorization

  • βœ… Secure user registration with email/password
  • βœ… bcrypt password hashing (10 rounds)
  • βœ… JWT token-based sessions (24-hour expiration)
  • βœ… Role-based access control (Admin/Staff)
  • βœ… Session persistence across browser refreshes
  • βœ… Success/error feedback messages

πŸ“¦ Inventory Management

  • βœ… Add, edit, delete laboratory components
  • βœ… Track component quantities and values
  • βœ… Inward/outward stock movements
  • βœ… Category-based filtering
  • βœ… Search functionality
  • βœ… Color-coded stock status indicators
  • βœ… Supplier tracking

πŸ“Š Dashboard

  • βœ… Real-time inventory overview
  • βœ… Total components count and value
  • βœ… Category distribution charts
  • βœ… Low stock alerts
  • βœ… Critical stock warnings
  • βœ… Recent activity logs

πŸ”” Notifications

  • βœ… Critical stock alerts
  • βœ… Low stock warnings
  • βœ… Outdated inventory notifications
  • βœ… Notification badge with count
  • βœ… Detailed notification view

πŸ‘₯ User Management (Admin Only)

  • βœ… View all users
  • βœ… Manage user roles (Admin/Staff)
  • βœ… Track user activity
  • βœ… Department management

🎨 UI/UX

  • βœ… Responsive design (mobile, tablet, desktop)
  • βœ… Dark/light gradient backgrounds
  • βœ… Success/error feedback messages
  • βœ… Loading states
  • βœ… User profile with auto-generated avatar
  • βœ… Clean, modern interface with Tailwind CSS

πŸ”— API Endpoints

Authentication

POST   /api/auth/register          Register new user
POST   /api/auth/login             Login with credentials
POST   /api/auth/verify-token      Verify JWT token
POST   /api/auth/logout            Logout

Components

GET    /api/components             Get all components
POST   /api/components             Add new component (Admin)
PUT    /api/components/{id}        Update component (Admin)
DELETE /api/components/{id}        Delete component (Admin)

Transactions

POST   /api/transactions           Record stock movement
GET    /api/transactions/{id}      Get transaction details

Notifications

GET    /api/notifications          Get all notifications
GET    /api/notifications/recent   Get recent notifications
POST   /api/notifications/read     Mark as read

Users (Admin Only)

GET    /api/users                  Get all users
POST   /api/users                  Create new user
PUT    /api/users/{id}             Update user
DELETE /api/users/{id}             Delete user

🐳 Docker Commands

# Start all services
docker-compose up --build

# Run in background
docker-compose up -d --build

# View logs
docker-compose logs -f

# View specific service
docker-compose logs -f backend
docker-compose logs -f frontend

# Stop services
docker-compose down

# Restart service
docker-compose restart backend

# Access MongoDB
docker-compose exec mongo mongosh -u admin -p password

# Check status
docker-compose ps

πŸ—‚οΈ Environment Variables

Create a .env file in the project root:

# Frontend
VITE_API_URL=http://localhost:5000/api

# Backend
FLASK_ENV=production
DEBUG=False
SECRET_KEY=your-secret-key-here
JWT_SECRET=your-jwt-secret-here
JWT_EXPIRATION_HOURS=24
MONGODB_URI=mongodb://admin:password@mongo:27017/lims

# MongoDB
MONGO_INITDB_ROOT_USERNAME=admin
MONGO_INITDB_ROOT_PASSWORD=password

πŸ§ͺ Testing

Register a Test User

# Via Frontend: http://localhost:4000/register
Email: test@example.com
Password: test123456
Name: Test User

Login

# Via Frontend: http://localhost:4000/login
Email: test@example.com
Password: test123456

API Testing

# Register
curl -X POST http://localhost:5000/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "password123",
    "name": "John Doe"
  }'

# Login
curl -X POST http://localhost:5000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "password123"
  }'

πŸ“š Documentation

For detailed documentation, see the docs folder:

  • QUICK_REFERENCE.md - Quick setup and common commands
  • COMPLETE_SETUP.md - Detailed setup instructions
  • DOCKER_DEPLOYMENT.md - Docker deployment guide
  • ARCHITECTURE_OVERVIEW.md - System architecture
  • START_HERE.md - Getting started guide

βš™οΈ System Requirements

  • Docker 20.10+
  • Docker Compose 1.29+
  • 2GB RAM minimum
  • 500MB disk space
  • Internet connection for initial setup

πŸ”§ Troubleshooting

Port Already in Use

# Windows - Find process using port
netstat -ano | findstr :4000

# Kill the process
taskkill /PID <PID> /F

MongoDB Connection Error

# Check MongoDB logs
docker-compose logs mongo

# Verify connection string
MONGODB_URI=mongodb://admin:password@mongo:27017/lims

Frontend Not Loading

# Rebuild frontend
docker-compose up -d --build frontend

# Check logs
docker-compose logs -f frontend

Backend API Error

# Check backend logs
docker-compose logs -f backend

# Verify services
docker-compose ps

πŸš€ Deployment Options

For production deployment, consider:

  • AWS ECS - Managed container service
  • Azure Container Instances - Serverless containers
  • Google Cloud Run - Pay-per-use serverless
  • Kubernetes - Self-managed orchestration
  • DigitalOcean App Platform - Simple Docker deployment

See DOCKER_DEPLOYMENT.md for more details.


🀝 Contributing

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License. See LICENSE file for details.


πŸ™‹ Support

  • πŸ“– Check docs folder for documentation
  • πŸ› Report issues via GitHub Issues
  • πŸ’¬ Start a discussion for questions

✨ Changelog

v1.0.0 (Current)

  • βœ… Complete authentication system with bcrypt
  • βœ… Docker containerization
  • βœ… Real-time inventory management
  • βœ… Role-based access control
  • βœ… Responsive UI with Tailwind CSS
  • βœ… MongoDB integration
  • βœ… JWT-based sessions

Built with ❀️ for laboratory inventory management

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published