Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. bun

bun

BSD-2-ClauseGov1.2.18

A lightweight, SQL-first Golang ORM supporting PostgreSQL, MySQL, MSSQL, SQLite, and Oracle with type safety and flexible scanning.

Visit WebsiteGitHubGitHub
4.8k stars274 forks0 contributors

What is bun?

Bun is a SQL-first Object-Relational Mapper (ORM) for the Go programming language. It allows developers to write complex SQL queries in a type-safe, Go-native way while supporting multiple databases like PostgreSQL, MySQL, and SQLite. It solves the problem of balancing SQL flexibility with Go's performance and safety, avoiding the overhead and opacity of traditional ORMs.

Target Audience

Go developers building data-intensive applications who need fine-grained control over SQL queries without sacrificing type safety or performance. It's particularly suited for teams working across multiple database backends.

Value Proposition

Developers choose Bun for its SQL-first philosophy that doesn't hide SQL behind abstraction layers, its multi-database support with consistent APIs, and its production-ready features like migrations and OpenTelemetry integration. It offers a lightweight alternative to heavier ORMs while maintaining Go's idiomatic patterns.

Overview

SQL-first Golang ORM

Use Cases

Best For

  • Building Go applications that require complex, readable SQL queries
  • Projects needing to support multiple SQL database backends (PostgreSQL, MySQL, SQLite, etc.)
  • Teams prioritizing type safety and compile-time checks for database operations
  • Applications requiring efficient bulk inserts, updates, and deletes
  • Implementing database migrations and schema versioning in Go
  • Adding observability and query debugging with OpenTelemetry integration

Not Ideal For

  • Projects requiring a fully abstracted ORM where developers want to avoid writing SQL entirely
  • Applications built on NoSQL databases like MongoDB or Cassandra
  • Teams seeking a massive ecosystem with extensive third-party plugins and integrations

Pros & Cons

Pros

SQL Transparency and Control

Bun's SQL-first approach allows developers to write complex, readable queries using Go syntax, as demonstrated in the README with CTEs and subqueries that mirror raw SQL.

Multi-Database Agnosticism

It supports PostgreSQL, MySQL, SQLite, MSSQL, and Oracle with consistent APIs, enabling code portability across different SQL backends without major rewrites.

Type Safety and Compile-Time Checks

Leverages Go's static typing to provide compile-time safety for database operations, reducing runtime errors and enhancing code reliability.

Production-Ready Tooling

Includes built-in features like migrations, fixtures, soft deletes, and OpenTelemetry integration, making it suitable for deployment in scalable applications.

Cons

SQL Proficiency Required

Since Bun doesn't abstract SQL away, developers need solid SQL knowledge to use it effectively, which can be a barrier for teams with limited database expertise.

Smaller Ecosystem Than GORM

As a newer ORM, Bun has a smaller community and fewer third-party extensions compared to established alternatives like GORM, potentially limiting out-of-the-box solutions.

Manual Schema Management

While it supports migrations, Bun lacks automatic schema generation from models, requiring developers to write and maintain migration scripts manually, increasing setup complexity.

Frequently Asked Questions

Quick Stats

Stars4,768
Forks274
Contributors0
Open Issues29
Last commit16 days ago
CreatedSince 2021

Tags

#database-driver#mssql#orm#database#oracle#migrations#postgresql#golang#type-safe#mysql#sqlite#sqlite3#go#sql

Built With

G
Golang

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 1 day ago

Related Projects

GORMGORM

The fantastic ORM library for Golang, aims to be developer friendly

Stars39,705
Forks4,146
Last commit1 month ago
entent

An entity framework for Go

Stars17,036
Forks997
Last commit10 days ago
SQLBoilerSQLBoiler

Generate a Go ORM tailored to your database schema.

Stars6,988
Forks560
Last commit1 month ago
gorpgorp

Go Relational Persistence - an ORM-ish library for Go

Stars3,755
Forks376
Last commit1 year ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub