"""FastAPI application factory. ``create_app(state, cfg)`` builds the app, binds the shared singletons (the process-wide :class:`ServiceState` and :class:`SyncConfig`) into the dependency graph, and mounts route modules. New operational endpoints are added by creating a ``routes/.py`` with an ``APIRouter`` and ``include_router``- ing it here. """ from __future__ import annotations from fastapi import FastAPI from ..config import SyncConfig from ..health import ServiceState from . import deps from .routes import compact as compact_routes from .routes import health as health_routes def create_app(state: ServiceState, cfg: SyncConfig) -> FastAPI: """Build the FastAPI app with health state/config bound for injection.""" app = FastAPI( title="DataMacroSync", description="Access -> SQL Server incremental sync operational API", version="1.0.0", # Keep all auto-generated docs under /api alongside the operational # routes, so the whole HTTP surface shares one prefix. docs_url="/api/docs", redoc_url="/api/redoc", openapi_url="/api/openapi.json", ) deps.bind(state, cfg) app.include_router(compact_routes.router) app.include_router(health_routes.router) return app