Skip to content
CAI
Software that uses CAICheck a score

typelevel/doobie

65.1

Adequate · 14 November 2026

22.8k

lines of production code

Scala

primary language

7

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Add Circe JSON/JSONB support for PostgreSQL

The \postgres-circe\ module now provides Doobie type classes (\Put\/\Get\) for circe \Json\ types, enabling seamless storage and retrieval of JSON and JSONB columns in PostgreSQL. This includes support for single values and arrays (\Array\[Json\]\), with instances organized into \json\ and \jsonb\ packages for explicit import.

modules/postgres-circe/src/main · high confidence

Add H2 database support with Java Time and array meta instances

This change introduces the H2 database module, providing the necessary type class instances and utilities to use H2 with Doobie. It includes \H2Transactor\ for creating connection resources, specific \Meta\ instances for Java 8 time types (such as \LocalDate\, \LocalDateTime\, \Instant\) and \UUID\, as well as comprehensive support for reading and writing primitive and boxed array types (Boolean, Integer, Long, Float, Double, String).

modules/h2/src/main · high confidence

Add PosPlatform trait for Scala 2 source-position tracking

A new PosPlatform trait is introduced in the Scala 2 specific source directory, providing an implicit Pos instance via a macro. This enables automatic capture of source file and line information for debugging or logging within the doobie library on Scala 2 platforms.

modules/free/src/main/scala-2 · high confidence

Add Scala 2-specific Text platform implementation for HList and Generic types

The Scala 2-specific module for the Postgres backend now includes a new \TextPlatform\ trait that provides implicit conversions for handling HLists (including single-element and multi-element lists) and generic types via Shapeless. This implementation enables the \Text\ typeclass to work with complex nested structures and case classes in Scala 2, leveraging Shapeless's \Generic\ and \HList\ capabilities for automatic derivation.

modules/postgres/src/main/scala-2 · high confidence

Add Scala 3 PosPlatform macro for source location tracking

A new PosPlatform trait and implementation have been added to the Scala 3 module, providing an implicit Pos instance that uses a macro to capture the source file path and line number of the macro expansion at compile time. This enables doobie to automatically track the origin of SQL statements in Scala 3 projects without requiring manual position arguments.

modules/free/src/main/scala-3 · high confidence

Add debugging log handler for Doobie SQL execution

A new \Log4CatsDebuggingLogHandler\ is now available in the \org.typelevel.doobie.log4cats\ package, allowing users to log detailed SQL execution information (including statements, parameters, and timing) via log4cats. This handler is intended for debugging purposes only and should not be used in production as it may expose sensitive data.

modules/log4cats · high confidence

Add specs2 integration for SQL analysis checking

The specs2 module now provides \AnalysisMatchers\ and \AnalysisSpec\ traits, allowing users to verify the type-checking and analysis results of doobie \Query\ and \Update\ values directly within specs2 specifications. This enables assertions like \sql"select 1".query\[Int\] must typecheck\ or using the \check\ method to validate query structures against the database schema.

modules/specs2/src/main · high confidence

Add support for JSON columns in H2 via circe

Users can now store and retrieve JSON data in H2 databases using circe's Json type. This change introduces new implicit instances that map circe Json objects to and from database columns (stored as VARCHAR/JSON), and provides helper methods to encode/decode arbitrary case classes directly to/from JSON columns in H2.

modules/h2-circe/src/main · high confidence

Add support for Java 8 date/time types in MySQL module

The MySQL module now includes built-in support for mapping Java 8 \java.time\ types (such as \Instant\, \LocalDate\, \LocalDateTime\, \LocalTime\, and \OffsetDateTime\) to corresponding MySQL database columns. These mappings are provided via the \MysqlJavaTimeInstances\ trait and are automatically available through the \org.typelevel.doobie.mysql.implicits\ package object, allowing users to read and write these types without manual configuration. Comprehensive tests verify the correctness of these mappings for both read and write operations.

modules/mysql · high confidence

Add support for refined types in doobie

