Simple Inventory Management App
A REST API for managing inventory items built with FastAPI and SQLite.
Features
- Category management (CRUD operations)
- Item management with inventory tracking
- Inventory transactions (stock in/out)
- Search and filter functionality
- Health check endpoint
- API documentation via Swagger UI and ReDoc
Project Structure
simple-inventory-management-app/
├── alembic/ # Database migration files
├── app/ # Application code
│ ├── api/ # API endpoints
│ │ └── v1/ # API version 1
│ │ ├── endpoints/ # API route handlers
│ │ └── api.py # API router
│ ├── core/ # Core functionality
│ │ └── config.py # Application configuration
│ ├── crud/ # CRUD operations
│ ├── db/ # Database setup and session
│ ├── models/ # SQLAlchemy models
│ └── schemas/ # Pydantic schemas
└── main.py # Application entry point
Requirements
- Python 3.8+
- Dependencies listed in
requirements.txt
Installation
- Clone the repository:
git clone <repository-url>
cd simple-inventory-management-app
- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
Database Setup
The application uses SQLite as the database. The database file will be created automatically in the /app/storage/db/
directory.
To initialize the database with the latest migrations:
alembic upgrade head
Running the Application
Start the application with:
uvicorn main:app --reload
The API will be available at http://localhost:8000
API Documentation
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
Health Check
GET /api/v1/health
- Check application health
Categories
GET /api/v1/categories
- List all categoriesPOST /api/v1/categories
- Create a new categoryGET /api/v1/categories/{category_id}
- Get a specific categoryPUT /api/v1/categories/{category_id}
- Update a categoryDELETE /api/v1/categories/{category_id}
- Delete a category
Items
GET /api/v1/items
- List all items (with filtering options)POST /api/v1/items
- Create a new itemGET /api/v1/items/{item_id}
- Get a specific itemPUT /api/v1/items/{item_id}
- Update an itemDELETE /api/v1/items/{item_id}
- Delete an itemPOST /api/v1/items/{item_id}/transactions
- Add inventory transactionGET /api/v1/items/{item_id}/transactions
- Get item transaction history
Environment Variables
The application uses the following environment variables:
None required for basic operation. The application uses default values that work out of the box.
Development
Running Tests
# To be implemented
Running Linting
ruff check .
Running Formatting
ruff format .
License
Description
Languages
Python
98.9%
Mako
1.1%