skillfed

stac-fastapi-pgstac

An implementation of STAC API based on the FastAPI framework and using the pgstac backend.

stac-fastapi-pgstac v6.3.1 80.1K downloads/30d#14,322 on PyPI111
Permissive license MIT Active released

What it is and what it does

stac-fastapi-pgstac is a FastAPI application that wraps PgSTAC, a PostgreSQL-backed STAC (SpatioTemporal Asset Catalog) database engine. It validates incoming HTTP requests against the STAC API specification, delegates search and retrieval operations to PgSTAC's procedural SQL functions, and enriches responses with standardized STAC links. The package stores all collection and item records as JSONB fields in PostgreSQL, preserving custom fields transparently.

The package is designed for deployments that need a standards-compliant HTTP interface to large geospatial metadata catalogs. It supports the STAC Sort Extension (with optimized datetime sorting), optional API-level or database-level result hydration, and the Multi-Tenant Catalogs Extension for hierarchical catalog structures with directed acyclic graph support. Runtime dependencies include asyncpg for async database access, pydantic for validation, and orjson for fast JSON serialization.

Use it for:

  • Expose a searchable STAC API endpoint over HTTP for a PostgreSQL-backed geospatial metadata catalog
  • Build a multi-tenant geospatial data platform with hierarchical catalogs and poly-hierarchy link navigation
  • Integrate STAC search into a larger FastAPI application using stac-fastapi-pgstac as a backend module
  • Serve large spatiotemporal asset collections with optimized datetime-based sorting and filtering
  • Deploy a STAC API with custom JSON fields preserved transparently through JSONB storage

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a FastAPI-based HTTP interface to PgSTAC, a PostgreSQL backend for STAC API, enabling search and retrieval of geospatial collection and item metadata.

Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and is MIT-licensed. Install it if you need a production-ready STAC API server backed by PostgreSQL. Prerequisite: you must provision a PgSTAC database schema and have PostgreSQL with PostGIS available; the package itself is the HTTP layer, not a standalone database.

Install

stac-fastapi-pgstac on PyPI

pip

pip install stac-fastapi-pgstac

uv

uv add stac-fastapi-pgstac

poetry

poetry add stac-fastapi-pgstac

Installing stac-fastapi-pgstac

Before you install

Low install friction with a pure-Python wheel. Active maintenance with a recent release 51 days ago and a commit history through August 2026. Requires 14 runtime dependencies including asyncpg, pydantic, and stac-fastapi ecosystem packages.

License in practice

MIT license (permissive) allows commercial and private use with minimal restrictions, making it suitable for both open and proprietary deployments.

Quickstart

# Install
pip install stac-fastapi-pgstac

# Minimal usage (requires PgSTAC database configured)
from stac_fastapi_pgstac.app import StacApi
from stac_fastapi_pgstac.config import Settings

settings = Settings()
app = StacApi.build(settings=settings)

Requires a running PostgreSQL database with PgSTAC schema installed and pypgstac package available; Python >=3.11

Verify before relying

  • Whether PgSTAC database schema and pypgstac package are automatically provisioned or require separate setup
  • Performance characteristics for repositories with millions of records beyond datetime sorting
  • Whether Docker Compose is required for local development or if PostgreSQL/PostGIS can be configured standalone

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 14 — asyncpg, attrs, brotli-asgi, buildpg, cql2, hydraters, json-merge-patch, jsonpatch, orjson, pydantic-settings, pydantic, stac-fastapi-api, stac-fastapi-extensions, stac-fastapi-types
Maintenance actively maintained — 51 days since the last release
Last repo commit
First released
Downloads 80,082/month — #14,322 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: stac_fastapi_pgstac-6.3.1-py3-none-any.whl

Keywords: FastAPI, PgSTAC, STAC, STAC-API

Intended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

stac api fastapi backendspatiotemporal catalog searchpgstac http interfacegeospatial metadata apistac item search serverpostgresql stac catalogfastapi stac implementation
stac-cataloggeospatial-apipostgresql-backend

More Dynamic Content packages