A small text generation API for African languages, and the developer documentation I wrote for it.
Independent documentation exercise. Lugha is not a real product and is not affiliated with any company. The model is a stub that returns predictable text, so every example in the docs runs and returns exactly what is shown.
I am applying for API documentation roles and I wanted to show more than writing. So I built a tiny API, ran every example against it, and documented the whole developer journey: get a key, make a first request, read the response, handle errors, and prepare for production.
The interesting part is the docs. The service exists so the docs can be honest.
app/holds the FastAPI service. Four endpoints, one error shape, API key auth and a rate limiter.docs/holds the documentation, written in Markdown and built with Sphinx and the Furo theme.examples/holds runnable samples in curl, Python and JavaScript. The docs pull code from these files, so nothing is copied by hand.openapi/openapi.yamlis exported from the service code.docs/api-reference.mdis generated from it.tests/holds the test suite, including a check that the request examples in the reference are accepted by the service.scripts/holds the two generators.
macOS and Linux:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
uvicorn app.main:app --reloadWindows PowerShell:
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements-dev.txt
uvicorn app.main:app --reloadIf activation fails with "running scripts is disabled on this system", run Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned and try again.
The service starts on http://localhost:8000. Interactive API pages are at /docs.
Open a second terminal and try it with the public demo key.
macOS and Linux:
export LUGHA_API_KEY="lugha_demo_key"
export LUGHA_BASE_URL="http://localhost:8000"
bash examples/curl/quickstart.shWindows PowerShell:
$env:LUGHA_API_KEY = "lugha_demo_key"
$env:LUGHA_BASE_URL = "http://localhost:8000"
.\examples\powershell\quickstart.ps1python -m pytest -qpip install -r docs/requirements.txt
python scripts/export_openapi.py
python scripts/build_reference.py
python -m sphinx -W -b html docs docs/_build/htmlOpen docs/_build/html/index.html in a browser. The -W flag turns any warning into an error, so a broken link or include fails the build.
The documentation runs the service locally, so you only need this section if you want a public demo.
- Push this repository to GitHub.
- On Render, create a new Blueprint from the repository. It reads
render.yamland starts the service. Check that the service URL matches the one inrender.yaml, and update it if not. - Optional: add your service URL to
docs/quickstart.mdas a hosted alternative. Free Render services sleep when idle, so mention that the first request can take up to a minute. - On Read the Docs, import the repository. It reads
.readthedocs.yamland builds the docs.
Every push runs the tests, regenerates the OpenAPI file and the API reference, fails if either is out of date, and builds the docs with warnings as errors.