DreamsComeTrue
A service that visualizes users' dream data as short-form videos using generative AI. A creative platform that allows users to record dreams in an entertaining way, remember them when desired, and recreate dreams.
프로젝트 개요
A creative service that transforms users' dreams into short-form videos using generative AI. Beyond simple dream recording, it provides a unique experience where users can enjoy their dreams in an entertaining way, revisit them whenever they want to remember, and visually recreate the atmosphere and emotions of their dreams.
This project focused on building a generative AI pipeline as its core objective. It integrates various generative AI services such as ChatGPT for dream data analysis and scene separation, Midjourney for image generation, and LUMA AI for video generation to automatically produce high-quality short-form videos. Built a message queue-based asynchronous processing architecture using RabbitMQ to efficiently manage the long processing times and unstable responses of generative AI services, and reliably handle complex call chains between multiple AI services.
As a backend developer, I was responsible for designing a Spring Boot-based microservices architecture, containerization and orchestration using Docker, building a stable integration system between generative AI services and Spring server, and implementing JWT-based authentication and social login (Google, Kakao) systems. Particularly, by implementing an event-based architecture through RabbitMQ, I efficiently handled the asynchronous nature of generative AI, and built a reliable service with retry mechanisms and status tracking systems for failed tasks.
나의 역할
Spring Boot 기반 백엔드 서버 기본 설정 및 구조 설계
Docker를 활용한 컨테이너화 및 Docker Compose를 통한 개발 환경 구성
RabbitMQ 기반 메시지 큐 시스템 구축 및 비동기 작업 처리 구현: AI 작업을 큐에 담아 비동기 처리하여 응답 시간 단축, 병렬 처리를 통한 여러 AI 작업 동시 실행, 대량 배치 최적화를 통한 작업 처리량 향상
생성형 AI 파이프라인 연동: ChatGPT, Midjourney, LUMA AI API 통합
생성형 AI 서비스와 Spring 서버 간의 안정적인 통신 레이어 구현
JWT 기반 토큰 인증 시스템 구현
소셜 로그인 시스템 구현 (Google OAuth, Kakao OAuth)
AI 작업 상태 추적 및 재시도 메커니즘 구현
데드레터 큐를 활용한 실패 작업 처리 및 모니터링
RESTful API 설계 및 구현
기술적 도전과제
Long Processing Times and Unstable Responses of Generative AI Services
Built a message queue-based asynchronous processing architecture using RabbitMQ to queue AI service calls for sequential processing. Tracked the status of each task and implemented timeout and retry logic to effectively manage unstable responses. Also utilized dead letter queues to separately manage and monitor repeatedly failing tasks.
Managing Complex Call Chains Between Multiple Generative AI Services
Systematically managed the workflow between each AI service (ChatGPT → Midjourney → LUMA AI) through RabbitMQ queues and exchanges. Designed an event-based architecture that configured separate queues for each stage and passed results from previous stages as inputs to next stages. Implemented mechanisms to roll back to previous stages or retry when tasks fail.
JWT Token-based Authentication and Social Login Implementation
Implemented a JWT-based authentication system using Spring Security and supported social login through Google OAuth and Kakao OAuth. Implemented token generation, validation, and refresh logic, and added a refresh token mechanism to improve user experience. Designed an integrated interface for each social login provider considering scalability.
Inter-service Communication and State Management in Microservices Environment
Implemented loose coupling between microservices through an event-based architecture using RabbitMQ. Designed the system to store task states in a centralized database and allow each service to query necessary state information for processing. Also utilized Redis to cache task states and progress for fast retrieval.
프로젝트 성과
Built a fully automated pipeline that converts users' dream data into short-form videos by integrating ChatGPT, Midjourney, and LUMA AI.
Achieved high task success rates by efficiently managing long processing times and unstable responses of generative AI through a message queue-based architecture using RabbitMQ, with retry mechanisms for failed tasks.
Containerized each service using Docker and configured development environments through Docker Compose, providing consistent environments from development to deployment.
기술 선택 이유
Spring Boot
A proven framework for enterprise-level application development, suitable for RESTful API development and microservices architecture implementation. Efficiently handles authentication/authorization systems through Spring Security and data persistence management through Spring Data JPA.
RabbitMQ
Built a message queue-based asynchronous processing architecture to manage the long processing times and complex call chains of generative AI services. Through RabbitMQ, we queued tasks between multiple AI services (ChatGPT, Midjourney, LUMA AI) for sequential processing, and implemented retry mechanisms for failed tasks and error handling using dead letter queues. This effectively managed the unstable response times and errors of generative AI, improving system stability and reliability.
Docker
Containerized each component of the microservices architecture to ensure consistency between development and production environments, enabling independent scaling and deployment. Used Docker Compose to configure local development environments and run each service (Spring Boot server, RabbitMQ, MySQL, Redis) as containers, simplifying dependency management and deployment processes.
생성형 AI 파이프라인 (ChatGPT, Midjourney, LUMA AI)
Utilizes ChatGPT API to analyze user-input dream data, separate it into scenes, and select appropriate background music. Generates images visualizing the atmosphere and content of dreams through Midjourney, and finally creates short-form videos through LUMA AI. Stably calls each AI service's API, processes responses, and implements retry logic for failures to produce high-quality results.
시스템 아키텍처
Click to enlarge.System Architecture