This change introduces new implicit instances in the \org.typelevel.doobie.refined\ package that enable seamless integration with the \eu.timepit.refined\ library. Users can now use refined types (e.g., \Refined\[Int, Positive\]\) directly in doobie queries, where values are automatically validated upon reading from the database and unwrapped when writing to it. The implementation handles validation failures by throwing a \SecondaryValidationFailed\ exception, ensuring that invalid data does not silently enter the application domain.

modules/refined/src/main · high confidence

Added JMH benchmark for Doobie select operations

A new JMH benchmark file has been added to the bench module, providing performance comparisons between raw JDBC and Doobie. The benchmark includes a baseline hand-written JDBC implementation and measures Doobie's performance using three different collection strategies: \.to\[List\]\, \.to\[Vector\]\, and \.stream.compile.toList\, allowing users to evaluate the overhead associated with each approach.

modules/bench · high confidence

Added database initialization scripts for MySQL and PostgreSQL

New SQL initialization files have been added to the \init\ directory to support database setup for testing. The MySQL script (\init/mysql/test-table.sql\) creates a test table with various data types and inserts sample data. The PostgreSQL script (\init/postgres/test-db.sql\) sets up a more extensive schema including PostGIS and hstore extensions, custom enum types, and a large dataset of city and country records based on the world database sample.

init · high confidence

Enable automatic derivation of Text instances for Scala 3 tuples and products

The Postgres module now supports Scala 3's \derives\ mechanism for the \Text\ typeclass, allowing automatic generation of text formatting instances for case classes (products) and tuples. This change introduces new given instances in \TextPlatform.scala\ that leverage Scala 3's \Mirror\ API to handle single-element tuples, multi-element tuples, and product types, reducing the need for manual \Text\ definitions for these data structures.

modules/postgres/src/main/scala-3 · high confidence

Expanded PostgreSQL type support and new data mapping capabilities

This release significantly expands the PostgreSQL module with new type mappings and utilities. It adds support for Java 8 time types (OffsetDateTime, LocalDate, LocalTime, LocalDateTime, OffsetTime, Instant, ZoneId) via PostgresJavaTimeMetaInstances. It introduces comprehensive array support for primitive and boxed types (Boolean, Integer, Long, Float, Double, String, UUID, BigDecimal) including both nullable and non-nullable variants, as well as a new arrayOfEnum helper for stricter enum array handling. PostgreSQL range types (int4range, int8range, numrange, daterange, tsrange, tstzrange) are now supported with RangeInstances. PostGIS geometry and geography types are mapped via PgisInstances and PgisGeographyInstances. A new Text typeclass is introduced to facilitate CSV/COPY operations with proper escaping. Finally, a comprehensive set of SQLSTATE constants is added to sqlstate.scala for better error handling.

modules/postgres/src/main/scala/doobie/postgres · high confidence

Introduce high-level Postgres API wrappers

This change adds a new \hi\ (high-level) package under \org.typelevel.doobie.postgres\ that provides convenient wrappers for PostgreSQL-specific features. It exposes operations for managing large objects (including streaming copy from/to files and streams), accessing the \PGConnection\ directly (for backend PID, notifications, and prepare thresholds), and integrating with the CopyManager. These utilities lift lower-level free-monad operations into user-friendly \ConnectionIO\ and \PGConnectionIO\ effects, simplifying access to advanced Postgres capabilities.

modules/postgres/src/main/scala/doobie/postgres/hi · high confidence

New KleisliInterpreter for effectful JDBC execution

The \modules/free\ module now includes a \KleisliInterpreter\ that interprets Doobie's free algebras into \Kleisli\[M, J, \*\]\ arrows, enabling execution of JDBC operations within a generic effect type \M\ (constrained by \WeakAsync\). This interpreter supports advanced concurrency features such as cancellation (\cancelable\, \onCancel\), uncancelable regions with polling (\uncancelable\, \poll\), and future integration (\fromFuture\, \fromFutureCancelable\), allowing users to run database queries and updates with proper async lifecycle management and error handling.

modules/free/src/main/scala/doobie/free · high confidence

New MUnit integration package for Doobie analysis specs

A new package at org.typelevel.doobie.munit has been added to provide MUnit-specific utilities for Doobie. This change introduces type aliases Checker and IOChecker, which map to the existing analysisspec.Checker and analysisspec.IOChecker, enabling users to leverage MUnit for testing Doobie analysis specifications.

modules/munit/src/main · high confidence

New Scala 3 derivation and compatibility layer for Read/Write instances

The core module now includes a dedicated Scala 3 implementation for automatic \Read\ and \Write\ derivation using \scala.deriving.Mirror\, alongside Scala 2 support via Shapeless. This change introduces platform-specific files (\ReadPlatform.scala\, \WritePlatform.scala\, \GetPlatform.scala\, \PutPlatform.scala\) for both Scala 2 and Scala 3, enabling users to derive typeclass instances for case classes and enums without manual boilerplate. It also adds compatibility shims (\FactoryCompat\, \MultiVersionTypeSupport\) and a Scala 3-specific \OrElse\ implementation to support the derivation logic across versions.

modules/core/src/main · high confidence

New ScalaTest matchers for static SQL analysis

The \modules/scalatest\ module now provides ScalaTest integration for verifying doobie query and update definitions at compile-test time. Users can mix in \IOChecker\ to use the \check\ and \checkOutput\ methods, which execute static analysis on \Query\ and \Update\ values and fail the test if the SQL does not typecheck or produce expected output schemas. Additionally, \IOAnalysisMatchers\ adds a \typecheck\ matcher factory, allowing assertions like \sql"select 1".query\[Int\] must typecheck\ to validate SQL syntax and types within ScalaTest specifications.

modules/scalatest/src/main · high confidence

New benchmark suite and enumerated type definitions for JDBC metadata

This change introduces a new JMH benchmark module (\modules/bench\) containing \large.scala\ and \text.scala\ to measure read performance of complex tuples and bulk insert strategies (naive, optimized, and COPY stream). It also adds a new \enumerated\ package in the core module, defining type-safe wrappers for JDBC constants such as \JdbcType\, \TransactionIsolation\, \ResultSetType\, \Nullability\, and \AutoGeneratedKeys\, which are then utilized by the refactored \hi/connection\ module for high-level connection operations.

repository · high confidence

New doobie-weaver module for SQL query validation in tests

A new \weaver\ module has been added to the project, providing integration with the Weaver testing framework. This module introduces an \IOChecker\ trait that allows users to validate the structure and output analysis of doobie \Query\ and \Update\ values directly within their test suites, ensuring SQL queries are correctly formed and typed before execution.

modules/weaver/src/main · high confidence

New example applications for advanced PostgreSQL and streaming features

The example module now includes several new demonstration programs: CallableStatementExample for invoking stored procedures with output parameters; Dynamic for executing queries with unknown column structures; GenericStream for streaming untyped row maps; HikariExample showing HikariCP connection pooling; Noop as a pure-value interpreter for ConnectionIO; OtherSchema for mapping PostgreSQL enums from non-default schemas; PostgresCopyInCsv for bulk loading CSV data; PostgresLargeObject for managing large binary objects; PostgresNotify for listening to database notifications; PostgresRange for handling PostgreSQL range types (int4, int8, numeric, date, timestamp, timestamptz); and StreamToFile for writing query results directly to a file.

modules/example/src/main · high confidence

New otel4s module for OpenTelemetry tracing integration

Adds a new \otel4s\ module that integrates Doobie with the otel4s OpenTelemetry library, enabling distributed tracing for database operations. Users can now create a \TracedTransactor\ to automatically instrument queries and updates, configure tracing behavior via \TracingConfig\ (including span naming, query capture, and constant attributes), and attach custom tracing attributes to \Fragment\, \Query\, and \Update\ statements using new syntax extensions like \withAttributes\ and \queryWithSummary\.

modules/otel4s/src/main · high confidence

