Skip to content

carbonplan/offsets-db-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

185 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

carbonplan / offsets-db-api

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.

Fly.io Deployment Database Update MIT License Code Coverage Status

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

installation

This project uses pixi for dependency management. To get started:

git clone https://github.com/carbonplan/offsets-db-api
cd offsets-db-api
pixi install

local development

Note

A running PostgreSQL instance is required. Two options are provided: Docker Compose (recommended) or a local server managed by pixi.

Option A — Docker Compose (recommended)

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 serve

The 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-down

Option B — pixi-managed Postgres (no Docker)

The 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 serve

To stop the server: pixi run db-stop. The data directory is kept in .pixi-postgres/ (gitignored).

usage

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 server

license

All the code in this repository is MIT licensed.

Important

Data associated with this repository are subject to additional terms of data access.

about us

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.

About

accounting of voluntary and compliance offset programs

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

 
 
 

Contributors

Languages