Automated Action 4e60587fda Create simple inventory management app with FastAPI and SQLite
- Set up project structure with FastAPI
- Implement SQLAlchemy models for inventory items and categories
- Create database connection with SQLite
- Add CRUD operations for inventory management
- Implement API endpoints for categories, items, and inventory transactions
- Add health check endpoint
- Set up Alembic for database migrations
- Update README with documentation
2025-06-17 03:54:50 +00:00

137 lines
3.2 KiB
Markdown

# 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
1. Clone the repository:
```bash
git clone <repository-url>
cd simple-inventory-management-app
```
2. Create a virtual environment and activate it:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
3. Install dependencies:
```bash
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:
```bash
alembic upgrade head
```
## Running the Application
Start the application with:
```bash
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 categories
- `POST /api/v1/categories` - Create a new category
- `GET /api/v1/categories/{category_id}` - Get a specific category
- `PUT /api/v1/categories/{category_id}` - Update a category
- `DELETE /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 item
- `GET /api/v1/items/{item_id}` - Get a specific item
- `PUT /api/v1/items/{item_id}` - Update an item
- `DELETE /api/v1/items/{item_id}` - Delete an item
- `POST /api/v1/items/{item_id}/transactions` - Add inventory transaction
- `GET /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
```bash
# To be implemented
```
### Running Linting
```bash
ruff check .
```
### Running Formatting
```bash
ruff format .
```
## License
[MIT](LICENSE)