
- Set up FastAPI application with SQLite database - Implemented CRUD operations for inventory items, categories, and suppliers - Added Alembic migrations for database schema management - Configured CORS middleware for cross-origin requests - Added health check and API documentation endpoints - Structured project with proper separation of concerns - Added comprehensive README with API documentation
Small Business Inventory Management System
A FastAPI-based inventory management system designed for small businesses to track their inventory, suppliers, and product categories.
Features
- Inventory Management: Complete CRUD operations for inventory items
- Category Management: Organize products by categories
- Supplier Management: Track supplier information and relationships
- Low Stock Alerts: Filter items by low stock levels
- RESTful API: Full REST API with automatic documentation
- Database Migrations: Alembic for database schema management
API Endpoints
Inventory Items
GET /api/inventory/items
- List all inventory items (with optional filters)GET /api/inventory/items/{item_id}
- Get specific inventory itemPOST /api/inventory/items
- Create new inventory itemPUT /api/inventory/items/{item_id}
- Update inventory itemDELETE /api/inventory/items/{item_id}
- Delete inventory item
Categories
GET /api/inventory/categories
- List all categoriesGET /api/inventory/categories/{category_id}
- Get specific categoryPOST /api/inventory/categories
- Create new categoryPUT /api/inventory/categories/{category_id}
- Update categoryDELETE /api/inventory/categories/{category_id}
- Delete category
Suppliers
GET /api/inventory/suppliers
- List all suppliersGET /api/inventory/suppliers/{supplier_id}
- Get specific supplierPOST /api/inventory/suppliers
- Create new supplierPUT /api/inventory/suppliers/{supplier_id}
- Update supplierDELETE /api/inventory/suppliers/{supplier_id}
- Delete supplier
System Endpoints
GET /
- API information and linksGET /health
- Health check endpointGET /docs
- Interactive API documentation (Swagger UI)GET /redoc
- Alternative API documentation
Quick Start
-
Install dependencies:
pip install -r requirements.txt
-
Run database migrations:
alembic upgrade head
-
Start the development server:
uvicorn main:app --reload
The API will be available at http://localhost:8000
Documentation
- Interactive API docs:
http://localhost:8000/docs
- Alternative docs:
http://localhost:8000/redoc
- OpenAPI JSON:
http://localhost:8000/openapi.json
Database
This application uses SQLite as the database backend. The database file is stored at /app/storage/db/db.sqlite
.
Project Structure
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
├── alembic.ini # Alembic configuration
├── alembic/ # Database migrations
│ ├── env.py
│ ├── script.py.mako
│ └── versions/
│ └── 001_initial_migration.py
└── app/
├── api/
│ └── inventory.py # API endpoints
├── db/
│ ├── base.py # SQLAlchemy base
│ └── session.py # Database session
├── models/
│ └── inventory.py # Database models
└── schemas/
└── inventory.py # Pydantic schemas
Description
Languages
Python
97%
Mako
3%