PWA frontend and backend microservices architecture: Integrated structure of frontend (PWA), backend core service, RabbitMQ message broker, and generative AI services (ChatGPT, Midjourney, LUMA AI)
Asynchronous Processing Architecture (CALL-CHAIN)

Asynchronous processing flow using RabbitMQ-based message queue: Task processing and feedback mechanism through Node.js event loop, external services, process function, and checker function
Technology Stack (VARIOUS STACK)

Various technology stacks used in the project: Technologies classified into EFFECTIVE (Node.js, Spring Boot, Redis), PRODUCTIVE (Next.js, JavaScript, Express), STABLE (Nginx, TypeScript, Java) groups
성능 최적화
Message Queue-based Asynchronous Processing
Efficiently managed long processing times of generative AI services through a message queue-based architecture using RabbitMQ. Queued tasks between multiple AI services for sequential processing and executed multiple AI tasks simultaneously through parallel processing to reduce overall processing time.
Retry Mechanism and Dead Letter Queue
Implemented retry mechanisms to handle unstable responses from generative AI services. Failed tasks are moved to dead letter queues for separate management and monitoring, improving system stability and reliability.
데이터베이스 최적화
Task Status Tracking and Caching
Utilized Redis to cache AI task states and progress for fast retrieval. Designed the system to store task states in a centralized database and allow each service to query necessary state information for processing.
API 설계
Designed a consistent API structure following RESTful API design principles. Defined clear API boundaries for each service considering microservices architecture, and enhanced security through JWT-based authentication. Also provided endpoints to query the status of asynchronous tasks to improve user experience.
보안 구현
JWT Token-based Authentication and Social Login
Implemented a JWT-based authentication system using Spring Security and supported social login through Google OAuth and Kakao OAuth. Implemented token generation, validation, and refresh logic, and added a refresh token mechanism to improve user experience.
테스트 전략
Wrote unit tests and integration tests for each service considering the characteristics of microservices architecture. Focused on testing asynchronous task processing logic using RabbitMQ to ensure reliability of the message queue-based architecture. Also implemented mocking tests for generative AI service integration to enable testing without external dependencies.
KPT 회고
Keep
The message queue-based architecture using RabbitMQ effectively managed the long processing times and unstable responses of generative AI. Significantly improved system stability by implementing retry mechanisms for failed tasks.
Maintained consistency between development and production environments through Docker containerization, and improved maintainability by clearly separating component responsibilities through Spring Boot microservices architecture.
Problem
We lacked strategies for cost management and optimization of generative AI services. While using services with high API call costs, we failed to carefully design strategies to minimize unnecessary retries or duplicate calls.
The lack of real-time feedback or progress indicators for the long video generation time resulted in a poor user experience.
Try
Before introducing generative AI services, I will first conduct research comparing price structures of various models and service providers to find the most cost-effective combination in terms of quality.
To convert wait time into part of the experience, I would like to try providing additional features like dream interpretation or emotion analysis during video generation, or implementing functionality for users to explore videos created by others.
To systematically improve the quality of generative AI responses, I will introduce a prompt version control system and build a process to continuously optimize by creating a system to evaluate the quality of results for each prompt.