Automated Action 1badf85dea Create FastAPI inventory management system for small businesses
- 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
2025-06-25 10:33:52 +00:00

94 lines
3.1 KiB
Markdown

# 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 item
- `POST /api/inventory/items` - Create new inventory item
- `PUT /api/inventory/items/{item_id}` - Update inventory item
- `DELETE /api/inventory/items/{item_id}` - Delete inventory item
### Categories
- `GET /api/inventory/categories` - List all categories
- `GET /api/inventory/categories/{category_id}` - Get specific category
- `POST /api/inventory/categories` - Create new category
- `PUT /api/inventory/categories/{category_id}` - Update category
- `DELETE /api/inventory/categories/{category_id}` - Delete category
### Suppliers
- `GET /api/inventory/suppliers` - List all suppliers
- `GET /api/inventory/suppliers/{supplier_id}` - Get specific supplier
- `POST /api/inventory/suppliers` - Create new supplier
- `PUT /api/inventory/suppliers/{supplier_id}` - Update supplier
- `DELETE /api/inventory/suppliers/{supplier_id}` - Delete supplier
### System Endpoints
- `GET /` - API information and links
- `GET /health` - Health check endpoint
- `GET /docs` - Interactive API documentation (Swagger UI)
- `GET /redoc` - Alternative API documentation
## Quick Start
1. Install dependencies:
```bash
pip install -r requirements.txt
```
2. Run database migrations:
```bash
alembic upgrade head
```
3. Start the development server:
```bash
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
```