
- Set up project structure and FastAPI application - Create database models with SQLAlchemy - Implement authentication with JWT - Add CRUD operations for products, inventory, categories - Implement purchase order and sales functionality - Create reporting endpoints - Set up Alembic for database migrations - Add comprehensive documentation in README.md
Small Business Inventory Management System
A comprehensive inventory management system for small businesses built with FastAPI and SQLite.
Features
- Product Management: Create, update, delete, and search products with SKU, barcode support
- Inventory Tracking: Track inventory levels across multiple locations
- Purchase Order Management: Create purchase orders and receive inventory
- Sales Tracking: Record sales and automatically update inventory
- User Authentication: Secure API with JWT authentication
- Role-Based Access Control: Admin and regular user roles
- Reporting: Several reports including inventory value, low stock, sales summary, and purchase summary
Technologies
- Backend: FastAPI (Python 3.9+)
- Database: SQLite with SQLAlchemy ORM
- Authentication: JWT tokens with OAuth2
- Migration: Alembic for database migrations
- Validation: Pydantic for data validation
- Linting: Ruff for code quality
Setup and Installation
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Run the database migrations:
alembic upgrade head
- Start the application:
python run.py
The API will be available at http://localhost:8000
API Documentation
Once the application is running, you can access:
- Interactive API documentation: http://localhost:8000/docs
- Alternative API documentation: http://localhost:8000/redoc
Default Admin User
The system comes with a default admin user:
- Email: admin@example.com
- Password: admin123
Important: Change the default password after first login!
Directory Structure
├── app # Application source code
│ ├── api # API endpoints
│ ├── core # Core functionality
│ ├── crud # CRUD operations
│ ├── db # Database setup
│ ├── models # SQLAlchemy models
│ └── schemas # Pydantic schemas
├── migrations # Alembic migrations
├── alembic.ini # Alembic configuration
├── main.py # Application entry point
├── pyproject.toml # Project configuration
├── README.md # Project documentation
├── requirements.txt # Dependencies
└── run.py # Script to run the application
API Endpoints
The API provides the following main endpoints:
Authentication
POST /api/v1/login/access-token
- Login and get access tokenPOST /api/v1/login/test-token
- Test access token validity
Users
GET /api/v1/users/
- List users (admin only)POST /api/v1/users/
- Create user (admin only)GET /api/v1/users/me
- Get current userPUT /api/v1/users/me
- Update current user
Products
GET /api/v1/products/
- List productsPOST /api/v1/products/
- Create productGET /api/v1/products/{id}
- Get productPUT /api/v1/products/{id}
- Update productDELETE /api/v1/products/{id}
- Delete product
Inventory
GET /api/v1/inventory/
- List inventoryPOST /api/v1/inventory/
- Create inventoryPOST /api/v1/inventory/adjust
- Adjust inventory
Purchase Orders
GET /api/v1/purchase-orders/
- List purchase ordersPOST /api/v1/purchase-orders/
- Create purchase orderPOST /api/v1/purchase-orders/{id}/receive
- Receive purchase order
Sales
GET /api/v1/sales/
- List salesPOST /api/v1/sales/
- Create salePOST /api/v1/sales/{id}/cancel
- Cancel sale
Reports
GET /api/v1/reports/inventory-value
- Inventory value reportGET /api/v1/reports/low-stock
- Low stock reportGET /api/v1/reports/sales-summary
- Sales summary reportGET /api/v1/reports/purchases-summary
- Purchases summary reportGET /api/v1/reports/inventory-movements
- Inventory movements report
Description
Languages
Python
99.5%
Mako
0.5%