kotlin-ktor-patterns

Generate maintainable Kotlin Ktor HTTP servers with REST APIs, JWT authentication, and Koin DI.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/luongldptit/move-ticket --skill kotlin-ktor-patterns-luongldptit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-ktor-patterns
Source: https://github.com/luongldptit/move-ticket/tree/main/.agent/skills/kotlin-ktor-patterns
Command: npx skills add https://github.com/luongldptit/move-ticket --skill kotlin-ktor-patterns-luongldptit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers building Ktor HTTP servers often lack consistent, maintainable patterns for core components like routing, authentication, and dependency injection, leading to boilerplate code, security gaps, and difficult-to-test implementations.

Core Features & Use Cases

  • Standardized Project Structure: Pre-defined layout separating routes, plugins, services, repositories, and DI modules for maintainable Ktor projects.
  • Core Plugin Patterns: Ready-to-use configurations for ContentNegotiation with kotlinx.serialization, JWT authentication, CORS, StatusPages error handling, and WebSockets.
  • Koin Dependency Injection: Built-in patterns for DI module setup, route-level service injection, and test-specific DI modules.
  • Integration Testing: Complete testApplication workflows for testing public and authenticated routes, error cases, and request validation.
  • Real-World Use Case: Use this skill to scaffold a production-ready user management API with JWT auth, input validation, and full test coverage in minutes instead of hours.

Quick Start

Use the kotlin-ktor-patterns skill to generate a complete, production-ready Ktor user management API with JWT authentication, Koin dependency injection, and full integration test suite.

Frequently Asked Questions about kotlin-ktor-patterns

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

FAQPage Schema
How do I configure JWT authentication in a Ktor server?

Configuring JWT authentication in a Ktor server involves applying ready-to-use plugin patterns that handle token validation and secure routes. This skill provides standardized JWT configurations to prevent security gaps and reduce manual boilerplate setup.

What is the best way to set up Koin dependency injection in Ktor?

Setting up Koin dependency injection in Ktor is best achieved using pre-defined module layouts that separate routes, services, and repositories. This skill provides built-in patterns for DI module setup and route-level service injection to ensure maintainability.

How do I write integration tests for a Ktor REST API?

Writing integration tests for a Ktor REST API involves using complete testApplication workflows to verify public and authenticated routes. This skill provides full integration test coverage for endpoint validation, error cases, and request serialization.

How does Ktor handle centralized error handling and CORS configuration?

Centralized error handling and CORS configuration in Ktor are managed through core plugin patterns like StatusPages and CORS. This skill provides ready-to-use configurations to handle errors centrally and enable cross-origin resource sharing securely.

Can I use kotlinx serialization for type-safe requests in Ktor?

You can use kotlinx serialization for type-safe requests in Ktor by configuring the ContentNegotiation plugin. This skill provides standardized configurations for type-safe request serialization across your REST API endpoints.

Does Ktor support WebSocket implementation with Kotlin coroutines?

Ktor supports WebSocket implementation with Kotlin coroutines for real-time communication. This skill provides production-ready patterns to scaffold WebSocket routes alongside your existing REST API structure.