
GORM
A Go library that maps database tables to Go structs so you can query data without writing raw SQL.
- Stars
- 40k
- Forks
- 4.3k
- Licence
- MIT
- Language
- Go
- Last update
- 13 days ago
- Type
- Library
What it is
GORM is an ORM (object-relational mapper) for the Go programming language. It lets developers describe data as Go structs and then create, read, update, and delete records through Go code instead of hand-written SQL. The README lists features such as associations, hooks, transactions, eager loading, batch inserts, and auto migrations.
- Define Go structs for users, orders, or products and save them to a database
- Load related records with Preload or Joins, such as a user with their posts
- Group several database writes into one transaction that rolls back on error
- Run batch inserts or process large tables in chunks with FindInBatches
Great for
- Go developers building web services or APIs that store data in a relational database
- Teams who want a consistent, typed way to query tables from Go code
- Developers who want transactions, associations, and migrations without writing SQL by hand
Not ideal for
- People who are not writing Go code, since this is a Go-only library
- Projects that need full manual control over every SQL statement, where a query builder or raw SQL may fit better
- Complete beginners to programming, who should first learn Go and basic SQL
How to get it
- 1
Install with a package manager
You'll need: Go (version not specified in the README excerpt)
Clone the repository
git clone https://github.com/go-gorm/gorm - 2
Run it
- Install Go on your machine
- Add GORM to a Go module with your project's package manager workflow
- Follow the GORM Guides at https://gorm.io to connect to a database and define your first model
- Run a simple create and query to confirm the connection works
- 3
Get the most out of it
- Use the Gen Guides at https://gorm.io/gen/index.html for generated, type-safe query code
- Use the plugin API, such as Database Resolver, for multiple databases or read/write splitting
- Use Prometheus integration mentioned in the README for monitoring
- Use DryRun mode to inspect generated SQL before running it
Downloads
Strengths
- Broad feature set listed in the README, including associations, hooks, transactions, and migrations
- Active project with a large star count and a recent push date
- MIT license permits commercial use with few restrictions
Trade-offs
- The README is truncated and gives no installation steps, so setup details must come from the official guides
- Database-specific behavior depends on separate drivers, which the README excerpt does not explain in detail
- Learning the ORM's query conventions takes some time even for experienced Go developers
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| gorm (this) | 40k | Library | intermediate | 13 days ago | Go developers building web services or APIs that store data in a relational database |
| sqlc | 18.4k | Dev tool | intermediate | 4 days ago | Go developers who prefer writing plain SQL over using an ORM |
| sqlx | 17.7k | Library | intermediate | 2.2 years ago | Go developers who already use database/sql and want less boilerplate when reading rows |
| fiber | 40.2k | Library | intermediate | 4 days ago | Go developers building REST APIs or web backends |
| gf | 13.3k | Framework | intermediate | 7 days ago | Go developers looking for a full-featured framework |
| typeorm | 36.7k | Library | intermediate | 8 days ago | Node.js or TypeScript developers building apps backed by a relational database |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.