OffsetsDB-API, is a fastAPI application, designed to integrate and harmonize data related to the issuance and use of offset credits from the six major offset registries. This database aims to promote transparency and accountability in the carbon offsets market. It provides an accessible online tool, data downloads, and APIs for researchers, journalists, and regulators.
| Project | GitHub Repo |
|---|---|
| offsets-db-web | https://github.com/carbonplan/offsets-db-web |
| offsets-db-api | https://github.com/carbonplan/offsets-db-api |
| offsets-db-data | https://github.com/carbonplan/offsets-db-data |
This project uses pixi for dependency management. To get started:
git clone https://github.com/carbonplan/offsets-db-api
cd offsets-db-api
pixi installNote
A running PostgreSQL instance is required. Two options are provided: Docker Compose (recommended) or a local server managed by pixi.
Requires Docker Desktop (or any Docker engine).
# 1. Copy the example env file and adjust if needed
cp .env.example .env
# 2. Start Postgres and apply migrations in one step
pixi run dev-setup
# 3. Start the API server with hot reload
pixi run serveThe API will be available at http://localhost:8000 — interactive docs at http://localhost:8000/docs.
# Run tests (DB must be running)
pixi run test
# Stop Postgres
pixi run db-downThe postgresql package is already in the pixi environment.
# 1. Copy the example env file
cp .env.example .env
# 2. One-time: initialise the data directory and create the database
pixi run db-init
# 3. Start the server and apply migrations
pixi run db-start
pixi run migrate
# 4. Launch the API
pixi run serveTo stop the server: pixi run db-stop. The data directory is kept in .pixi-postgres/ (gitignored).
pixi run serve # Start development server with hot reload
pixi run test # Run tests (requires a running DB)
pixi run migrate # Run database migrations
pixi run serve-prod # Start production serverAll the code in this repository is MIT licensed.
Important
Data associated with this repository are subject to additional terms of data access.
CarbonPlan is a non-profit organization that uses data and science for climate action. We aim to improve the transparency and scientific integrity of carbon removal and climate solutions through open data and tools. Find out more at carbonplan.org or get in touch by opening an issue or sending us an email.