Scaffold backend (FastAPI/uv) and frontend (SvelteKit/bun)
Backend: FastAPI app with health check, AppError hierarchy, stderr logging via LOG_LEVEL, ruff+pyright(strict) config, pytest passing. Frontend: SvelteKit (TS) with prettier, eslint, vitest (unit + component), adapter-node for self-hosted deployment on Zeus. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
06df9df339
commit
e5b4f54cd8
33 changed files with 517 additions and 4 deletions
33
backend/app/main.py
Normal file
33
backend/app/main.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
"""Sagaphone FastAPI entrypoint.
|
||||
|
||||
Routes are added as features land (see ../SPEC.md and ../spec/*.md).
|
||||
This currently only wires up app creation, logging, and a health check
|
||||
so the scaffold is runnable end to end.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
from app.errors import AppError
|
||||
from app.logging_config import configure_logging
|
||||
|
||||
configure_logging()
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
app = FastAPI(title="Sagaphone", version="0.1.0")
|
||||
|
||||
|
||||
@app.exception_handler(AppError)
|
||||
async def app_error_handler(_request: Request, exc: AppError) -> JSONResponse:
|
||||
"""Edge-catch: translate AppError subclasses into clean HTTP responses."""
|
||||
logger.error("request failed: %s", exc.message)
|
||||
return JSONResponse(status_code=exc.status_code, content={"error": exc.message})
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
async def health() -> dict[str, str]:
|
||||
return {"status": "ok"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue