doobie
doobie is a Scala library that provides a functional programming approach to working with databases through JDBC. It abstracts away raw SQL handling while maintaining type safety and composability, making database interactions cleaner and more maintainable for Scala teams.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | typelevel/doobie |
| Owner | typelevel |
| Primary language | Scala |
| License | MIT — OSI-approved |
| Stars | 2.2k |
| Forks | 378 |
| Open issues | 135 |
| Latest release | v1.0.0-RC13 (2026-06-12) |
| Last updated | 2026-07-06 |
| Source | https://github.com/typelevel/doobie |
What doobie is
doobie is a pure functional JDBC abstraction layer for Scala built on the Typelevel ecosystem, offering composable SQL queries with compile-time type checking and functional composition primitives. It bridges imperative JDBC drivers with functional programming idioms, enabling safe database operations without raw SQL string manipulation.
Get the doobie source
Clone the repository and explore it locally.
git clone https://github.com/typelevel/doobie.gitcd doobie# 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 Scala 2.13+ or Scala 3; ensure project Scala version alignment before adopting. Latest release is RC stage (v1.0.0-RC13), so production use should evaluate stability.
- Strong familiarity with Cats/FS2 idioms (IO, Resource, Stream) is necessary for effective query composition and resource management.
- Query validation happens at compile time where possible; plan testing strategy to cover runtime parameter binding and database-specific SQL dialects.
- Connection pooling, transaction management, and threading semantics are delegated to underlying JDBC driver and Cats-Effect runtime—ensure those are properly configured.
- SQL fragments are parameterized to prevent injection, but custom fragments require careful review to maintain safety guarantees.
When to avoid it — and what to weigh
- Polyglot teams unfamiliar with Scala FP patterns — doobie's functional programming model (monads, applicatives, composition) has a steep learning curve. Avoid if team members lack Scala FP experience or require an ORM that works across languages.
- Schema-first or rapid prototyping workflows — doobie requires explicit SQL definition; it offers no code generation from schema. Better alternatives exist if you need automatic model generation or quick schema exploration.
- Non-JVM or non-SQL databases — doobie is JDBC-centric and Scala-only. NoSQL, GraphQL, or non-JVM platforms require different tooling.
- Projects requiring minimal dependencies — doobie depends on Cats, FS2, and other Typelevel libraries. Projects requiring a lightweight standalone library should consider alternatives.
License & commercial use
doobie is released under the MIT License, a permissive OSI-approved license allowing commercial use, modification, and distribution with minimal restrictions.
MIT License permits commercial use without restriction. No corporate support, funding model, or dual-licensing arrangement is evident from the data. Review the LICENSE file in the repository to confirm; no other commercial terms are stated.
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 | Moderate |
| DEV.co fit | Good |
| Assessment confidence | High |
Query parameterization is built-in and prevents SQL injection when used as documented. JDBC driver and underlying database security are outside doobie's scope—ensure driver versions, SSL/TLS, and credential storage are properly managed. Connection pooling configuration (e.g., timeouts, authentication) should follow security best practices. No known published CVEs noted in the data; audit dependency chain (Cats, FS2) for vulnerabilities as part of supply-chain review.
Alternatives to consider
Slick
Scala-native query DSL with code generation from schema; less pure functional but more ergonomic for rapid development. Steeper learning curve for functional composition.
Quill
Compile-time query optimization with compile-time SQL generation; compile-time macro safety similar to doobie. Supports Scala 3 and multiple backends (SQL, Cassandra, etc.); larger ecosystem.
Raw JDBC with HikariCP
Minimal abstraction; maximum control over SQL. Suitable for teams prioritizing simplicity and avoiding functional programming overhead, but sacrifices type safety and composability.
Build on doobie with DEV.co software developers
doobie is ideal for Scala teams seeking functional programming patterns in database layers. Evaluate it for microservices, data pipelines, and applications where compile-time safety and composability matter. Start with the quick-start example and join the Typelevel Discord community.
Talk to DEV.coRelated on DEV.co
Explore the category and the services that help you build with it.
doobie FAQ
Is doobie production-ready?
Do I need to know Cats to use doobie?
Can doobie work with async/non-blocking databases?
What databases does doobie support?
Work with a software development agency
Adopting doobie 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.
Ready to adopt type-safe database access?
doobie is ideal for Scala teams seeking functional programming patterns in database layers. Evaluate it for microservices, data pipelines, and applications where compile-time safety and composability matter. Start with the quick-start example and join the Typelevel Discord community.