# uptrace/bun

SQL-first Golang ORM

Repository: https://github.com/uptrace/bun
Canonical: https://ross.abutalabs.com/products/uptrace-bun
Homepage: https://bun.uptrace.dev
Language: Go
License: BSD-2-Clause
License Family: permissive
Topics: golang, go, orm, sql, mysql, postgresql, sqlite, sqlite3, database, mssql, oracle
Last push: 2026-08-21T14:17:15+00:00

## Health v2 (maintenance only)
Score: 89/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 98, release rhythm 72, longevity 100
- inputs: {"age_days": 1948, "days_push": 12, "days_rel": 186, "gap_med": 23, "n_releases_24m": 14}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 4941, forks 296 (observed 2026-08-28T04:09:03.565353+00:00)

## What it is
Bun is a lightweight, SQL-first ORM for Go built on database/sql, supporting PostgreSQL, MySQL/MariaDB, MSSQL, SQLite, and Oracle. It provides type-safe query building, flexible result scanning, migrations, fixtures, soft deletes, and OpenTelemetry tracing while keeping SQL front and center.

## Use cases
- build type-safe SQL queries in Go without hiding the SQL
- manage database schema migrations for a Go application
- query results into structs, maps, scalars, or slices
- write one codebase that works across PostgreSQL, MySQL, MSSQL, SQLite, and Oracle
- add query tracing with OpenTelemetry to database calls
- implement soft deletes and table relationships with struct tags

## When to choose
- you want ORM convenience but full control over generated SQL
- you need multi-database support from a single Go codebase
- you prefer compile-time type safety over string-based query building
- you want a lightweight layer over database/sql with minimal overhead

## When to avoid
- you want a fully abstracted ORM that hides SQL entirely
- your project uses a non-SQL database
- you need an ORM outside the Go ecosystem

## Facets
- artifact type: library
- maturity: stable
- function: orm, database, database-driver
- domain: databases, backend, web-development, developer-tools
- platform: go, windows, cross-platform
- tags: sql-first, query-builder, migrations, postgresql, mysql, sqlite, mssql, oracle, opentelemetry, linux, macos

## Member repositories
- uptrace/bun (main) score 89

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:03.565353+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-29T18:17:55.072700+00:00, confidence not recorded.
  - readme: https://github.com/uptrace/bun (fetched 2026-08-28T04:09:03.565353+00:00, sha 2b5204e2fdab)
  - homepage: https://bun.uptrace.dev (fetched 2026-08-29T08:59:26.570142+00:00, sha e9f1430455e9)
- Data as of 2026-08-30T08:39:29.467469+00:00.
