bob
Bob is a Go SQL toolkit that provides a query builder, ORM, and code generation for PostgreSQL, MySQL, and SQLite. It emphasizes correctness and minimal abstraction, allowing developers to progressively adopt features from raw SQL strings to fully typed, generated models and queries.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | stephenafamo/bob |
| Owner | stephenafamo |
| Primary language | Go |
| License | MIT — OSI-approved |
| Stars | 1.7k |
| Forks | 108 |
| Open issues | 41 |
| Latest release | v0.48.0 (2026-06-26) |
| Last updated | 2026-07-07 |
| Source | https://github.com/stephenafamo/bob |
What bob is
Bob consists of four composable layers: a fluent query builder with dialect-specific implementations, schema-based ORM code generation with type-safe query mods, factory generation for test fixtures, and SQL query code generation. All components build on a philosophy of spec compliance and interoperability with the Go standard library.
Get the bob source
Clone the repository and explore it locally.
git clone https://github.com/stephenafamo/bob.gitcd bob# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Code generation must be run whenever the database schema changes; integrate this into your build/migration pipeline to keep generated code in sync.
- Bob's query builder uses 'Query Mods'—a functional composition pattern—which differs from traditional fluent interfaces; team training on this pattern is recommended.
- Type safety is opt-in; raw SQL strings still work but bypass generated type checks. Establish code review practices to encourage schema-based generation where appropriate.
- Factory generation requires bidirectional relationship awareness; ensure your schema includes proper foreign key constraints so Bob can infer dependency graphs.
- The project supports multiple Go versions; verify your target Go version is compatible with the latest Bob release before adoption.
When to avoid it — and what to weigh
- Requiring NoSQL or non-relational database support — Bob is SQL-only and database-specific. If your stack includes MongoDB, DynamoDB, or other non-relational stores, Bob cannot unify access across them.
- Needing extensive pre-built integrations with frameworks — Bob is database-focused and does not ship with web framework plugins or middleware. Teams requiring tight framework integration (e.g., Django-like ORM with admin panels) should evaluate alternatives.
- Small projects with minimal schema complexity — The code generation and layered approach add overhead for simple CRUD applications. Smaller projects might find a lightweight query builder (like Squirrel) or minimal wrapper sufficient.
- Teams unfamiliar with code generation workflows — Bob requires running schema introspection and code generation as part of the development pipeline. Teams without mature code-gen practices may find the workflow unfamiliar and maintenance overhead.
License & commercial use
Bob is licensed under the MIT License, a permissive OSI-approved license allowing unrestricted use, modification, and distribution in proprietary and open-source contexts, provided the license and copyright notice are retained.
MIT License explicitly permits commercial use, including in proprietary applications. No vendor lock-in or commercial restrictions exist. Attribution in documentation or code comments is customary but not legally required.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
Bob uses parameterized queries (Query Mods with Arg()) to prevent SQL injection at the builder level. Raw SQL strings remain susceptible if untrusted input is interpolated; code review practices should flag this. Generated models and queries inherit parameterization safety. No security audit data, vulnerability disclosure policy, or known CVEs provided in data; review project issue tracker and security advisories independently.
Alternatives to consider
GORM
More opinionated, larger ecosystem, automatic migrations, and extensive framework integrations (Rails-like). Trade-off: heavier abstraction, potentially less control over generated SQL.
SQLBoiler
Similar schema-based code generation philosophy; Bob's main competitor. SQLBoiler has longer history and larger user base. Bob claims more convenient query building and factory support; evaluate both if schema generation is your priority.
sqlc
Hand-written SQL with type-safe code generation. Better for teams preferring explicit SQL and strong type checking at compile time. Bob offers more convenience at some cost to control.
Build on bob with DEV.co software developers
Our senior Go engineers can help you assess fit, design schema introspection workflows, and integrate code generation into your CI/CD. Contact us to discuss your database architecture.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
bob FAQ
Can I use Bob with existing database.sql codebases?
Do I have to use code generation?
What happens to generated code when my schema changes?
Is Bob production-ready?
Software developers & web developers for hire
DEV.co helps companies turn open-source tools like bob into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source databases stack.
Evaluating Bob for your Go backend?
Our senior Go engineers can help you assess fit, design schema introspection workflows, and integrate code generation into your CI/CD. Contact us to discuss your database architecture.