Reorganize to fastapi template

This commit is contained in:
2026-01-10 13:22:02 +00:00
parent 7818a3fb44
commit 9f7db47528
41 changed files with 711 additions and 2415 deletions

3
app/__init__.py Normal file
View File

@@ -0,0 +1,3 @@
"""`app` package for the project."""
__all__ = ["main"]

3
app/api/__init__.py Normal file
View File

@@ -0,0 +1,3 @@
"""API package for routers."""
__all__ = ["health"]

9
app/api/health.py Normal file
View File

@@ -0,0 +1,9 @@
from fastapi import APIRouter
router = APIRouter()
@router.get("/health", tags=["health"])
async def health_check():
"""Minimal health endpoint."""
return {"status": "ok"}

3
app/core/__init__.py Normal file
View File

@@ -0,0 +1,3 @@
"""Core package for settings and helpers."""
__all__ = ["config"]

8
app/core/config.py Normal file
View File

@@ -0,0 +1,8 @@
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
PROJECT_NAME: str = "home-automation-backend"
settings = Settings()

18
app/main.py Normal file
View File

@@ -0,0 +1,18 @@
from fastapi import FastAPI
from app.api.health import router as health_router
from app.core.config import settings
def create_app() -> FastAPI:
app = FastAPI(title=settings.PROJECT_NAME)
app.include_router(health_router, prefix="/api")
@app.get("/")
async def root():
return {"message": "Welcome to the minimal FastAPI template"}
return app
app = create_app()