Skip to main content

STAC FastAPI extension for multi-tenant catalogs

Project description

Jump to: | Table of Contents |

Downloads PyPI version STAC

stac-fastapi multi-tenant virtual catalogs extension

STAC FastAPI extension for multi-tenant, recursive catalog hierarchies.

This package adds a dedicated /catalogs registry and scoped catalog routes so a single STAC API deployment can serve multiple logical catalog trees. It is designed for use cases where one API needs tenant-style isolation, curated views, provider-specific trees, or thematic navigation across shared datasets.

The extension supports poly-hierarchy (multi-parenting), where a collection or catalog can be linked under multiple catalog paths without duplicating data. It also supports contextual navigation for scoped routes, preserving UI breadcrumb behavior while still exposing alternative parents through related links.

Implementation status

Project Status Notes
stac-fastapi-elasticsearch-opensearch (SFEOS) Implemented Active integration target for this extension
stac-fastapi-pgstac Not implemented yet In Progress
stac-fastapi-mongo Not implemented yet Planned

Last verified: 2026-03-22

Table of contents

Specification reference

This implementation is aligned with the Multi-Tenant Catalogs extension work in StacLabs:

Notable concepts adopted here include:

  • Recursive /catalogs endpoint structure
  • Optional transaction management plane
  • Safety-first unlink semantics (organizational operations are non-destructive)
  • Runtime link generation for parent/child/related relationships

Conformance class guidance

When enabling this extension in your deployment, advertise conformance classes according to your enabled capabilities:

Operational guidance:

  • Read-only/public APIs should not expose POST/PUT/DELETE catalog endpoints and should not advertise the transaction conformance class.
  • If transactions are enabled, expose and document the management endpoints and include the transaction conformance class in conformance responses.

Supported projects

This extension is designed for STAC FastAPI deployment applications and is currently supported in:

Planned (not yet implemented):

It can also be integrated into custom STAC FastAPI deployments that implement the AsyncBaseCatalogsClient contract.

What this package provides

  • Two STAC FastAPI extension classes:
    • CatalogsExtension: Read-only discovery endpoints for catalogs
    • CatalogsTransactionExtension: Write operations (POST, PUT, DELETE) for catalog management
  • Request/response models for catalogs and children APIs
  • An abstract client contract: AsyncBaseCatalogsClient

This package wires routes and validation into your API. Your deployment app is responsible for providing a concrete client implementation backed by your database/search stack.

Install

pip install stac-fastapi-catalogs-extension

Integrate in a STAC FastAPI deployment

In your deployment app.py (for example in stac-fastapi-elasticsearch-opensearch), instantiate StacApi with CatalogsExtension and optionally CatalogsTransactionExtension, passing an implementation of AsyncBaseCatalogsClient.

Read-only deployment (discovery only)

from stac_fastapi.api.app import StacApi
from stac_fastapi.types.config import ApiSettings

from stac_fastapi_catalogs_extension import (
    CatalogsExtension,
    CATALOGS_CORE_CONFORMANCE,
)
from my_project.catalogs_client import CatalogsClient
from my_project.core_client import CoreClient


settings = ApiSettings()

core_client = CoreClient(...)
catalogs_client = CatalogsClient(...)

api = StacApi(
    settings=settings,
    client=core_client,
    extensions=[
        CatalogsExtension(
            client=catalogs_client,
            conformance_classes=list(CATALOGS_CORE_CONFORMANCE),
            settings=settings.model_dump(),
        )
    ],
)

app = api.app

With transaction support (read and write)

from stac_fastapi.api.app import StacApi
from stac_fastapi.types.config import ApiSettings

from stac_fastapi_catalogs_extension import (
    CatalogsExtension,
    CatalogsTransactionExtension,
)
from my_project.catalogs_client import CatalogsClient
from my_project.core_client import CoreClient


settings = ApiSettings()

core_client = CoreClient(...)
catalogs_client = CatalogsClient(...)

