"""FastAPI application entrypoint.""" from contextlib import asynccontextmanager from fastapi import FastAPI from app.api.routers.assets import router as assets_router from app.api.routers.health import router as health_router from app.api.routers.library import router as library_router from app.api.routers.orders import router as orders_router from app.api.routers.revisions import router as revisions_router from app.api.routers.reviews import router as reviews_router from app.api.routers.workflows import router as workflows_router from app.config.settings import get_settings from app.infra.db.session import init_database @asynccontextmanager async def lifespan(_: FastAPI): """Initialize local resources for the MVP runtime.""" settings = get_settings() if settings.auto_create_tables: await init_database() yield def create_app() -> FastAPI: """Create and configure the FastAPI application.""" settings = get_settings() app = FastAPI(title=settings.app_name, debug=settings.debug, lifespan=lifespan) app.include_router(health_router) app.include_router(library_router, prefix=settings.api_prefix) app.include_router(orders_router, prefix=settings.api_prefix) app.include_router(assets_router, prefix=settings.api_prefix) app.include_router(revisions_router, prefix=settings.api_prefix) app.include_router(reviews_router, prefix=settings.api_prefix) app.include_router(workflows_router, prefix=settings.api_prefix) return app app = create_app()