DEV.co
Open-Source Databases · stephenafamo

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.

Source: GitHub — github.com/stephenafamo/bob
1.7k
GitHub stars
108
Forks
Go
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorystephenafamo/bob
Ownerstephenafamo
Primary languageGo
LicenseMIT — OSI-approved
Stars1.7k
Forks108
Open issues41
Latest releasev0.48.0 (2026-06-26)
Last updated2026-07-07
Sourcehttps://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.

Quickstart

Get the bob source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/stephenafamo/bob.gitcd bob# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Multi-database Go applications requiring type-safe queries

Bob's support for PostgreSQL, MySQL, and SQLite with generated type-safe query mods makes it ideal for applications that need to maintain correctness across multiple database backends without sacrificing developer ergonomics.

Test-driven development with complex data dependencies

The factory generation layer (inspired by FactoryBot) enables rapid creation of test fixtures with automatic handling of foreign key relationships, significantly reducing boilerplate in integration tests.

Gradual migration from raw SQL or other ORMs

Bob's layered architecture allows teams to adopt incrementally—starting with the query builder for legacy SQL, then adopting ORM generation and code generation as the codebase evolves, reducing adoption friction.

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.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

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.

Software development agency

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.co

Related 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?
Yes. Bob's SQL Executor works with database/sql connections directly. You can adopt Bob incrementally by wrapping existing connections and running code generation on new tables.
Do I have to use code generation?
No. Layer 1 (query builder) works without schema awareness or code generation. Layers 2–4 are optional and require running the generator; you can mix raw and generated code.
What happens to generated code when my schema changes?
Generated files are overwritten each time the code generator runs. Store them in version control and treat them as build artifacts. Treat manual edits to generated code as merge conflicts to be avoided.
Is Bob production-ready?
Unknown from provided data. 1,743 stars and active maintenance suggest adoption, but no explicit production deployment case studies, SLAs, or security audit results are mentioned. Conduct your own evaluation and testing.

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.