AI 기반 웹소설 상호작용 플랫폼의 백엔드 서비스입니다. 사용자가 웹소설과 대화하며 스토리에 참여할 수 있는 혁신적인 경험을 제공합니다.
- 웹소설 등록, 조회, 수정, 삭제
- 표지 이미지 업로드 (Google Cloud Storage)
- 웹소설 검색 기능
- 에피소드 관리
- 웹소설 캐릭터와의 실시간 대화
- WebSocket 기반 스트리밍 응답
- 채팅방 생성 및 관리
- 질문/답변 히스토리 저장
- JWT 기반 인증/인가
- 회원가입, 로그인, 로그아웃
- 사용자 정보 관리
- 독서 진행도 추적
- 에피소드 구매 기능
- 구매 내역 관리
- 결제 상태 추적
- Spring Boot 3.5.3 - 메인 프레임워크
- Java 17 - 개발 언어
- Gradle - 빌드 도구
- MySQL - 메인 데이터베이스
- Redis - 세션 관리 및 캐싱
- H2 - 테스트 환경
- Google Cloud Storage - 파일 저장소
- Spring Security - 보안 프레임워크
- JWT (JSON Web Token) - 인증 토큰
- BCrypt - 비밀번호 암호화
- WebSocket - 실시간 통신
- WebFlux - 비동기 HTTP 클라이언트
- Apache POI - Excel 파일 처리
- OpenAPI/Swagger - API 문서화
- JUnit 5 - 단위 테스트
- Testcontainers - 통합 테스트
- JaCoCo - 테스트 커버리지
- Java 17 이상
- MySQL 8.0 이상
- Redis 6.0 이상
- Google Cloud Storage 계정 (파일 업로드용)
git clone [repository-url]
cd novelBot/Backendapplication-local.properties 파일을 다음과 같이 수정하여 H2 데이터베이스를 사용할 수 있습니다:
# H2 인메모리 데이터베이스
spring.datasource.url=jdbc:h2:mem:novelbot
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.h2.console.enabled=true
# JPA 설정
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.flyway.enabled=false
# JWT 설정 (테스트용)
jwt.secret=local-test-secret-key-for-development-only
jwt.expiration=86400
# Redis 비활성화 (선택사항)
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
# AI 서버 설정 (실제 서버 또는 로컬 모킹)
ai.server.url=http://localhost:8000
ai.server.username=admin
ai.server.password=admin123완전한 로컬 환경을 구축하려면 다음과 같이 설정:
# MySQL 데이터베이스
spring.datasource.url=jdbc:mysql://localhost:3306/novelbot
spring.datasource.username=your_username
spring.datasource.password=your_password
# Redis 설정
spring.data.redis.host=localhost
spring.data.redis.port=6379
# JWT 설정
jwt.secret=your-secret-key-change-in-production
jwt.expiration=86400000
# Google Cloud Storage 설정 (선택사항)
gcs.bucket-name=your-bucket-name
gcs.credentials-path=path/to/your/service-account.json
# AI 서버 설정
ai.server.url=http://your-ai-server-url
ai.server.username=your_username
ai.server.password=your_password별도 설정 불필요. 애플리케이션 실행 시 자동으로 인메모리 데이터베이스가 생성됩니다.
# MySQL 서버 설치 (macOS)
brew install mysql
brew services start mysql
# 데이터베이스 생성
mysql -u root -p
CREATE DATABASE novelbot CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'novelbot_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON novelbot.* TO 'novelbot_user'@'localhost';
FLUSH PRIVILEGES;# Redis 서버 설치 및 실행 (macOS)
brew install redis
brew services start redis# H2 데이터베이스로 실행
./gradlew bootRun --args='--spring.profiles.active=local'
# 또는 직접 Java로 실행
./gradlew bootJar
java -jar -Dspring.profiles.active=local build/libs/novelbot-api-0.0.1-SNAPSHOT.jarchmod +x gradlewgradlew.bat bootRun --args="--spring.profiles.active=local"./gradlew test./gradlew build- ✅ Java 17 설치 확인:
java -version - ✅ 프로젝트 클론 및 디렉토리 이동
- ✅ Gradle wrapper 권한 설정:
chmod +x gradlew(macOS/Linux) - ✅
application-local.properties파일 생성 및 설정 - ✅ 데이터베이스 설정 (H2는 자동, MySQL은 수동 설정)
# 1. 프로젝트 클론
git clone [repository-url]
cd novelBot/Backend
# 2. Gradle wrapper 권한 설정 (macOS/Linux)
chmod +x gradlew
# 3. application-local.properties 파일이 이미 존재하므로 바로 실행
./gradlew bootRun --args='--spring.profiles.active=local'- 메인 애플리케이션: http://localhost:8080
- API 문서 (Swagger): http://localhost:8080/swagger-ui.html
- H2 콘솔: http://localhost:8080/h2-console
- WebSocket 테스트: http://localhost:8080/websocket-test.html
- 헬스 체크: http://localhost:8080/actuator/health
# 다른 포트로 실행
./gradlew bootRun --args='--spring.profiles.active=local --server.port=8081'chmod +x gradlewgradlew.bat bootRun --args="--spring.profiles.active=local"export JAVA_OPTS="-Xmx2G -Xms1G"
./gradlew bootRun --args='--spring.profiles.active=local'애플리케이션 실행 후 다음 URL에서 API 문서를 확인할 수 있습니다:
- Swagger UI: http://localhost:8080/swagger-ui.html
- OpenAPI JSON: http://localhost:8080/api-docs
POST /auth/login- 로그인POST /auth/logout- 로그아웃POST /auth/signup- 회원가입
GET /novels- 웹소설 목록 조회GET /novels/{id}- 웹소설 상세 조회GET /novels/search?title={title}- 웹소설 검색POST /novels- 웹소설 등록PUT /novels/{id}- 웹소설 수정DELETE /novels/{id}- 웹소설 삭제POST /novels/{id}/cover- 표지 이미지 업로드
GET /episodes/novel/{novelId}- 특정 웹소설의 에피소드 목록GET /episodes/{id}- 에피소드 상세 조회POST /episodes- 에피소드 등록
GET /chatrooms- 채팅방 목록 조회POST /chatrooms- 채팅방 생성DELETE /chatrooms/{id}- 채팅방 삭제GET /chatrooms/novels- 채팅방 소설 목록GET /chatrooms/novel/{novelId}- 특정 소설의 채팅방 목록
POST /api/query- AI에게 질문하기- WebSocket:
/ws- 실시간 스트리밍 응답
GET /purchases- 구매 내역 조회POST /purchases- 에피소드 구매
GET /users/profile- 프로필 조회PUT /users/profile- 프로필 수정
src/main/java/com/novelbot/api/
├── config/ # 설정 클래스
├── controller/ # REST API 컨트롤러
├── domain/ # JPA 엔티티
├── dto/ # 데이터 전송 객체
├── mapper/ # DTO 매퍼
├── repository/ # 데이터 접근 계층
├── service/ # 비즈니스 로직
└── utility/ # 유틸리티 클래스
# 전체 테스트 실행
./gradlew test
# 테스트 커버리지 보고서 생성
./gradlew jacocoTestReport
# AI 서버 연동 테스트
./gradlew runAITest- JaCoCo: 테스트 커버리지 측정
- Spring Boot Actuator: 애플리케이션 모니터링
- Lombok: 보일러플레이트 코드 제거
# Docker 이미지 빌드
docker build -t novelbot-api .
# 컨테이너 실행
docker run -p 8080:8080 -e SPRING_PROFILES_ACTIVE=prod novelbot-api./gradlew bootJar
java -jar -Dspring.profiles.active=prod build/libs/novelbot-api-0.0.1-SNAPSHOT.jar- JWT 토큰 기반 인증
- CORS 설정 적용
- SQL Injection 방지 (JPA/MyBatis)
- XSS 공격 방지
- 파일 업로드 보안
Spring Boot Actuator를 통해 다음 메트릭을 모니터링할 수 있습니다:
/actuator/health- 애플리케이션 상태/actuator/metrics- 성능 메트릭/actuator/info- 애플리케이션 정보
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
이 프로젝트는 MIT 라이선스 하에 배포됩니다.
문의사항이 있으시면 다음으로 연락해주세요:
- 이메일: [[email protected]]
- GitHub Issues: [https://github.com/novelbot/Backend/issues]
💡 NovelBot은 AI와 웹소설의 만남으로 새로운 독서 경험을 제공합니다!