Skip to content

nishant-cipher/InventoryApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

InventoryApp

A Java Servlet-based Inventory Management Web Application using MVC architecture and PostgreSQL

πŸͺ Inventory Management Web Application

A Java Servlet-based Inventory Management System built using MVC architecture and PostgreSQL.
This project demonstrates real-world use of Servlets, JDBC, and Database Integration in a clean, modular structure.


πŸš€ Features

πŸ‘¨β€πŸ’» Role-Based Access

  • DEO (Data Entry Operator): Add new products (with supplier validation and unique product IDs).
  • POS (Point of Sale Staff): Perform sales, reduce stock, and calculate total price dynamically.
  • MGR (Manager): View products with stock levels below 50 for restocking decisions.

🧩 Tech Stack

Layer Technology
Frontend HTML5
Backend Java Servlets (Jakarta EE)
Database PostgreSQL
Design Pattern MVC (Model-View-Controller)
Server Apache Tomcat 11
Language Java (JDK 17+)

πŸ—οΈ Project Structure

InventoryApp/
β”œβ”€β”€ src/
β”‚ └── main/
β”‚ β”œβ”€β”€ java/
β”‚ β”‚ └── com/
β”‚ β”‚ └── company/
β”‚ β”‚ β”œβ”€β”€ controller/ # Servlets
β”‚ β”‚ β”œβ”€β”€ dao/ # Data Access Objects
β”‚ β”‚ β”œβ”€β”€ model/ # Entity Classes
β”‚ β”‚ β”œβ”€β”€ service/ # Business Logic
β”‚ β”‚ └── util/ # Utilities
β”‚ └── webapp/
β”‚ β”œβ”€β”€ WEB-INF/
β”‚ β”‚ β”œβ”€β”€ web.xml # Deployment Descriptor
β”‚ β”‚ └── classes/
β”‚ β”œβ”€β”€ css/ # Stylesheets
β”‚ β”œβ”€β”€ js/ # JavaScript files
β”‚ β”œβ”€β”€ views/ # JSP pages
β”‚ └── index.html # Login Page
β”œβ”€β”€ pom.xml # Maven Configuration
β”œβ”€β”€ README.md
β”œβ”€β”€ .gitignore
└── LICENSE

πŸ’Ύ Database Setup (PostgreSQL)

CREATE DATABASE Inventory;

\c Inventory;

CREATE TABLE users (
    userid VARCHAR(20) PRIMARY KEY,
    password VARCHAR(50),
    fullname VARCHAR(50),
    role VARCHAR(10) CHECK (role IN ('DEO','POS','MGR'))
);

INSERT INTO users VALUES
('admin','admin123','Administrator','MGR'),
('nish','nish123','The Great Nish','DEO'),
('user1','user123','Sample User 1','POS');

CREATE TABLE supplier (
    supplierid VARCHAR(20) PRIMARY KEY,
    name VARCHAR(50),
    contact VARCHAR(15),
    email VARCHAR(50)
);

CREATE TABLE product (
    productid VARCHAR(20) PRIMARY KEY,
    name VARCHAR(50),
    supplierid VARCHAR(20) REFERENCES supplier(supplierid),
    stockavailable INT,
    openingstock INT,
    lastsupplydate DATE,
    unitprice NUMERIC(10,2)
);

🧠 Workflow

πŸ” Authentication Flow

graph TD
    A[User Access Login Page] --> B[Enter Credentials]
    B --> C{Validation}
    C -->|Invalid| D[Show Error Message]
    C -->|Valid| E{Check User Role}
    E -->|MGR| F[Redirect to Manager Dashboard]
    E -->|DEO| G[Redirect to DEO Dashboard]
    E -->|POS| H[Redirect to POS Dashboard]
    F --> I[Access Manager Features]
    G --> J[Access DEO Features]
    H --> K[Access POS Features]
Loading

1️⃣ Login & Authentication

  • User enters credentials on login page
  • System validates against database
  • Redirects to role-specific dashboard based on user role

2️⃣ DEO (Data Entry Operator)

Main Task: Add Products

  • Fill product form with details
  • System validates supplier exists
  • Checks product ID uniqueness
  • Adds product to database
  • Updates inventory records

3️⃣ POS (Point of Sale)

Main Task: Process Sales

  • Enter product ID to search
  • System shows product details & stock
  • Enter quantity to sell
  • Automatic price calculation
  • Stock automatically deducted
  • Sales transaction recorded

4️⃣ MGR (Manager)

Main Tasks: Monitor & Analyze

  • View low stock alerts (stock < 50)
  • Check sales reports and analytics
  • Monitor inventory health
  • Manage user accounts and roles

Quick flow

Login β†’ Role Check β†’ Dashboard β†’ Perform Actions β†’ Logout
↓
DEO: Add Products β†’ Validate β†’ Save to DB
POS: Sell Products β†’ Calculate β†’ Update Stock
MGR: View Reports β†’ Analyze β†’ Make Decisions
    

🧠 System Architecture

flowchart TD
    subgraph Frontend
        A[Login Interface]
        B[DEO Dashboard]
        C[POS Dashboard]
        D[Manager Dashboard]
    end

    subgraph Backend
        E[Authentication Service]
        F[Product Service]
        G[Sales Service]
        H[Report Service]
    end

    subgraph Database
        I[Users Table]
        J[Products Table]
        K[Suppliers Table]
        L[Sales Table]
    end

    A --> E
    E --> I
    
    B --> F
    F --> J
    F --> K
    
    C --> G
    G --> J
    G --> L
    
    D --> H
    H --> J
    H --> L
    H --> I
Loading

MVC Architecture

+------------------+        +---------------------+        +--------------------+
|      View        | --->   |      Controller      | --->   |       Model        |
| (JSP/HTML)       |        | (Servlets)           |        | (DAO + Entities)   |
+------------------+        +---------------------+        +--------------------+
        ↑                         ↑                              ↑
        |                         |                              |
+------------------+        +---------------------+        +--------------------+
|   User Interface |        |  Business Logic     |        | Database Layer     |
|   Forms & Pages  |        |  Request Handling   |        | JDBC & SQL         |
+------------------+        +---------------------+        +--------------------+

πŸš€ Future Enhancements

  • 🧩 Role-Based Dashboard UI: Enhance each role (DEO, POS, MGR) with interactive HTML dashboards using AJAX for real-time updates.
  • πŸ“¦ Sales History Tracking: Maintain a Sales table to store transaction details and generate periodic sales reports.
  • πŸ”” Low Stock Alerts: Automatically email or notify managers when stock drops below a defined threshold.
  • πŸ“Š Analytics Module: Integrate charts (using Chart.js) to visualize sales and stock trends.
  • ☁️ Cloud Deployment: Host the application on AWS / Render using PostgreSQL Cloud for real-world scalability.
  • 🧠 AI-Powered Stock Prediction: Use a lightweight ML model to forecast product demand and optimize inventory.

πŸ‘¨β€πŸ’» Author

Nishant (The Great Nish)


πŸͺͺ License

This project is licensed under the MIT License β€” you’re free to use, modify, and distribute it with attribution. MIT License Copyright (c) 2025 Nishant

Releases

No releases published

Packages

No packages published