api = StacApi(
    settings=settings,
    client=core_client,
    extensions=[
        CatalogsExtension(
            client=catalogs_client,
            settings=settings.model_dump(),
        ),
        CatalogsTransactionExtension(
            client=catalogs_client,
            settings=settings.model_dump(),
        ),
    ],
)

app = api.app

The transaction conformance class is automatically registered when CatalogsTransactionExtension is included.

Backend client requirements

Your CatalogsClient should subclass AsyncBaseCatalogsClient and implement the required async methods, including:

  • get_catalogs
  • get_catalog
  • create_catalog
  • update_catalog
  • delete_catalog
  • get_catalog_collections
  • create_catalog_collection
  • get_catalog_collection
  • unlink_catalog_collection
  • get_catalog_collection_items
  • get_catalog_collection_item
  • get_sub_catalogs
  • create_sub_catalog
  • unlink_sub_catalog
  • get_catalog_children
  • get_catalog_conformance
  • get_catalog_queryables

Notes for common deployment repos

stac-fastapi-elasticsearch-opensearch style deployment

  • Build a catalogs client that reads/writes catalog links and hierarchy metadata from your OpenSearch/Elasticsearch index strategy.
  • Reuse your existing core client for global /collections and /search routes.
  • Add CatalogsExtension to the extensions list in app.py as shown above.

stac-fastapi-pgstac style deployment (planned)

  • Build a catalogs client that maps these methods to SQL functions or pgstac tables/views that represent catalog hierarchy and scoped membership.
  • Keep link generation contextual for scoped routes (/catalogs/{id}/collections/{collection_id}) so UI breadcrumb navigation stays correct.
  • Add CatalogsExtension to the extensions list in app.py as shown above.

Endpoints added by this extension

CatalogsExtension (read-only discovery)

  • GET /catalogs
  • GET /catalogs/{catalog_id}
  • GET /catalogs/{catalog_id}/collections
  • GET /catalogs/{catalog_id}/collections/{collection_id}
  • GET /catalogs/{catalog_id}/collections/{collection_id}/items
  • GET /catalogs/{catalog_id}/collections/{collection_id}/items/{item_id}
  • GET /catalogs/{catalog_id}/catalogs
  • GET /catalogs/{catalog_id}/children
  • GET /catalogs/{catalog_id}/conformance
  • GET /catalogs/{catalog_id}/queryables

CatalogsTransactionExtension (write operations)

When CatalogsTransactionExtension is enabled, the following additional endpoints are available for catalog and collection management:

  • POST /catalogs
  • PUT /catalogs/{catalog_id}
  • DELETE /catalogs/{catalog_id}
  • POST /catalogs/{catalog_id}/collections
  • DELETE /catalogs/{catalog_id}/collections/{collection_id}
  • POST /catalogs/{catalog_id}/catalogs
  • DELETE /catalogs/{catalog_id}/catalogs/{sub_catalog_id}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stac_fastapi_catalogs_extension-0.2.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file stac_fastapi_catalogs_extension-0.2.0.tar.gz.

File metadata

File hashes

Hashes for stac_fastapi_catalogs_extension-0.2.0.tar.gz
Algorithm Hash digest
SHA256 133218f8ee45ff907337e6c2e823fcacafd317511b293ff49a969264a1584435
MD5 528de1c9a5e3f1e2ee029ff0864b4d48
BLAKE2b-256 785afa3073be89f34585db49a2eebe782ba903d5d668b2e881b74e43e0ec6289

See more details on using hashes here.

File details

Details for the file stac_fastapi_catalogs_extension-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for stac_fastapi_catalogs_extension-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51bbaab5665c3f44e2b2b27fa3653d1c2a4a75eda3728094ec9cd8bef300788d
MD5 cf76fab6a302becad593841272a849dd
BLAKE2b-256 ea220cc9e56947c5bd54cfefc7e2b5e50e01db94d1a6e5f7da9b1a3b26a0d43f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page