타로 미스틱 서비스의 백엔드 API 서버
기존 Spring Boot 기반 프로젝트를 Ktor 프레임워크로 마이그레이션한 Kotlin 백엔드 서비스입니다.
src/main/kotlin/com/tarotmystic/
├── app/
│ ├── application/ # 애플리케이션 서비스 (Facade 패턴)
│ │ └── dto/ # 애플리케이션 계층 DTO
│ ├── domain/ # 도메인 모델 및 비즈니스 로직
│ │ ├── auth/ # 인증 관련 도메인
│ │ ├── email/ # 이메일 관련 도메인
│ │ ├── tarot/ # 타로 관련 도메인
│ │ └── user/ # 사용자 관련 도메인
│ ├── infrastructure/ # 외부 시스템 연동
│ │ ├── auth/ # JWT, 암호화
│ │ ├── database/ # MongoDB 연결
│ │ ├── email/ # 이메일 전송
│ │ ├── repository/ # 데이터 저장소 구현
│ │ └── telegram/ # 텔레그램 봇
│ └── interfaces/ # 외부 인터페이스 (REST API)
│ ├── auth/ # 인증 API
│ ├── common/ # 공통 응답 DTO
│ └── tarot/ # 타로 API
├── config/ # 설정 클래스
└── Application.kt # 메인 애플리케이션
cp src/main/resources/application.yaml.example src/main/resources/application.yamlapplication.yaml 파일에서 다음 값들을 실제 환경에 맞게 수정:
app:
database:
mongodb:
uri: "mongodb+srv://username:password@cluster.mongodb.net/database"
database: "your_database_name"
security:
jwt:
secret: "your-256-bit-secret-key"
mail:
username: "your-email@gmail.com"
password: "your-app-password"
message:
bot-token: "your-telegram-bot-token"
chat-id: "your-telegram-chat-id"./gradlew run서버는 기본적으로 http://localhost:8080에서 실행됩니다.
POST /api/v1/tarot/add- 타로 결과 저장GET /api/v1/tarot/list- 타로 결과 목록 조회 (페이징)POST /api/v1/tarot/message- 관리자에게 메시지 전송POST /api/v1/tarot/image-history- 이미지 히스토리 저장
POST /api/v1/auth/register- 회원가입POST /api/v1/auth/login- 로그인GET /api/v1/auth/verify-email- 이메일 인증
모든 API는 통일된 응답 형식을 사용합니다:
{
"resultType": "SUCCESS|INVALID_PARAMETER|SERVER_ERROR",
"message": "응답 메시지",
"data": { }
}./gradlew run./gradlew buildFatJar
java -jar build/libs/tarot-mistic-ktor-all.jardocker build -t tarot-mystic-ktor .
docker run -p 8080:8080 tarot-mystic-ktor