New source position and tracing utilities in doobie.util

The doobie.util package now includes a new \pos\ module for representing and formatting source file positions, and a \trace\ module that introduces a \TraceEvent\ abstraction for capturing logging information. These additions provide foundational support for better debugging and observability within the library.

modules/free/src/main/scala/doobie/util · high confidence

Postgres-specific syntax extensions for COPY streaming and SQL state handling

This change introduces new syntax extensions for the Postgres module, specifically adding \FragmentOps\ to support the PostgreSQL \COPY\ command. Users can now use \copyIn\ to efficiently insert data from a \Foldable\ collection or a streaming source (\Stream\[ConnectionIO, A\]\) into a table, with the streaming version handling chunking and resource management automatically. Additionally, a comprehensive set of \PostgresMonadErrorOps\ methods is added to \syntax.scala\, allowing users to handle specific PostgreSQL SQL state codes (such as warnings, connection exceptions, or data exceptions) via convenient extension methods like \onWarning\ or \onConnectionFailure\.

modules/postgres/src/main/scala/doobie/postgres/syntax · high confidence

Removals

The \World\ trait, along with its \IndexedWorld\ base, \ResultSetWorld\, and \StatementWorld\ implementations, has been removed from the \doobie.world\ package. This eliminates the previous state-transition-based API for managing database interactions, meaning users can no longer utilize these specific types for constructing or running database actions.

src/main/scala/doobie/world · high confidence

Removal of legacy core database abstraction types

The \doobie\ package has removed several foundational source files that defined the library's previous database interaction model. Specifically, \InOut.scala\ (handling combined input/output parameters), \Param.scala\ (parameter setting logic), \Primitive.scala\ (basic JDBC type mappings), \SqlTypes.scala\ (JDBC type definitions), \Statement.scala\ (statement structure), and \Test.scala\ (sample code) have been deleted. This cleanup eliminates the old \Param\ and \InOut\ abstractions, simplifying the codebase by removing these specific implementation details.

src/main/scala/doobie · high confidence

Removal of legacy primitive type binding modules

The standard primitive type binding modules for Boolean, Int, String, and the Default configuration have been removed from the library. This eliminates the previous a-la-carte mapping implementations (such as mapping booleans to 'yes'/'no' strings or integers, and specific JDBC type aliases like \bigint\ or \varchar\) that were previously available in the \doobie.std\ package. Users relying on these specific legacy binding definitions will need to update their code to use the current standard mappings or define their own.

src/main/scala/doobie/std · high confidence

Behavioural changes

Introduce HikariTransactor for Cats Effect 3

The Hikari module now provides a \HikariTransactor\ built on Cats Effect 3, allowing users to create database connection pools via resources (e.g., \fromConfig\, \initial\). This change replaces the previous implementation with a new API that supports separate effects for construction and execution, integrates with Cats Effect's \Blocker\ for blocking operations, and defaults the log handler to \None\ for a cleaner user experience.

modules/hikari/src/main · high confidence

Introduction of WeakAsync typeclass for uniform effect handling

Doobie now introduces a new \WeakAsync\ typeclass in the \modules/free\ module to unify algebras and interpreters. This change standardizes how asynchronous operations and cancellation are handled by providing a common interface (\fromFutureCancelable\) and specific utilities like \liftK\ and \liftIO\ for lifting effects, ensuring consistent behavior across different effect types.

modules/free/src/main/scala/doobie · high confidence

Postgres Free algebras and interpreters now use WeakAsync

The Postgres module's free algebras and Kleisli interpreters have been refactored to use the \WeakAsync\ typeclass instead of \Async\. This change introduces \WeakAsync\ instances for all Postgres-specific effect types (such as \CopyInIO\, \CopyOutIO\, \LargeObjectIO\, and \PGConnectionIO\) and updates the \KleisliInterpreter\ to rely on \WeakAsync\ capabilities like \fromFutureCancelable\, \uncancelable\, and \poll\. For users, this aligns the Postgres module with the broader Doobie architecture, potentially simplifying dependency requirements for effects that do not need the full \Async\ interface while maintaining support for cancellation and polling.

