テンプレート一覧に戻る
Kotlin + Ktor
Kotlin + Ktor + Coroutines のプロジェクト向けCLAUDE.md。軽量な非同期サーバー開発に最適です。
中級kotlinktorcoroutinesapi
CLAUDE.md
# プロジェクト名
Kotlin + Ktor で構築された非同期APIサーバー。
## 技術スタック
- **フレームワーク**: Ktor 3.x
- **言語**: Kotlin 2.1+
- **非同期**: Kotlin Coroutines
- **シリアライゼーション**: kotlinx.serialization
- **ビルド**: Gradle 8.x (Kotlin DSL)
- **テスト**: kotlin.test + Ktor test host
## コマンド
| コマンド | 用途 |
|---------|------|
| `./gradlew run` | 開発サーバー起動 |
| `./gradlew test` | テスト実行 |
| `./gradlew build` | ビルド |
| `./gradlew ktlintCheck` | Lint実行 |
| `./gradlew ktlintFormat` | フォーマット |
## ディレクトリ構造
| パス | 役割 |
|-----|------|
| `src/main/kotlin/.../routes/` | ルーティング定義 |
| `src/main/kotlin/.../plugins/` | Ktorプラグイン設定 |
| `src/main/kotlin/.../models/` | データモデル |
| `src/main/kotlin/.../services/` | ビジネスロジック |
| `src/main/resources/` | 設定ファイル (application.conf) |
## コーディング規約
- data classでイミュータブルなデータモデル
- `suspend fun` で非同期処理
- kotlinx.serializationで型安全なJSON変換
- 拡張関数で既存型を拡張
- sealed classでエラー型を網羅的に扱う
## Git規約
- ブランチ: `feature/`, `fix/`, `chore/`
- コミットメッセージ: Conventional Commits形式