Move API docs to conventional paths: /docs, /redoc, /openapi.json

Users expect Swagger at /docs; the app had mounted them under /api/*.
Also normalize user-facing product name to "SHONAR" in the app title and
root route (Python package stays shonar), and regenerate the shared
OpenAPI contract.
This commit is contained in:
avi 2026-09-08 13:59:15 -05:00
commit f01900be84
3 changed files with 14 additions and 11 deletions

View file

@ -34,8 +34,9 @@ cp .env.example .env
docker compose up -d --build docker compose up -d --build
``` ```
Then open `http://localhost:8000/api/docs` for the interactive API docs and Then open `http://localhost:8000/docs` for the interactive API docs and
point the Android app at your server URL. point the Android app at your server URL. (ReDoc at `/redoc`, raw schema at
`/openapi.json`.)
The default compose stack is: API + worker + PostgreSQL + Redis, with audio The default compose stack is: API + worker + PostgreSQL + Redis, with audio
stored on the local filesystem. No paid cloud service is required. stored on the local filesystem. No paid cloud service is required.
@ -84,7 +85,7 @@ you always know if your audio or text leaves your machine.
## Documentation ## Documentation
- [docs/self-hosting.md](docs/self-hosting.md) — deployment, HTTPS, backups - [docs/self-hosting.md](docs/self-hosting.md) — deployment, HTTPS, backups
- [docs/api.md](docs/api.md) — API overview (OpenAPI at `/api/docs`) - [docs/api.md](docs/api.md) — API overview (OpenAPI at `/openapi.json`)
- [docs/security.md](docs/security.md) — security model and honest limits - [docs/security.md](docs/security.md) — security model and honest limits
- [docs/architecture.md](docs/architecture.md) — system design - [docs/architecture.md](docs/architecture.md) — system design
- [docs/recording-consent.md](docs/recording-consent.md) — legal notice - [docs/recording-consent.md](docs/recording-consent.md) — legal notice

View file

@ -34,15 +34,17 @@ async def lifespan(app: FastAPI):
app = FastAPI( app = FastAPI(
title="S.H.O.N.A.R. API", title="SHONAR API",
description=( description=(
"Self-hosted Oral Notes and Audio Recorder — REST API. All data stays on your server." "SHONAR — Self-hosted Oral Notes and Audio Recorder. REST API. "
"All data stays on your server."
), ),
version=__version__, version=__version__,
lifespan=lifespan, lifespan=lifespan,
docs_url="/api/docs", # Interactive docs at the conventional paths.
redoc_url="/api/redoc", docs_url="/docs",
openapi_url="/api/openapi.json", redoc_url="/redoc",
openapi_url="/openapi.json",
) )
app.state.limiter = limiter app.state.limiter = limiter
@ -61,4 +63,4 @@ app.include_router(api_router)
@app.get("/") @app.get("/")
async def root(): async def root():
return {"app": "S.H.O.N.A.R.", "docs": "/api/docs", "health": "/api/v1/healthz"} return {"app": "SHONAR", "docs": "/docs", "health": "/api/v1/healthz"}

View file

@ -327,8 +327,8 @@
} }
}, },
"info": { "info": {
"description": "Self-hosted Oral Notes and Audio Recorder \u2014 REST API. All data stays on your server.", "description": "SHONAR \u2014 Self-hosted Oral Notes and Audio Recorder. REST API. All data stays on your server.",
"title": "S.H.O.N.A.R. API", "title": "SHONAR API",
"version": "0.1.0" "version": "0.1.0"
}, },
"openapi": "3.1.0", "openapi": "3.1.0",