""" Art-DAG L1 Server Application Factory. Creates and configures the FastAPI application with all routers and middleware. """ from pathlib import Path from fastapi import FastAPI from fastapi.staticfiles import StaticFiles from artdag_common import create_jinja_env from .config import settings def create_app() -> FastAPI: """ Create and configure the L1 FastAPI application. Returns: Configured FastAPI instance """ app = FastAPI( title="Art-DAG L1 Server", description="Content-addressed media processing with distributed execution", version="1.0.0", ) # Initialize Jinja2 templates template_dir = Path(__file__).parent / "templates" app.state.templates = create_jinja_env(template_dir) # Include routers from .routers import auth, storage, api, recipes, cache, runs, home # API routers app.include_router(auth.router, prefix="/auth", tags=["auth"]) app.include_router(storage.router, prefix="/storage", tags=["storage"]) app.include_router(api.router, prefix="/api", tags=["api"]) app.include_router(recipes.router, tags=["recipes"]) app.include_router(cache.router, tags=["cache"]) app.include_router(runs.router, tags=["runs"]) app.include_router(home.router, tags=["home"]) return app # Create the default app instance app = create_app()