modules/postgres/src/main/scala/doobie/postgres/free · high confidence

Project infrastructure and documentation overhaul

The repository has been restructured with new configuration files to standardize development and release processes. A \.scalafmt.conf\ file is introduced to enforce code formatting (version 3.11.5), and a \.git-blame-ignore-revs\ file is added to ignore automated formatting commits in git history. Automated pull request handling is configured via a new \.mergify.yml\ file, which auto-merges dependency updates and labels PRs by module. The \docker-compose.yml\ is updated to use official Postgres and MySQL images for local testing. Documentation is migrated to a microsite, with the \README.md\ updated to include community links and badges, and the \CHANGELOG.md\ deprecated in favor of GitHub Releases. Additionally, a \.jvmopts\ file is added to configure the JVM stack size, and the \LICENSE\ file is updated.

(repo-wide) · high confidence

Test coverage

Added Java enum test fixture for PostgreSQL enum support; Added MUnit-based integration tests for Doobie query checking; Added Scala 3 test for Text derivation; Added Scala 3-specific test suites for enum and generic derivation; Added Specs2 integration tests for query analysis and matchers; Added comprehensive test suite for doobie.util components; Added comprehensive test suites for PostgreSQL module; Added empty platform-specific test suite for Scala 2; Added integration tests for Doobie's query checker using the Weaver test framework; Added platform-specific test suites for Doobie utilities; Added platform-specific test utilities for Scala binary version detection; Added property-based tests for H2 type mappings and query analysis; Added regression tests for specific GitHub issues; Added test arbitraries for Java time types; Added test arbitraries for SQL types and string generation; Added test coverage for doobie syntax components; Added test fixtures for PostgreSQL enum support; Added test for HikariTransactor connection lifecycle; Added test for WeakAsync liftK cancelation propagation; Added test suite for Doobie Refined integration; Added test suites for Doobie analysis operations; Added test utilities and sample classes for doobie testing; Added tests for H2 JSON support via circe; Added tests for Hikari connection cancellation and resource cleanup; Added tests for Hikari connection pool concurrency and stream prefetching; Added tests for HikariConfig default value parity; Added tests for Meta typeclass and tiemap validation; Added tests for PostgreSQL JSON/JSONB mapping with circe; Added tests for ScalaTest matchers and checker integration; Added tests for otel4s tracing components.

Dependencies

Major dependency and build infrastructure overhaul

The project has been significantly upgraded to support Scala 2.12, 2.13, and 3.3.8, with core libraries updated to Cats Effect 3.7.1, FS2 3.14.0, Circe 0.14.16, and HikariCP 7.1.0. Database drivers have been bumped to PostgreSQL 42.7.12, PostGIS 2025.1.1, MySQL 26.7.0, and H2 2.4.240. The build system now uses sbt-typelevel for CI/release workflows, integrates MUnit 1.3.6 and Weaver 0.13.0 for testing, and enforces code generation checks via \freeGen2\ and header validation in GitHub Actions.

(dependencies) · high confidence

Upgrade build infrastructure to sbt 1.13.0 and update plugins

The project build has been upgraded to sbt version 1.13.0, with a comprehensive update of sbt plugins including sbt-paradox, sbt-site, sbt-ghpages, sbt-typelevel-ci-release, sbt-scoverage, sbt-updates, sbt-jmh, sbt-header, sbt-tpolecat, sbt-mdoc, sbt-scalafmt, sbt-projectmatrix, and sbt-scalafix. Additionally, a new FreeGen2 code generator plugin has been introduced to automate the generation of free algebras and interpreters, featuring configurable settings for class selection, package naming, import exclusions, and special handling for SQL types.

project · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 66 → 65 (-0.6)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 75 → 73 (-2.4)
  • Architecture 84 → 84 (+0.0)
  • Maturity 53 → 53 (+0.0)
  • Readiness 75 → 74 (-0.7)
  • Security 85 → 77 (-7.7)
  • Performance 78 → 91 (+13.2)

