whatisgithub

What is sqlboiler?

aarondl/sqlboiler — explained in plain English

Analysis updated 2026-06-24

6,992GoAudience · developerComplexity · 3/5Setup · moderate

In one sentence

SQLBoiler reads your existing database schema and generates type-safe Go code for all your database operations, eliminating repetitive query boilerplate and catching type errors at compile time.

Mindmap

mindmap
  root((SQLBoiler))
    What it does
      Generate Go code
      Database-first ORM
      Type-safe queries
    Supported Databases
      PostgreSQL
      MySQL
      SQLite
      SQL Server
      CockroachDB
    Generated Features
      Eager loading
      Hooks
      Transactions
      Timestamps
    Project Status
      Maintenance mode
      Bug fixes only
      Alternatives exist
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Generate a complete Go database access layer from an existing PostgreSQL schema in minutes instead of writing queries by hand.

USE CASE 2

Add type-safe eager loading of related records and automatic timestamp handling to a Go application.

USE CASE 3

Use raw SQL fallback alongside generated code for complex queries the generator cannot express.

What is it built with?

GoPostgreSQLMySQLSQLiteSQL ServerCockroachDB

How does it compare?

aarondl/sqlboilercosmos/cosmos-sdkaquasecurity/tfsec
Stars6,9926,9957,001
LanguageGoGoGo
Setup difficultymoderatehardeasy
Complexity3/55/52/5
Audiencedeveloperdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires a running database and a config file pointing SQLBoiler at it before any code generation can happen.

No license information was provided in the explanation.

So what is it?

SQLBoiler is a Go code generator that reads your existing database schema and produces Go code for working with your database. Rather than writing repetitive database queries by hand, you run SQLBoiler once, and it produces a tailored set of Go functions and types that match your specific tables and columns. The generated code handles common operations like inserting, updating, deleting, and querying rows, and it knows about the relationships between your tables. The approach is described as "database-first": you design and manage the database schema yourself using migration tools of your choice, and SQLBoiler's only job is to generate the access layer on top of it. This is the opposite of some other tools where you define your data models in code and let the tool create the database. The benefit of the database-first approach is that the generated code is fully type-safe and specific to your schema, so mistakes like passing the wrong type to a query are caught at compile time rather than at runtime. The generated code supports eager loading of related records, hooks that run before or after database operations, transactions, raw SQL fallback for anything the generator cannot express, automatic handling of created-at and updated-at timestamps, and enum types. Supported databases include PostgreSQL, MySQL, Microsoft SQL Server, SQLite, and CockroachDB. The README opens with a note that the project is now in maintenance mode. It still accepts bug fixes and compatibility updates from the community but no longer adds new features, and the maintainers generally do not resolve reported issues. The README points to two actively maintained alternatives: Bob (a project directly inspired by SQLBoiler, created by a former SQLBoiler maintainer) and sqlc (a different approach that generates type-safe code from SQL queries rather than from the schema). Only version 4 is currently maintained. Versions 1, 2, and 3 are no longer supported. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
I have a PostgreSQL database with users, orders, and products tables. Show me the SQLBoiler config and commands to generate Go code and query all orders for a specific user with eager-loaded product details.
Prompt 2
How do I add before/after hooks in SQLBoiler-generated code to run validation logic every time a record is inserted?
Prompt 3
My Go app uses SQLBoiler with MySQL. Walk me through setting up a transaction that inserts a user and their profile atomically using the generated code.

Frequently asked questions

What is sqlboiler?

SQLBoiler reads your existing database schema and generates type-safe Go code for all your database operations, eliminating repetitive query boilerplate and catching type errors at compile time.

What language is sqlboiler written in?

Mainly Go. The stack also includes Go, PostgreSQL, MySQL.

What license does sqlboiler use?

No license information was provided in the explanation.

How hard is sqlboiler to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is sqlboiler for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.