affaan-m avatar

Kotlin Exposed Patterns

This covers the practical patterns you need when working with JetBrains Exposed ORM in Kotlin. It shows both DSL and DAO query styles, sets up HikariCP connection pooling with proper transaction isolation, and wires in Flyway for versioned migrations. The examples are production-oriented: composite primary keys, cascading deletes, JSONB columns, and a repository pattern that lets you swap in H2 for testing. The DSL syntax is clean but the transaction wrapping with newSuspendedTransaction can feel verbose if you're coming from something like Spring Data. Best for greenfield Kotlin projects or microservices where you want more control than a full ORM gives you but don't want to write raw JDBC.

skills.sh installs
4.6K
GitHub stars
229.1K
last updated
Jul 14, 2026

Install

$ npx -y skills add affaan-m/everything-claude-code --skill kotlin-exposed-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

Kotlin Exposed Patterns

Comprehensive patterns for database access with JetBrains Exposed ORM, including DSL queries, DAO, transactions, and production-ready configuration.

When to Use

  • Setting up database access with Exposed
  • Writing SQL queries using Exposed DSL or DAO
  • Configuring connection pooling with HikariCP
  • Creating database migrations with Flyway
  • Implementing the repository pattern with Exposed
  • Handling JSON columns and complex queries

How It Works

Exposed provides two query styles: DSL for direct SQL-like expressions and DAO for entity lifecycle management. HikariCP manages a pool of reusable database connections configured via HikariConfig. Flyway runs versioned SQL migration scripts at startup to keep the schema in sync. All database operations run inside newSuspendedTransaction blocks for coroutine safety and atomicity. The repository pattern wraps Exposed queries behind an interface so business logic stays decoupled from the data layer and tests can use an in-memory H2 database.

Examples

DSL Query

Sponsors

Details

Repository
github.com/affaan-m/everything-claude-code
Categories
Mobile Development, Java & JVM
First seen
Apr 16, 2026

More from affaan-m/everything-claude-code

All 256
1dpearson2699 avatardebugging-instrumentsdpearson2699/swift-ios-skillsDebug iOS apps and profile performance using LLDB, the interactive Memory Graph Debugger, and Instruments. Use for crashes, retain-cycle inspection, hangs, buil4.3Kskills.sh installs
2dpearson2699 avatarstorekitdpearson2699/swift-ios-skillsImplement, review, or improve in-app purchases and subscriptions using StoreKit 2. Use when building paywalls with SubscriptionStoreView or ProductView, process4.2Kskills.sh installs
3dpearson2699 avatarapple-on-device-aidpearson2699/swift-ios-skillsBuild private, on-device AI features on iPhone, iPad, and Mac with Foundation Models, Core ML, MLX Swift, or llama.cpp. Use when choosing an Apple-local model r4.2Kskills.sh installs
4dpearson2699 avatarapp-intentsdpearson2699/swift-ios-skillsImplement App Intents for Siri, Shortcuts, Spotlight, widgets, Control Center, and Apple Intelligence on iOS. Covers AppIntent actions, AppEntity and EntityQuer4.1Kskills.sh installs
5dpearson2699 avatarbackground-processingdpearson2699/swift-ios-skillsSchedule and execute background work on iOS using BGTaskScheduler. Use when registering BGAppRefreshTask for short background fetches, BGProcessingTask for long4.1Kskills.sh installs
6dpearson2699 avatarhealthkitdpearson2699/swift-ios-skillsRead, write, and query Apple Health data using HealthKit. Covers HKHealthStore authorization, sample queries, statistics queries, statistics collection queries 4Kskills.sh installs