Skip to content

An efficient Inventory Management App built with FastAPI for the backend and React.js for the frontend. This application provides users with a seamless interface to manage inventory, featuring real-time updates, intuitive CRUD operations, and streamlined navigation.

Notifications You must be signed in to change notification settings

12pavani/inventory_management_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“¦ Inventory Management System

A full-stack inventory management application built with FastAPI and React, deployed on Render. This system helps businesses manage their inventory, track products, and communicate with suppliers efficiently.

🌐 Live Demo

✨ Features

Product Management

  • Add, edit, and delete products
  • Track quantity in stock and quantity sold
  • Automatic revenue calculation
  • Real-time product search
  • Product count display

Supplier Management

  • Manage supplier information
  • Email communication system
  • Link products to suppliers

User Interface

  • Responsive Bootstrap design
  • Navigation bar with product counter
  • Search functionality
  • Interactive forms with validation

πŸ› οΈ Tech Stack

Backend

  • FastAPI
  • Tortoise ORM
  • PostgreSQL
  • FastAPI-Mail
  • Python 3.8+
  • CORS enabled for cross-origin requests

Frontend

  • React
  • React Bootstrap
  • React Router
  • Context API for state management
  • React Hooks

πŸ’» Components Structure

Context Components

- ProductContext.js  // Manages global product state
- SupplierContext.js // Manages supplier information
- UpdateContext.js   // Handles product updates

UI Components

- NavBar.js       // Navigation with search and product counter
- AddProducts.js  // Product addition form
- ProductRows.js  // Display and manage products
- ProductsTable.js  // Displays the table of products
- SupplierPage.js   // Manages supplier interactions
- UpdateProducts.js // Form for updating product information

Backend Components

- app.py          // Application entry point
- models.py       // Defines database models

πŸš€ Local Development Setup

Backend Setup

  1. Clone the repository
git clone
cd inventory-management
  1. Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
  1. Install dependencies
pip install fastapi uvicorn tortoise-orm fastapi-mail python-dotenv
  1. Set up environment variables (.env)
EMAIL=your-email@gmail.com
PASS=your-email-password
DATABASE_URL=postgresql://username:password@localhost:5432/dbname
  1. Run development server
uvicorn app:app --reload --port 8000

Frontend Setup

  1. Navigate to frontend directory
cd frontend
  1. Install dependencies
npm install
  1. Set up environment variables (.env)
REACT_APP_API_URL=http://localhost:8000
  1. Start development server
npm start

πŸ“‘ API Endpoints

Products

GET /product         - List all products
GET /product/{id}    - Get product details
POST /product/{supplier_id} - Create product
PUT /product/{id}    - Update product
DELETE /product/{id} - Delete product

Suppliers

GET /supplier        - List suppliers
POST /supplier       - Add supplier
PUT /supplier/{id}   - Update supplier
DELETE /supplier/{id}- Delete supplier

Email

POST /email/{product_id} - Send supplier email

πŸ“Š Data Models

Product Model

{
    id: number;
    name: string;
    quantity_in_stock: number;
    quantity_sold: number;
    unit_price: number;
    revenue: number;
    supplied_by: number;
}

Supplier Model

{
    id: number;
    name: string;
    company: string;
    email: string;
    phone: string;
}

πŸ”„ State Management Example

// Product Context Usage
const [Products, setProducts] = useContext(ProductContext);

// Update Product const updateForm = (e) => { setProductInfo({ ...productInfo, [e.target.name]: e.target.value }); };

πŸš€ Deployment

Backend Deployment

  1. Create a new Web Service on Render
  2. Connect your GitHub repository
  3. Configure environment variables:
    • DATABASE_URL
    • EMAIL
    • PASS
  4. Set build command: pip install -r requirements.txt
  5. Set start command: uvicorn app:app --host 0.0.0.0 --port $PORT

Frontend Deployment

  1. Create a new Static Site on Render
  2. Connect your GitHub repository
  3. Set build command: npm install && npm run build
  4. Set publish directory: build

πŸ” Security Features

  • CORS configuration for specified origins
  • Environment variables for sensitive data
  • Email authentication
  • Input validation

πŸ› Troubleshooting

Common issues and solutions:
  • CORS errors: Check if your domain is added to the allowed origins
  • Database connection: Verify PostgreSQL connection string
  • Email sending failures: Check email credentials

πŸ“± Responsive Design

The application is fully responsive and tested on:
  • Desktop (1200px+)
  • Tablet (768px - 1199px)
  • Mobile (320px - 767px)

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

πŸ“„ License

This project is licensed under the MIT License.

Made with ❀️ using FastAPI and React by Vislavath Pavani

About

An efficient Inventory Management App built with FastAPI for the backend and React.js for the frontend. This application provides users with a seamless interface to manage inventory, featuring real-time updates, intuitive CRUD operations, and streamlined navigation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published