Automated Action 252ce19872 Implement complete small business inventory management system
Features include:
- User management with JWT authentication and role-based access
- Inventory items with SKU/barcode tracking and stock management
- Categories and suppliers organization
- Inventory transactions with automatic stock updates
- Low stock alerts and advanced search/filtering
- RESTful API with comprehensive CRUD operations
- SQLite database with Alembic migrations
- Auto-generated API documentation

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-21 16:10:33 +00:00

53 lines
1.3 KiB
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
from app.api.routes import api_router
from app.core.config import settings
from app.db.session import engine
from app.db.base import Base
# Create database tables
Base.metadata.create_all(bind=engine)
app = FastAPI(
title=settings.PROJECT_NAME,
version=settings.VERSION,
description=settings.DESCRIPTION,
openapi_url="/openapi.json",
docs_url="/docs",
redoc_url="/redoc"
)
# CORS configuration
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include API routes
app.include_router(api_router, prefix="/api/v1")
@app.get("/")
async def root():
return JSONResponse(content={
"title": settings.PROJECT_NAME,
"version": settings.VERSION,
"description": settings.DESCRIPTION,
"documentation": "/docs",
"health_check": "/health"
})
@app.get("/health")
async def health_check():
return JSONResponse(content={
"status": "healthy",
"service": settings.PROJECT_NAME,
"version": settings.VERSION
})
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)