3.3 KiB
3.3 KiB
Small Business Inventory System
A comprehensive FastAPI-based inventory management system designed for small businesses to track products, manage stock levels, and monitor supplier relationships.
Features
- Product Management: Complete CRUD operations for products with SKU tracking
- Category Management: Organize products into categories
- Supplier Management: Track supplier information and relationships
- Inventory Tracking: Real-time stock level monitoring with low-stock alerts
- Stock Movements: Track all inventory movements (IN/OUT/ADJUSTMENTS)
- Reporting: Stock reports and analytics
- API Documentation: Auto-generated OpenAPI documentation
Quick Start
- Install dependencies:
pip install -r requirements.txt
- Run the application:
uvicorn main:app --reload
- Access the API documentation at:
http://localhost:8000/docs
API Endpoints
Products
GET /products/
- List all products (with filtering options)POST /products/
- Create a new productGET /products/{product_id}
- Get product by IDGET /products/sku/{sku}
- Get product by SKUPUT /products/{product_id}
- Update productDELETE /products/{product_id}
- Delete product
Categories
GET /categories/
- List all categoriesPOST /categories/
- Create a new categoryGET /categories/{category_id}
- Get category by IDPUT /categories/{category_id}
- Update categoryDELETE /categories/{category_id}
- Delete category
Suppliers
GET /suppliers/
- List all suppliersPOST /suppliers/
- Create a new supplierGET /suppliers/{supplier_id}
- Get supplier by IDPUT /suppliers/{supplier_id}
- Update supplierDELETE /suppliers/{supplier_id}
- Delete supplier
Inventory
POST /inventory/stock-movement
- Record stock movementGET /inventory/stock-movements
- List stock movementsGET /inventory/low-stock
- Get low stock productsGET /inventory/stock-report
- Get stock analyticsPUT /inventory/adjust-stock/{product_id}
- Adjust stock levels
System
GET /
- API information and linksGET /health
- Health check endpoint
Database
The system uses SQLite database with the following storage structure:
- Database file:
/app/storage/db/db.sqlite
Environment Variables
No environment variables are required for basic operation. The system uses SQLite with default paths.
Development
Database Migrations
The project uses Alembic for database migrations:
# Run migrations
alembic upgrade head
# Create new migration
alembic revision --autogenerate -m "description"
Code Quality
The project uses Ruff for linting and formatting:
# Install ruff
pip install ruff
# Run linting
ruff check .
# Auto-fix issues
ruff check . --fix
Project Structure
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
├── alembic.ini # Alembic configuration
├── alembic/ # Database migrations
├── app/
│ ├── db/ # Database configuration
│ ├── models/ # SQLAlchemy models
│ ├── schemas/ # Pydantic schemas
│ └── routers/ # API route handlers
└── storage/
└── db/ # SQLite database storage