# cornucopia-rs/cornucopia

Generate type-checked Rust from your PostgreSQL.

Repository: https://github.com/cornucopia-rs/cornucopia
Canonical: https://ross.abutalabs.com/products/cornucopia
Language: Rust
License: Apache-2.0
License Family: permissive
Topics: postgres, postgresql, rust, sql, database
Last push: 2026-08-25T21:05:21+00:00

## Health v2 (maintenance only)
Score: 95/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 86, longevity 100
- inputs: {"age_days": 1611, "days_push": 8, "days_rel": 19, "gap_med": 86, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1130, forks 73 (observed 2026-08-28T04:03:42.355056+00:00)

## What it is
Cornucopia is a Rust code generator that produces type-checked Rust interfaces from PostgreSQL queries. It validates queries against a live database and emits a standalone crate with type-safe, high-performance database access functions.

## Use cases
- generate type-safe Rust code from PostgreSQL queries
- catch SQL errors at compile time instead of runtime
- write SQL-first database access without an ORM
- map custom Postgres types and enums to Rust structs
- generate sync and async database clients with connection pooling

## When to choose
- you prefer writing plain SQL over ORM query builders
- you want compile-time guarantees that queries match your schema
- you need performance close to hand-written rust-postgres code
- you use PostgreSQL-specific features like custom types, enums, and arrays

## When to avoid
- you need multi-database support beyond PostgreSQL
- you want a runtime ORM or dynamic query builder
- your project does not use Rust

## Facets
- artifact type: cli-tool
- maturity: active
- function: database, orm, type-system, developer-tools
- domain: databases, developer-tools, backend
- platform: rust, cli, cross-platform
- tags: sql-first, postgres, type-safety, codegen, rust-postgres, code-generation

## Member repositories
- cornucopia-rs/cornucopia (main) score 95

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:42.355056+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:38:14.473739+00:00, confidence not recorded.
  - readme: https://github.com/cornucopia-rs/cornucopia (fetched 2026-08-28T04:03:42.355056+00:00, sha 72581a2bcaab)
  - registry_crates: https://crates.io/api/v1/crates/cornucopia (fetched 2026-08-29T12:42:35.134310+00:00, sha 862a4cb70981)
- Data as of 2026-08-30T08:39:29.467469+00:00.
