Analysis updated 2026-06-20
Build a Go web API that reads and writes user records to PostgreSQL without writing raw SQL queries.
Auto-migrate your database schema from Go struct definitions so tables stay in sync with your code.
Handle database relationships like users-with-posts or posts-with-tags using Go structs instead of manual JOIN queries.
Add lifecycle hooks to automatically run logic before or after a record is created or updated in the database.
| go-gorm/gorm | gofiber/fiber | photoprism/photoprism | |
|---|---|---|---|
| Stars | 39,729 | 39,690 | 39,629 |
| Language | Go | Go | Go |
| Setup difficulty | easy | easy | moderate |
| Complexity | 2/5 | 3/5 | 4/5 |
| Audience | developer | developer | general |
Figures from each repo's GitHub metadata at analysis time.
Requires a running database instance (PostgreSQL, MySQL, or SQLite) and the appropriate driver package.
GORM is an Object-Relational Mapping library for the Go programming language. An ORM is a tool that lets you interact with a relational database such as PostgreSQL, MySQL, or SQLite using your programming language's own syntax and data structures, rather than writing raw SQL queries by hand. Instead of writing "SELECT * FROM users WHERE id = 1", you write Go code that reads more like "db.First(&user, 1)" and GORM handles the translation to SQL under the hood. GORM works by mapping Go structs to database tables. You define a struct with fields that correspond to columns, and GORM uses those definitions to read and write records, handle joins between related tables, and even create or modify the database schema automatically through a feature called auto-migration. It supports all the common database relationships you would encounter in an application, one user having many posts, a post belonging to a user, or many users sharing many tags. GORM also provides lifecycle hooks so you can run custom logic automatically before or after records are created, updated, or deleted. You would use GORM when building a Go web application or backend service that needs to persist data in a relational database. It is especially useful when you want type-safe database access with compile-time checks rather than error-prone raw SQL strings scattered through your code. Features like transactions, batch inserts, context-aware queries, and database connection pooling make it suitable for production applications, not just prototypes. The library is written entirely in Go and works with any major relational database through driver plugins. It has no external runtime dependencies beyond the database driver itself, which fits naturally into the Go philosophy of minimal, self-contained binaries.
A Go library that lets you read and write to databases like PostgreSQL or MySQL using Go code instead of raw SQL, with automatic schema management and relationship handling.
Mainly Go. The stack also includes Go.
Free to use for any purpose, including commercial projects, as long as you keep the copyright notice.
Setup difficulty is rated easy, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.