reform
Reform is a Go ORM that prioritizes type safety and compile-time checking through code generation rather than runtime reflection. It supports PostgreSQL, MySQL, SQLite, and SQL Server, and uses non-empty interfaces to enforce correct API usage.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | go-reform/reform |
| Owner | go-reform |
| Primary language | Go |
| License | MIT — OSI-approved |
| Stars | 1.5k |
| Forks | 74 |
| Open issues | 88 |
| Latest release | v1.5.1 (2021-08-27) |
| Last updated | 2025-12-15 |
| Source | https://github.com/go-reform/reform |
What reform is
Reform generates type-safe database models from SQL schemas using `go generate`, leveraging initialization-time reflection and non-empty interfaces. It avoids `interface{}` patterns and runtime type sidestepping, providing explicit methods like `FindByPrimaryKeyFrom()` and `Save()` with proper type signatures.
Get the reform source
Clone the repository and explore it locally.
git clone https://github.com/go-reform/reform.gitcd reform# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires Go 1.17+; uses `go generate` workflow—ensure team is familiar with code generation patterns and CI integration.
- Initial setup involves running `reform-db` to introspect existing schema; model generation is one-time cost but schema changes require regeneration.
- Pointer types recommended for nullable columns (`*string`, `*time.Time`) to distinguish NULL from zero values; integration with helper packages like `github.com/AlekSi/pointer` advised.
- Primary key field cannot be a pointer; design schema accordingly and be aware of the zero-value limitation for PK columns.
- Generated code is separate from hand-written models; maintain clear separation between `person.go` and `person_reform.go` to avoid merge conflicts.
When to avoid it — and what to weigh
- Complex Query Requirements or Aggregations — Reform is not designed for complex analytical queries or advanced SQL patterns. Limitations on composite primary keys and the simpler query builder may require falling back to raw SQL.
- High-Velocity Schema Evolution — Regenerating models on every schema change can be friction-heavy in fast-moving prototypes. Real-time schema changes require re-running `reform-db` and regenerating code.
- Need for Advanced ORM Features — Reform intentionally avoids lazy loading, query hooks, and other advanced ORM conveniences. Projects needing rich ORM ecosystems (e.g., relationships, lifecycle hooks) should consider alternatives like gorm or ent.
- Zero Primary Key Support Required — Reform requires exactly one primary key per record and does not support composite keys or zero-value primary keys. Tables without a single PK column are not well-supported.
License & commercial use
MIT License (standard permissive open-source license). Copyright held by Alexey Palazhchenko (2016–2020). Generated code is explicitly permitted under terms of your choice.
MIT License permits unrestricted commercial use, modification, and distribution, provided license and copyright notice are retained. No proprietary restrictions or commercial licensing required. Suitable for proprietary products.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Moderate |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
Reform uses parameterized queries via `database/sql`, mitigating SQL injection. No cryptographic or authentication features claimed. Security posture depends on underlying driver and database configuration. Review generated code and input validation in application logic. No recent security advisories mentioned; consider audit if processing sensitive data.
Alternatives to consider
GORM
Feature-rich, popular Go ORM with hooks, associations, eager loading, and more flexible query API. Best if you need advanced ORM capabilities and don't mind runtime reflection.
sqlc
Query-first code generator; generates type-safe Go code from hand-written SQL queries. Better for complex queries but requires manual SQL and separate code generation step.
ent
Schema-first entity framework with code generation; supports relationships, middleware, and schema versioning. More feature-complete but higher learning curve than reform.
Build on reform with DEV.co software developers
If you prioritize compile-time type safety and simple, predictable CRUD patterns over advanced ORM features, schedule a technical review to assess Reform's fit for your schema and query patterns.
Talk to DEV.coRelated on DEV.co
Explore the category and the services that help you build with it.
reform FAQ
Does Reform support relationships or foreign keys?
Can I use Reform with an existing database schema?
Do I need to regenerate models every time the schema changes?
How does Reform handle NULL values?
Custom software development services
Adopting reform is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source databases software in production.
Evaluate Reform for Your Go Backend
If you prioritize compile-time type safety and simple, predictable CRUD patterns over advanced ORM features, schedule a technical review to assess Reform's fit for your schema and query patterns.