kotlin-exposed-patterns

Implement coroutine-safe database access with JetBrains Exposed and HikariCP.

1|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/samymity/bridge-ventures-backend --skill kotlin-exposed-patterns-samymity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-exposed-patterns
Source: https://github.com/samymity/bridge-ventures-backend/tree/main/.claude/skills/kotlin-exposed-patterns
Command: npx skills add https://github.com/samymity/bridge-ventures-backend --skill kotlin-exposed-patterns-samymity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the challenge of building production-ready, coroutine-safe database access layers with JetBrains Exposed, including query patterns, transaction management, and schema evolution.

Core Features & Use Cases

  • Exposed DSL and DAO patterns: Write SQL-like DSL queries or manage entity lifecycle via the DAO approach.
  • Coroutine-safe transactions: Use newSuspendedTransaction for atomic, suspendable database operations.
  • Production setup: Configure HikariCP connection pooling and run Flyway migrations at startup.
  • Repository pattern for decoupling: Wrap Exposed queries behind a clean repository interface for testability.
  • Advanced DB concerns: Handle JSONB columns, joins, pagination, batch inserts, upserts, and isolation levels.

Quick Start

Ask an AI to generate a Kotlin repository implementation for Exposed that supports CRUD, pagination, search, Flyway migration setup, and HikariCP-backed coroutine transactions.

Frequently Asked Questions about kotlin-exposed-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use JetBrains Exposed with Kotlin coroutines for database transactions?

Use `newSuspendedTransaction` for coroutine-safe database transactions with JetBrains Exposed. This suspending function ensures atomic, asynchronous database operations without blocking threads, keeping your Kotlin coroutine-based repository layers responsive.

What's the best way to structure a Kotlin Exposed repository for testability?

Structure an interface-driven repository pattern to decouple business logic from the Exposed implementation. Wrapping Exposed DSL and DAO queries behind clean repository interfaces keeps database access testable and maintainable.

How do I configure HikariCP connection pooling with Exposed and Flyway migrations?

Configure HikariCP connection pooling for Exposed and run Flyway migrations at application startup. This production setup manages database connections efficiently and evolves schema reliably alongside your Kotlin database access layer.

Does JetBrains Exposed support JSONB columns, pagination, and batch upserts?

Yes, JetBrains Exposed supports handling JSONB columns, joins, pagination, batch inserts, and upserts. These advanced database operations are exposed through its DSL and DAO query styles for complex data management.

When should I use Exposed DSL queries versus the DAO approach in Kotlin?

Use Exposed DSL queries for SQL-like syntax or the DAO approach for managing entity lifecycles in Kotlin. Both patterns handle advanced database concerns like joins and pagination, fitting different repository layer needs.

How do I set transaction isolation levels in a coroutine-safe Exposed repository?

Configure transaction isolation levels within `newSuspendedTransaction` blocks to ensure coroutine safety. This allows you to manage concurrency and consistency for atomic, suspendable database operations in your Exposed repository.