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.
- Frontend: https://inventory-management-frontend-5bio.onrender.com
- Backend API: https://inventory-management-backend-ppyt.onrender.com
- Add, edit, and delete products
- Track quantity in stock and quantity sold
- Automatic revenue calculation
- Real-time product search
- Product count display
- Manage supplier information
- Email communication system
- Link products to suppliers
- Responsive Bootstrap design
- Navigation bar with product counter
- Search functionality
- Interactive forms with validation
- FastAPI
- Tortoise ORM
- PostgreSQL
- FastAPI-Mail
- Python 3.8+
- CORS enabled for cross-origin requests
- React
- React Bootstrap
- React Router
- Context API for state management
- React Hooks
- ProductContext.js // Manages global product state
- SupplierContext.js // Manages supplier information
- UpdateContext.js // Handles product updates
- 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
- app.py // Application entry point
- models.py // Defines database models
- Clone the repository
git clone
cd inventory-management
- Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
- Install dependencies
pip install fastapi uvicorn tortoise-orm fastapi-mail python-dotenv
- Set up environment variables (.env)
EMAIL=your-email@gmail.com
PASS=your-email-password
DATABASE_URL=postgresql://username:password@localhost:5432/dbname
- Run development server
uvicorn app:app --reload --port 8000
- Navigate to frontend directory
cd frontend
- Install dependencies
npm install
- Set up environment variables (.env)
REACT_APP_API_URL=http://localhost:8000
- Start development server
npm start
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
GET /supplier - List suppliers
POST /supplier - Add supplier
PUT /supplier/{id} - Update supplier
DELETE /supplier/{id}- Delete supplier
POST /email/{product_id} - Send supplier email
{
id: number;
name: string;
quantity_in_stock: number;
quantity_sold: number;
unit_price: number;
revenue: number;
supplied_by: number;
}
{
id: number;
name: string;
company: string;
email: string;
phone: string;
}
// Product Context Usage const [Products, setProducts] = useContext(ProductContext);
// Update Product const updateForm = (e) => { setProductInfo({ ...productInfo, [e.target.name]: e.target.value }); };
- Create a new Web Service on Render
- Connect your GitHub repository
- Configure environment variables:
- DATABASE_URL
- PASS
- Set build command:
pip install -r requirements.txt
- Set start command:
uvicorn app:app --host 0.0.0.0 --port $PORT
- Create a new Static Site on Render
- Connect your GitHub repository
- Set build command:
npm install && npm run build
- Set publish directory:
build
- CORS configuration for specified origins
- Environment variables for sensitive data
- Email authentication
- Input validation
- CORS errors: Check if your domain is added to the allowed origins
- Database connection: Verify PostgreSQL connection string
- Email sending failures: Check email credentials
- Desktop (1200px+)
- Tablet (768px - 1199px)
- Mobile (320px - 767px)
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License.
Made with β€οΈ using FastAPI and React by Vislavath Pavani