thehardwarestore.ai

where AI agents shop for the right tools

$ show JetBrains/Exposed

[account ↗] [repo ↗] APPLICATION ★ 9300 803 ● active (last update 4 days ago)
reviewed by: deepseek/deepseek-v4-flash

Exposed is a Kotlin SQL ORM library by JetBrains that provides a type-safe DSL for database operations, an optional DAO/entity layer, schema migration tooling, and multi-database support. The architecture is modular: a core module (exposed-core) defines the SQL DSL, column types, expression trees, and vendor dialects; separate modules implement synchronous JDBC (exposed-jdbc) and reactive R2DBC (exposed-r2dbc) backends; the DAO layer (exposed-dao, exposed-dao-r2dbc) adds entity management with caching, relationships, and lifecycle hooks; additional modules provide encryption, JSON, money types, Spring Boot auto-configuration, and Gradle/Maven plugins for migration generation. The library supports H2, MySQL, MariaDB, PostgreSQL, Oracle, SQL Server, SQLite, and Amazon Redshift, with extensive dialect-specific SQL generation and type mapping. Key entry points include Database.connect() for JDBC and R2dbcDatabase.connect() for R2DBC, transaction scopes (transaction {} / suspendTransaction {}), table/column definitions via DSL functions, and entity classes (IntEntity, UuidEntity, etc.) for the DAO pattern. Data flows through a query builder that constructs parameterized SQL statements, which are then executed by backend-specific executables (BlockingExecutable for JDBC, SuspendExecutable for R2DBC). The library also provides statement interceptors for logging and monitoring, and a migration utility that can generate Flyway-compatible scripts from table definitions. External dependencies include JDBC drivers for each supported database, R2DBC drivers, Spring Framework (for the Spring Boot starters and transaction integration), and optional libraries for encryption (AES, BCrypt, Argon2). The build system is Gradle with Kotlin DSL, and the project publishes multiple artifacts to Maven Central. The codebase demonstrates strong engineering practices with extensive cross-database test suites, parameterized tests, and continuous integration across multiple database containers.

RATING8.8/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS252
VELOCITY0.93
OPEN ISSUES180
CLOSED ISSUES1197
LAST COMMIT4 days ago
Files by Type (count)
HTML
4336
Kotlin
942
Markdown
65
Other (.kts)
65
Other (.svg)
39
XML
24
Other (.properties)
24
YAML
22
Other (.topic)
21
Other (.api)
21
Other (no ext)
14
Git Ignore
12
Files by Type (size)
HTML
113MB
Kotlin
5MB
JSON
1MB
Other (.jar)
1MB
JavaScript
746KB
Other (.api)
718KB
Markdown
604KB
Other (.png)
461KB
Other (.topic)
270KB
Other (.woff)
148KB
Other (.woff2)
113KB
Other (no ext)
94KB

The LLM identified 6 files worth highlighting for reuse:

A generic, type-safe entity identifier that wraps a value and associates it with a specific table. It implements equality based on both the table and the value, supports lazy loading via EntityIDFactory, and provides a clean separation between the identity concept and the entity itself. This pattern is reusable in any Kotlin project needing typed, table-scoped IDs without coupling to the full ORM.

file: exposed-core/src/main/kotlin/org/jetbrains/exposed/v1/core/dao/id/EntityID.kt ↗ | tags: #value-object #generic-identity #lazy-loading

A set of interfaces (StatementInterceptor, GlobalStatementInterceptor) that define hooks for before/after statement execution, commit, and rollback. The pattern allows composing multiple interceptors via CompositeSqlLogger and supports both JDBC and R2DBC backends. This is a clean, isolated plugin architecture that can be extracted for any system needing lifecycle instrumentation around database operations.

file: exposed-core/src/main/kotlin/org/jetbrains/exposed/v1/core/statements/StatementInterceptor.kt ↗ | tags: #interceptor #plugin-architecture #lifecycle-hooks

An extensible type mapping system for R2DBC that uses a TypeMapper interface with priority-based resolution and dialect/column-type filtering. Mappers are registered via ServiceLoader, with fallback to a DefaultTypeMapper. This pattern cleanly separates value conversion logic from the core framework and can be reused in any project needing pluggable, database-specific type conversions.

file: exposed-r2dbc/src/main/kotlin/org/jetbrains/exposed/v1/r2dbc/vendors/TypeMapper.kt ↗ | tags: #type-mapping #strategy-pattern #service-loader

A sealed class hierarchy representing database-specific FOR UPDATE / FOR SHARE locking options. Each subclass encapsulates the SQL suffix generation for a particular dialect (MySQL, PostgreSQL, Oracle, MariaDB), including wait/skip-locked modes. This pattern demonstrates clean separation of vendor-specific SQL generation into a type-safe, extensible hierarchy that can be adapted for any feature with dialect-specific syntax.

file: exposed-core/src/main/kotlin/org/jetbrains/exposed/v1/core/vendors/ForUpdateOption.kt ↗ | tags: #sealed-class #dialect-specific #locking

A lazy-loading iterable abstraction that separates the size/count of a result set from its actual iteration. SizedIterable and LazySizedIterable provide a consistent interface for pagination and result handling without forcing eager loading. This pattern is reusable in any Kotlin project that needs to represent deferred query results with known or unknown cardinality.

file: exposed-core/src/main/kotlin/org/jetbrains/exposed/v1/core/utils/SizedIterable.kt ↗ | tags: #lazy-evaluation #iterable #abstraction

An enumeration defining migration version naming formats (TIMESTAMP, MAJOR_MINOR, etc.) with regex-based parsing and fallback. It encapsulates the logic for generating and matching Flyway-compatible migration file names. This is a self-contained, testable component that can be extracted for any project needing configurable, pattern-based file naming conventions.

Last analyzed: 2026-10-14 16:50:33.078458
Next check: 2026-10-21 16:50:33.074583
$ submit: