# backend/app/main.py from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.api import routes from app.api import profile_analytics # <--- ADD THIS IMPORT from app.core.ml_manager import ml_manager from contextlib import asynccontextmanager from app.core.config import settings @asynccontextmanager async def lifespan(app: FastAPI): ml_manager.initialize(settings.DATA_DIR) yield app = FastAPI(title="Resonate API", lifespan=lifespan) app.add_middleware( CORSMiddleware, # Strip the local LAN IP for production. Replace with your actual frontend URL later. allow_origins=["http://localhost:3000", "https://your-vercel-domain.vercel.app"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # Include both routers! app.include_router(routes.router, prefix=settings.API_V1_STR) app.include_router(profile_analytics.router, prefix=settings.API_V1_STR) # <--- ADD THIS LINE