Resolved (1)

  • Off-boarding risk: anonymized user #1

New (25)

  • Edited copies of one member (3 members, 8+ corresponding lines) (modules/core/src/main/scala/doobie/util/query.scala)
  • Edited copy of a member (13 corresponding lines) (modules/core/src/main/scala-2/doobie/util/MkWritePlatform.scala)
  • Edited copy of a member (14 corresponding lines) (modules/core/src/main/scala-2/doobie/util/MkReadPlatform.scala)
  • Edited copy of a member (17 corresponding lines) (modules/example/src/main/scala/example/OtherSchema.scala)
  • Edited copy of a member (17 corresponding lines) (modules/hikari/src/main/scala/doobie/hikari/HikariTransactor.scala)
  • Edited copy of a member (27 corresponding lines) (modules/bench/src/main/scala/doobie/bench/large.scala)
  • Edited copy of a member (3 corresponding lines) (modules/free/src/main/scala/doobie/free/kleisliinterpreter.scala)
  • Edited copy of a member (3 corresponding lines) (modules/free/src/main/scala/doobie/free/kleisliinterpreter.scala)
  • Edited copy of a member (3 corresponding lines) (modules/free/src/main/scala/doobie/free/kleisliinterpreter.scala)
  • Edited copy of a member (3 corresponding lines) (modules/free/src/main/scala/doobie/free/kleisliinterpreter.scala)
  • Edited copy of a member (3 corresponding lines) (modules/free/src/main/scala/doobie/free/kleisliinterpreter.scala)
  • Edited copy of a member (3 corresponding lines) (modules/free/src/main/scala/doobie/free/kleisliinterpreter.scala)
  • Edited copy of a member (3 corresponding lines) (modules/free/src/main/scala/doobie/free/kleisliinterpreter.scala)
  • Edited copy of a member (3 corresponding lines) (modules/h2/src/main/scala/doobie/h2/Metas.scala)
  • Edited copy of a member (47 corresponding lines) (modules/free/src/main/scala/doobie/util/log.scala)
  • Edited copy of a member (5 corresponding lines) (modules/core/src/main/scala/doobie/hi/resultset.scala)
  • Edited copy of a member (5 corresponding lines) (modules/core/src/main/scala/doobie/util/update.scala)
  • Edited copy of a member (5 corresponding lines) (modules/postgres/src/main/scala/doobie/postgres/pgisgeographyinstances.scala)
  • Edited copy of a member (6 corresponding lines) (modules/core/src/main/scala/doobie/util/get.scala)
  • Edited copy of a member (6 corresponding lines) (modules/core/src/main/scala/doobie/util/transactor.scala)
  • …and 5 more

Changes since last survey

  • 12 commits — 12 feature/other, 0 fixes

By area

  • (repo) — 6 commits
  • (root) — 3 commits
  • modules/free — 1 commit
  • project/build.properties — 1 commit
  • project/plugins.sbt — 1 commit

Notable commits

  • change: Merge pull request #2521 from typelevel/update/sbt-1.13.1
  • change: Merge pull request #2522 from typelevel/update/scala3-library-3.3.9
  • change: Merge pull request #2524 from typelevel/update/weaver-cats-0.13.1
  • change: Merge pull request #2525 from typelevel/update/otel4s-core-trace-1.2.0
  • change: Merge pull request #2526 from typelevel/update/sbt-scalafix-0.14.10
  • change: Merge pull request #2527 from typelevel/relative_pos_path
  • change: Pos: Generate relative path instead of full path
  • change: Update otel4s-core-trace, ... to 1.2.0
  • change: Update sbt, sbt-dependency-tree, ... to 1.13.1
  • change: Update sbt-scalafix to 0.14.10
  • change: Update scala3-library to 3.3.9
  • change: Update weaver-cats to 0.13.1

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

typelevel/doobie was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit aef2e98ed64fa88d12aed83572545488eab34373 — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-36d4cd83012f.