Automated Action cda1825688 Implement FastAPI inventory management system for small businesses
- Set up FastAPI application with CORS and health check endpoint
- Create SQLite database models for inventory items, categories, and suppliers
- Implement complete CRUD API endpoints for all entities
- Add low-stock monitoring functionality
- Configure Alembic for database migrations
- Set up Ruff for code linting and formatting
- Include comprehensive API documentation and README
2025-06-18 16:50:29 +00:00
2025-06-18 16:44:07 +00:00

Small Business Inventory System

A comprehensive FastAPI-based inventory management system designed for small businesses.

Features

  • Inventory Management: Full CRUD operations for inventory items
  • Category Management: Organize products by categories
  • Supplier Management: Track supplier information and relationships
  • Stock Monitoring: Automated low-stock alerts
  • RESTful API: Complete API with automatic documentation
  • SQLite Database: Lightweight database with migration support

API Endpoints

Inventory Items

  • GET /api/v1/inventory/ - List all inventory items
  • POST /api/v1/inventory/ - Create new inventory item
  • GET /api/v1/inventory/{item_id} - Get specific inventory item
  • PUT /api/v1/inventory/{item_id} - Update inventory item
  • DELETE /api/v1/inventory/{item_id} - Delete inventory item
  • GET /api/v1/inventory/low-stock/ - Get low stock items

Categories

  • GET /api/v1/categories/ - List all categories
  • POST /api/v1/categories/ - Create new category
  • GET /api/v1/categories/{category_id} - Get specific category
  • PUT /api/v1/categories/{category_id} - Update category
  • DELETE /api/v1/categories/{category_id} - Delete category

Suppliers

  • GET /api/v1/suppliers/ - List all suppliers
  • POST /api/v1/suppliers/ - Create new supplier
  • GET /api/v1/suppliers/{supplier_id} - Get specific supplier
  • PUT /api/v1/suppliers/{supplier_id} - Update supplier
  • DELETE /api/v1/suppliers/{supplier_id} - Delete supplier

System

  • GET / - API information and documentation links
  • GET /health - Health check endpoint
  • GET /docs - Interactive API documentation (Swagger UI)
  • GET /redoc - Alternative API documentation

Installation

  1. Install dependencies:
pip install -r requirements.txt
  1. Run database migrations:
alembic upgrade head
  1. Start the server:
uvicorn main:app --host 0.0.0.0 --port 8000

Development

Linting

ruff check --fix .

Database Migrations

  • Create new migration: alembic revision --autogenerate -m "description"
  • Apply migrations: alembic upgrade head
  • Rollback migration: alembic downgrade -1

Database Schema

InventoryItem

  • id: Primary key
  • name: Product name
  • sku: Unique stock keeping unit
  • description: Product description
  • quantity: Current stock quantity
  • unit_price: Price per unit
  • minimum_stock: Minimum stock level for alerts
  • category_id: Foreign key to Category
  • supplier_id: Foreign key to Supplier
  • created_at: Creation timestamp
  • updated_at: Last update timestamp

Category

  • id: Primary key
  • name: Category name (unique)
  • description: Category description
  • created_at: Creation timestamp

Supplier

  • id: Primary key
  • name: Supplier name (unique)
  • contact_person: Contact person name
  • email: Contact email
  • phone: Contact phone number
  • address: Supplier address
  • created_at: Creation timestamp

Configuration

The application uses SQLite database stored at /app/storage/db/db.sqlite.

API Documentation

Once the server is running, visit:

Description
Project: Small Business Inventory System
Readme 39 KiB
Languages
Python 97.1%
Mako 2.9%