Skip to content

Example: Gazebo Gardens 🪴

A complete, standalone OGC-style API — a multi-tenant plant catalog — that exercises every gazebo feature in a realistic shape.

This page is the "see it all together" companion to the feature pages: where those use small, isolated snippets, Gazebo Gardens shows them composed into one service. It's its own project under examples/garden/, and the repo's standing proof that the features work in concert — CI runs its suite separately.

What it demonstrates

Each feature maps to a spot in the code; read it alongside the page that explains it.

Feature Where Docs
Bare-type injection (catalog, user, tenant) garden/api.py Routers & injection
External type via Annotated[T, Inject] Session in garden/resources.py Inject marker
App scope with teardown + __health__ Database in resources.py Scopes & lifecycle
Qualified injection (primary vs replica) Catalog.__provide__ Qualifiers
Request-derived deps (auth, tenant) User / Tenant recipes Scope roots
Typed test overrides (no global mutation) tests/test_app.py Overrides
Deferred + paginated links models.py, api.py Links, Collections
Collection envelope with alias + counts PlantCollection Collections
RFC 7807 problems (404; auto 422) get_plant, bad bodies Problems
Hierarchical landing pages LinkedRouter in api.py LinkedRouter
Conformance declaration GET /conformance Landing & conformance
Proxy-aware URLs + pluggable trust trust= in create_app Proxy & context
Request-id contextvar + logging filter RequestIdMiddleware Request id & logging

Run it

cd examples/garden
uv run garden          # serve on http://127.0.0.1:8000
uv run pytest          # its test suite

Try it

A few requests that show the load-bearing behavior (full recipe set in the example README):

curl -s localhost:8000/ | jq                              # landing page + links
curl -s localhost:8000/plants                              # 401 problem (no auth)
curl -s -H 'Authorization: Bearer alice' \
     'localhost:8000/plants?limit=2' | jq                  # page 1 + a next link
curl -s -H 'Authorization: Bearer alice' -H 'X-Tenant: acme' \
     localhost:8000/plants | jq                            # a different tenant's data
curl -s -H 'Authorization: Bearer alice' \
     -H 'X-Forwarded-Proto: https' -H 'X-Forwarded-Host: garden.example.com' \
     'localhost:8000/plants?limit=1' | jq '.links'         # proxy-correct links

See also