Skip to content

eugen-goebel/inventory-management

Repository files navigation

Inventory Management Dashboard

Full-stack inventory management system with a React/TypeScript frontend and FastAPI backend. Tracks products, stock movements, and suppliers with real-time analytics.

CI Python TypeScript Tests License

Screenshots

Dashboard: KPI cards, stock value by category, top products by value Dashboard

Products: Product list with search, category filter, and low-stock indicator Products

Movements: Audit trail of inbound/outbound stock movements Movements

Login: JWT authentication with role-based access control (admin/staff/viewer) Login

Architecture

┌─────────────────────────────────┐
│     React + TypeScript          │
│     Vite + Tailwind CSS         │
│     Recharts                    │
│     Port 5173 (dev)             │
└──────────────┬──────────────────┘
               │ REST API
               ▼
┌─────────────────────────────────┐
│     FastAPI + Python            │
│     SQLAlchemy ORM              │
│     Pydantic v2                 │
│     Port 8000                   │
└──────────────┬──────────────────┘
               │
               ▼
┌─────────────────────────────────┐
│     SQLite                      │
│     inventory.db                │
└─────────────────────────────────┘

Features

  • Dashboard: KPI cards, stock value by category (bar chart), top products, recent movements
  • Product Management: CRUD operations, search, category filter, low-stock alerts
  • Stock Movements: Record inbound/outbound stock with reference tracking
  • Supplier Management: CRUD with product count tracking
  • Analytics API: Real-time stock value, category breakdown, movement history
  • Data Validation: Pydantic v2 schemas, unique SKU enforcement, stock integrity checks
  • 30+ Backend Tests with pytest, 8 Frontend Tests with Vitest + Testing Library

Tech Stack

Frontend

React TypeScript Vite Tailwind CSS

Backend

Python FastAPI SQLAlchemy SQLite

DevOps

Docker pytest

Quick Start

With Docker

docker build -t inventory-management .
docker run -p 8000:8000 inventory-management

Open http://localhost:8000 in your browser.

Manual Setup

Backend:

cd backend
pip install -r requirements.txt
python -m data.seed          # Generate sample data
uvicorn main:app --reload    # Start API at localhost:8000

Frontend:

cd frontend
npm install
npm run dev                  # Start dev server at localhost:5173

API Documentation

Once the backend is running, visit http://localhost:8000/docs for interactive Swagger documentation.

API Endpoints

Method Endpoint Description
GET /api/products List products (search, category, low_stock filter)
GET /api/products/export Download filtered products as CSV
POST /api/products Create product
PUT /api/products/{id} Update product
DELETE /api/products/{id} Delete product (only if stock is 0)
GET /api/movements List stock movements
POST /api/movements Record stock in/out
GET /api/suppliers List suppliers
POST /api/suppliers Create supplier
PUT /api/suppliers/{id} Update supplier
DELETE /api/suppliers/{id} Delete supplier (only if no products)
GET /api/analytics/dashboard Dashboard KPIs and charts

Project Structure

inventory-management/
├── backend/
│   ├── agents/
│   │   ├── routes.py              # API endpoint definitions
│   │   ├── product_service.py     # Product CRUD logic
│   │   ├── movement_service.py    # Stock movement logic
│   │   ├── supplier_service.py    # Supplier CRUD logic
│   │   └── analytics_service.py   # Dashboard analytics
│   ├── models/
│   │   ├── orm.py                 # SQLAlchemy table definitions
│   │   └── schemas.py             # Pydantic request/response models
│   ├── db/
│   │   └── database.py            # Database connection and session
│   ├── data/
│   │   └── seed.py                # Sample data generator
│   ├── tests/                     # 30+ pytest tests
│   ├── main.py                    # FastAPI application entry point
│   └── requirements.txt
├── frontend/
│   ├── src/
│   │   ├── pages/                 # Dashboard, Products, Movements, Suppliers
│   │   ├── components/            # KpiCard, Modal, Layout, LoadingSpinner
│   │   ├── api/                   # API client with fetch wrapper
│   │   └── types/                 # TypeScript interfaces
│   ├── package.json
│   └── vite.config.ts
├── Dockerfile
└── README.md

Running Tests

Backend (pytest):

cd backend
pytest -v

Frontend (Vitest + React Testing Library):

cd frontend
npm test           # one-shot run
npm run test:watch # watch mode while developing
npm run test:ui    # interactive UI in browser

License

MIT

About

Full-stack inventory management with React/TypeScript frontend and FastAPI/SQLAlchemy backend

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors