
This commit implements a comprehensive inventory management system for small businesses using FastAPI and SQLAlchemy. Features include: - Product and category management - Inventory tracking across multiple locations - Supplier management - Purchase management - Transaction tracking for inventory movements - Complete API documentation generated with BackendIM... (backend.im)
132 lines
4.1 KiB
Markdown
132 lines
4.1 KiB
Markdown
# Small Business Inventory Management System
|
|
|
|
A comprehensive inventory management API built with FastAPI and SQLAlchemy for small businesses. This API provides functionality to manage products, inventory, suppliers, and purchases.
|
|
|
|
## Features
|
|
|
|
- **Product Management**: CRUD operations for products and categories
|
|
- **Inventory Management**: Track inventory levels across multiple locations
|
|
- **Supplier Management**: Manage suppliers and their contact information
|
|
- **Purchase Management**: Create and track purchase orders
|
|
- **Transaction Tracking**: Record and track inventory movements (sales, purchases, transfers, adjustments)
|
|
- **Stock Alerts**: Monitor low-stock items
|
|
|
|
## Tech Stack
|
|
|
|
- **FastAPI**: High-performance web framework for building APIs
|
|
- **SQLAlchemy**: SQL toolkit and ORM
|
|
- **Pydantic**: Data validation and settings management
|
|
- **Alembic**: Database migration tool
|
|
- **SQLite**: Lightweight database
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Python 3.8+
|
|
- pip
|
|
|
|
### Installation
|
|
|
|
1. Clone the repository
|
|
```bash
|
|
git clone <repository-url>
|
|
cd smallbusinessinventorymanagementsystem
|
|
```
|
|
|
|
2. Install dependencies
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
3. Run the application
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
4. Access the API documentation at http://localhost:8000/docs
|
|
|
|
## API Endpoints
|
|
|
|
The API is organized around the following main resources:
|
|
|
|
### Products & Categories
|
|
|
|
- `GET /api/v1/products/`: List all products
|
|
- `POST /api/v1/products/`: Create a new product
|
|
- `GET /api/v1/products/{product_id}`: Get product details
|
|
- `PUT /api/v1/products/{product_id}`: Update a product
|
|
- `DELETE /api/v1/products/{product_id}`: Delete a product
|
|
|
|
- `GET /api/v1/categories/`: List all categories
|
|
- `POST /api/v1/categories/`: Create a new category
|
|
- `GET /api/v1/categories/{category_id}`: Get category details
|
|
- `PUT /api/v1/categories/{category_id}`: Update a category
|
|
- `DELETE /api/v1/categories/{category_id}`: Delete a category
|
|
|
|
### Inventory Management
|
|
|
|
- `GET /api/v1/inventory/`: List inventory items
|
|
- `POST /api/v1/inventory/`: Create inventory item
|
|
- `GET /api/v1/inventory/{item_id}`: Get inventory item details
|
|
- `PUT /api/v1/inventory/{item_id}`: Update inventory item
|
|
- `DELETE /api/v1/inventory/{item_id}`: Delete inventory item
|
|
|
|
- `GET /api/v1/locations/`: List all locations
|
|
- `POST /api/v1/locations/`: Create a new location
|
|
- `GET /api/v1/locations/{location_id}`: Get location details
|
|
- `PUT /api/v1/locations/{location_id}`: Update a location
|
|
- `DELETE /api/v1/locations/{location_id}`: Delete a location
|
|
|
|
- `GET /api/v1/inventory-transactions/`: List inventory transactions
|
|
- `POST /api/v1/inventory-transactions/`: Create inventory transaction
|
|
- `GET /api/v1/inventory-transactions/{transaction_id}`: Get transaction details
|
|
|
|
### Suppliers & Purchases
|
|
|
|
- `GET /api/v1/suppliers/`: List all suppliers
|
|
- `POST /api/v1/suppliers/`: Create a new supplier
|
|
- `GET /api/v1/suppliers/{supplier_id}`: Get supplier details
|
|
- `PUT /api/v1/suppliers/{supplier_id}`: Update a supplier
|
|
- `DELETE /api/v1/suppliers/{supplier_id}`: Delete a supplier
|
|
|
|
- `GET /api/v1/purchases/`: List all purchases
|
|
- `POST /api/v1/purchases/`: Create a new purchase
|
|
- `GET /api/v1/purchases/{purchase_id}`: Get purchase details
|
|
- `PUT /api/v1/purchases/{purchase_id}`: Update a purchase
|
|
- `DELETE /api/v1/purchases/{purchase_id}`: Delete a purchase
|
|
- `POST /api/v1/purchases/{purchase_id}/receive`: Receive purchase into inventory
|
|
|
|
### System
|
|
|
|
- `GET /health`: Check API health status
|
|
|
|
## Database Schema
|
|
|
|
The system uses the following main data models:
|
|
|
|
- **Product**: Base product information (name, SKU, price, etc.)
|
|
- **Category**: Product categories
|
|
- **Location**: Inventory storage locations (warehouses, stores)
|
|
- **InventoryItem**: Product stock at a specific location
|
|
- **InventoryTransaction**: Record of inventory movements
|
|
- **Supplier**: Supplier information
|
|
- **Purchase**: Purchase orders from suppliers
|
|
|
|
## Development
|
|
|
|
### Database Migrations
|
|
|
|
The project uses Alembic for database migrations:
|
|
|
|
```bash
|
|
# Generate a new migration
|
|
alembic revision -m "description"
|
|
|
|
# Run migrations
|
|
alembic upgrade head
|
|
|
|
# Rollback migration
|
|
alembic downgrade -1
|
|
```
|