from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.api.v1 import api_router from app.db.session import create_tables from app.core.config import settings app = FastAPI( title=settings.app_name, description="Backend API for Landing Page with authentication, payments, and communication features", version="1.0.0", openapi_url="/openapi.json" ) # CORS middleware app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # Include API routes app.include_router(api_router, prefix="/api/v1") @app.on_event("startup") async def startup_event(): create_tables() @app.get("/") async def root(): return { "title": settings.app_name, "description": "Backend API for Landing Page with authentication, payments, and communication features", "documentation": "/docs", "health_check": "/health", "version": "1.0.0" } @app.get("/health") async def health_check(): return { "status": "healthy", "service": settings.app_name, "version": "1.0.0" }