Build A First Service
Maintainer-only and separately authorized development surface. Customers integrate the hosted API with an authorized client package; this tutorial is not permission to deploy or redistribute the SPAPS backend.
The quickest way for an authorized maintainer to understand the package surface is to build a tiny service that uses create_app, BaseServiceSettings, and a normal FastAPI router. This tutorial uses the reusable quickstart API, not the full SPAPS production app.
Verified source surface: spaps-server-quickstart 0.7.1 at Sweet Potato
5b09d3df1194577c5313c865fef1db98f694cdea. Use Python 3.12+. Confirm that your installed package
version contains the same API before copying the snippet:
python --version
python -c "from importlib.metadata import version; print(version('spaps-server-quickstart'))"Install the package
python -m venv .venv
source .venv/bin/activate
pip install spaps-server-quickstartIf version 0.7.1 is not available from your configured registry, install the exact sibling source used by this documentation instead:
pip install ../sweet-potato/packages/python-server-quickstartDefine settings
from spaps_server_quickstart.settings import BaseServiceSettings
class ExampleSettings(BaseServiceSettings):
app_name: str = "Example Service"
spaps_auth_enabled: bool = FalseAdd a router
from fastapi import APIRouter
router = APIRouter()
@router.get("/health")
async def health() -> dict[str, bool]:
return {"ok": True}Create the app
from spaps_server_quickstart import create_app
from spaps_server_quickstart.settings import create_settings_loader
app = create_app(
settings_loader=create_settings_loader(ExampleSettings),
api_router=router,
)Run it
uvicorn example:app --reload
curl http://127.0.0.1:8000/healthDocs maintainers can execute these Python fences plus the /health assertion against the sibling
package environment:
node scripts/verify-first-service-snippet.mjs --upstream ../sweet-potatoWhy This Works
create_app configures logging, optional CORS, optional SPAPS auth middleware, startup checks, and router mounting. The settings loader is cached by create_settings_loader, so route dependencies get stable configuration without global mutable setup.
Keep spaps_auth_enabled=False while proving the smallest app. Add SPAPS auth after the route and
settings shape are correct.