6 min read
Lucid Lens
The Spark of Inspiration
Have you ever woken up from a vivid dream, only to feel the details slipping away minutes later? This frustrating experience was the catalyst for creating LucidLens.
During a late-night brainstorming session for our hackathon project, our team was sharing recent dream experiences. We realized how quickly these dreams fade from memory and how difficult it is to describe them accurately with just words.
One team member mentioned how she kept a dream journal but felt frustrated by the limitations of text alone.
That’s when it clicked - what if we could leverage modern AI to not only record dreams but transform them into visual representations?
LucidLens was born from this simple idea: create a platform that helps users preserve their dreams by converting them into visual art while providing psychological insights.
Try it now at lucidlens.haomin.tech.
Currently AI is disabled as the hackathon backend are offline😣
Architecting the Dream Machine
Designing the architecture for LucidLens required careful consideration of both user experience and technical scalability. We needed a system that could handle natural language processing, image generation, and provide a seamless interface for users.

Frontend Architecture
We chose Next.js 14 with App Router as our frontend framework for several reasons:
- Server-side rendering capabilities for improved performance
- Simplified routing with the new App Router
- Built-in API route functionality
- TypeScript support for better code quality

For the UI, we implemented a clean, intuitive interface using:
- Tailwind CSS for responsive styling
- shadcn/ui components for consistent design elements
- Framer Motion for subtle animations that enhance the dreamy experience
- Lucide icons for visual elements
Backend Infrastructure
The backend architecture was built entirely on AWS services to ensure scalability and reliability:
- API Layer: Amazon API Gateway coupled with Lambda functions for serverless compute
- Processing Pipeline:
- GPT-4o Mini for natural language processing and dream analysis
- Amazon Titan for image generation
- Amazon Bedrock for advanced AI processing
- EC2 instances for heavier AI computation tasks
- Storage Solutions:
- S3 buckets for storing dream images and video content
- DynamoDB for user data and dream journals, optimized for quick retrieval
- Authentication & Security:
- NextAuth.js with GitHub OAuth for secure user authentication
- IAM roles for granular access control across AWS services
- Monitoring:
- CloudWatch for performance metrics and logs
- Automated alerts for system health monitoring
User Flow
The dream capture and visualization process follows this sequence:
- User submits initial dream fragments (mood, protagonist, scenario)
- System generates customized questions based on dream content
- User answers the questions, providing more context
- GPT processes the combined information and generates a prompt for image creation
- Amazon Titan transforms the prompt into a visual representation
- The image is stored in S3 and displayed to the user
- Optionally, the system can generate a short video representation
This architecture allowed for a seamless flow from dream input to visual output, with each component handling its specialized task efficiently.
Navigating Technical Challenges
Building LucidLens wasn’t without its difficulties. We encountered several significant challenges that pushed our technical boundaries:
AWS Complexity
The most formidable obstacle was our limited experience with AWS services. While we had theoretical knowledge, implementing a production-ready architecture using services like Lambda, API Gateway, and DynamoDB presented a steep learning curve. Documentation alone wasn’t enough - we spent countless hours experimenting with configurations and troubleshooting deployment issues.
Lambda functions, in particular, proved challenging. Understanding the event-driven model, managing cold start times, and configuring proper IAM permissions required significant effort. We initially struggled with timeout issues when processing larger dreams, forcing us to optimize our code and reconsider our resource allocation strategy.
AI Integration Challenges

Integrating multiple AI services required careful orchestration:
- Prompt Engineering: Creating effective prompts for GPT-4o Mini that would generate consistent, meaningful dream analyses took multiple iterations.
- Image Generation Quality: Early tests with Amazon Titan produced inconsistent results, requiring us to refine our prompt strategy and implement additional post-processing.
- Resource Management: Balancing performance with cost considerations led us to implement smart caching mechanisms for frequently requested analyses.
Data Flow Optimization
Another challenge was managing the complex data flow between services. The sequence diagram below illustrates this complexity:

Ensuring this flow remained efficient while handling potential failures at any step required robust error handling and recovery mechanisms.
The Thrill of Recognition
After weeks of intense development, debugging, and optimization, our team was ecstatic to learn that LucidLens had been selected as a finalist in the hackathon. This recognition validated our technical approach and the value of our solution.
The judges were particularly impressed by:
- The seamless integration of multiple AWS services
- The quality of the AI-generated dream visualizations
- The thoughtful user experience design
- The potential for psychological insight through dream analysis
Being recognized among dozens of competing projects gave us a tremendous confidence boost as early-career developers. It confirmed that we could architect and implement complex, production-grade applications despite our relative inexperience.
During the final presentation, seeing the audience’s reaction to our live demo was particularly rewarding. The moment when we showed how a user’s text description transformed into a visual representation generated audible gasps and immediately demonstrated the value proposition.
Lessons from the Dreamworld

Building LucidLens taught us invaluable lessons that will shape our approach to future projects:
Technical Lessons
- Start Simple, Scale Gradually: We initially tried to implement too many features simultaneously. Learning to build incrementally—establishing core functionality before adding complexity—proved more effective.
- AWS Expertise Takes Time: There’s no shortcut to understanding cloud architecture. Practical implementation taught us more than any tutorial could, particularly about service limitations and best practices.
- AI Integration Requires Iteration: Working with AI models is an iterative process. What works in theory often needs refinement in practice, especially regarding prompt engineering and result consistency.
- Serverless Has Tradeoffs: While Lambda functions provided excellent scalability, they came with complexities around cold starts and execution limitations that required careful design considerations.
Project Management Insights
- Documentation Is Crucial: Maintaining comprehensive documentation of our architecture decisions and API specifications saved countless hours during implementation and troubleshooting.
- Testing AI Components Requires Special Approaches: Traditional unit tests weren’t sufficient for AI components that produce variable outputs. We developed evaluation frameworks focused on output quality rather than exact matching.
- User Feedback Drives Development: Early user testing revealed that our initial UI was overly complex. Simplifying the dream input process significantly improved user engagement.
Looking to the Future
LucidLens represents just the beginning of our journey into AI-enhanced applications. Future enhancements we’re considering include:
- More sophisticated dream pattern analysis across multiple entries
- Enhanced sharing capabilities with privacy controls
- Integration with wearable devices to capture physiological data during sleep
- Expanded visualization options using more advanced generative models
This project has been transformative for my technical growth. It pushed me to understand not just individual technologies, but how they interconnect to create a cohesive user experience.
The challenges we overcame have prepared me for larger, more complex systems in my professional career.
Dreams may be ephemeral, but the lessons from building LucidLens will remain concrete foundations for my development journey.
- Follow the project on GitHub.*