explaingit

sqlc-dev/sqlc

Analysis updated 2026-06-24

17,492GoAudience · developerComplexity · 2/5Setup · easy

TLDR

Tool that reads plain SQL files and generates type-safe database access code in Go, Kotlin, Python, or TypeScript for PostgreSQL and MySQL.

Mindmap

mindmap
  root((sqlc))
    Inputs
      SQL query files
      Schema files
      sqlc.yaml config
    Outputs
      Type-safe Go code
      Python types
      TypeScript types
    Use Cases
      Generate DB clients
      Catch SQL errors early
      Replace hand ORM code
    Tech Stack
      Go
      PostgreSQL
      MySQL
      SQL
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 type-safe Go database access code from a folder of plain SQL files

USE CASE 2

Catch SQL parameter and result type mismatches at compile time instead of runtime

USE CASE 3

Skip writing an ORM by keeping queries in SQL and generating clients per language

USE CASE 4

Add a typed Python or TypeScript client over the same SQL definitions as your Go service

What is it built with?

GoPostgreSQLMySQLSQLPythonTypeScript

How does it compare?

sqlc-dev/sqlcrqlite/rqlitejoewalnes/websocketd
Stars17,49217,49917,455
LanguageGoGoGo
Setup difficultyeasyeasyeasy
Complexity2/54/52/5
Audiencedeveloperops devopsdeveloper

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

How do you get it running?

Difficulty · easy Time to first run · 30min

Needs a schema file plus a sqlc.yaml config, queries must match the configured database engine.

In plain English

sqlc is a tool that automatically generates code from SQL queries, saving developers from writing repetitive database-access code by hand. SQL (Structured Query Language) is the standard way to talk to databases, it lets you say things like "give me all users created this month." The problem is that connecting SQL to application code usually means writing a lot of boilerplate (repetitive, boring code) that is easy to get wrong. sqlc works in three steps: you write your SQL queries in plain SQL files, you run the sqlc tool, and it generates clean code in your chosen language with type-safe interfaces. "Type-safe" means the generated code knows exactly what kind of data each query returns or expects, so mistakes like passing a number where text is expected get caught before your app even runs, rather than crashing in production. You then write your application logic calling that generated code instead of writing raw database calls yourself. This keeps your code clean, predictable, and much easier to maintain. It is especially useful when you want the reliability of hand-written SQL (full control over your queries, no hidden performance surprises) combined with the safety net of generated code. It supports Go, Kotlin, Python, and TypeScript as output languages, and works with PostgreSQL and MySQL databases. Additional languages can be added via plugins. sqlc is written in Go and has over 17,000 GitHub stars, indicating broad community adoption among backend developers.

Copy-paste prompts

Prompt 1
Walk me through adding sqlc to a Go project with a Postgres schema.sql and queries.sql
Prompt 2
Help me write the sqlc.yaml config for generating a TypeScript client alongside Go
Prompt 3
Show me how to use sqlc.embed and sqlc.arg annotations inside a query file
Prompt 4
Compare sqlc vs GORM for a Postgres backend that wants compile-time SQL safety

Frequently asked questions

What is sqlc?

Tool that reads plain SQL files and generates type-safe database access code in Go, Kotlin, Python, or TypeScript for PostgreSQL and MySQL.

What language is sqlc written in?

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

How hard is sqlc to set up?

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

Who is sqlc for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub sqlc-dev on gitmyhub

Verify against the repo before relying on details.