Replace raw SQL strings in a Kotlin backend with type-safe DSL queries checked by the compiler
Map database rows to Kotlin objects using the DAO style to work with records as class instances
Switch a Kotlin app from SQLite to PostgreSQL with minimal code changes using Exposed's shared abstraction layer
Add Exposed to a Spring Boot project using the optional integration module for managed database access
Requires a running database instance (PostgreSQL, MySQL, etc.) and the corresponding JDBC driver dependency.
Exposed is a database library for the Kotlin programming language, created by JetBrains. Its job is to let Kotlin programs talk to relational databases without requiring developers to write raw SQL strings scattered throughout their code. Instead, database queries are written using Kotlin syntax that the library translates into the appropriate SQL for whichever database the application is connected to. The library offers two distinct styles for working with data. The first is a DSL, short for Domain-Specific Language, which lets you describe queries and table operations using Kotlin code that closely resembles SQL but is checked by the compiler for correctness. The second is a DAO style, short for Data Access Object, which maps database rows to Kotlin objects so you can work with data as if it were regular class instances rather than table rows. You pick whichever approach suits your project, or mix them. Exposed works with several widely used databases: H2, MySQL, MariaDB, PostgreSQL, Oracle, Microsoft SQL Server, and SQLite. Because queries go through a shared abstraction layer, the goal is that switching from one database to another requires little to no changes in your application code. The library supports both the traditional JDBC connection approach and R2DBC, a newer reactive driver standard suited to non-blocking applications. The library is organized into separate modules you pull in depending on what you need. The core module is always required. You add the JDBC or R2DBC transport module based on your connection approach. Optional extension modules cover things like date and time handling, encrypted column storage, JSON column types, monetary amounts, and integration with Spring Boot if you are using that framework. Exposed is an official JetBrains project, available through the Maven Central package repository, and released under the Apache 2.0 license. A Slack channel and dedicated documentation site support people using it.
← jetbrains on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.