"""Main entry point for the MeloonAITools Backend. This module initializes the FastAPI application, configures CORS, and registers all routers for the application. """ from typing import Dict from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.routers import auth from app.routers import comments from app.routers import dynamics from app.routers import games from app.routers import prompts from app.routers import ratings from app.routers import tools app = FastAPI( title="MeloonAITools Backend", description="Backend API for MeloonAITools using FastAPI and Supabase.", version="1.0.0", ) # Configure CORS app.add_middleware( CORSMiddleware, allow_origins=["*"], # Adjust according to your frontend URL in production allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # Include routers app.include_router(auth.router, prefix="/api/auth", tags=["Authentication"]) app.include_router(tools.router, prefix="/api/tools", tags=["Tools"]) app.include_router(games.router, prefix="/api/games", tags=["Games"]) app.include_router(prompts.router, prefix="/api/prompts", tags=["Prompts"]) app.include_router(dynamics.router, prefix="/api/dynamics", tags=["Dynamics"]) app.include_router(ratings.router, prefix="/api/ratings", tags=["Ratings"]) app.include_router(comments.router, prefix="/api/comments", tags=["Comments"]) @app.get("/") def read_root() -> Dict[str, str]: """Returns a welcome message.""" return {"message": "Welcome to MeloonAITools API"}