About this project
Bun is a modern Golang ORM designed for developers who prefer writing SQL directly but want the benefits of type safety, structured querying, and database portability. Unlike ORMs that abstract SQL away, Bun embraces it — allowing you to build complex, readable queries using Go methods while maintaining full control over generated SQL.
It supports multiple databases including PostgreSQL, MySQL/MariaDB, SQLite, Microsoft SQL Server, and Oracle, each with its own driver and dialect. Queries can be scanned into structs, maps, slices, or scalar values, offering flexibility in how data is consumed. Relationships between tables are defined via struct tags, enabling eager loading of related models like has-many or belongs-to.
Bun includes production-ready features such as migrations (with versioned schema changes), bulk operations (insert/update/delete), soft deletes, and OpenTelemetry integration for observability. Debugging is supported through verbose query logging, and performance is optimized by building on top of Go’s standard `database/sql` package with minimal overhead.
The library provides extensive documentation, examples, and a starter kit for production use. It also integrates with Uptrace, an open-source APM tool, for distributed tracing and monitoring. Community support is available via Discord and GitHub discussions.
Ideal for teams seeking a balance between SQL expressiveness and ORM convenience, Bun avoids magic while delivering powerful, maintainable data access layers in Go applications.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.