server/main.py

FastAPI application bootstrap with lifecycle hooks, middleware, and router registration.

CategoryBackend
Sourceserver/main.py

What it does

FastAPI application bootstrap with lifecycle hooks, middleware, and router registration.

Key responsibilities

  • Defines a FastAPI app with a lifespan manager that initializes the database and starts scheduler/process lifecycle.
  • Registers APIKeyMiddleware for optional auth protection on API routes.
  • Adds CORS middleware and mounts static frontend assets when the production build exists.
  • Includes routers for chat, memory, calendar, system, voice, Spotify, state, training, sleep, vision, Luna, and agent APIs.
  • Serves the SPA shell as a fallback route when the frontend is built to disk.

Related files

Explore other files in the Backend category.