๐ก๏ธ Project Story: Solo Leveling IRL
๐ก What Inspired This Project
The inspiration for Solo Leveling IRL came from a deeply personal struggle with productivity and self-improvement. Like many developers, I found myself caught in cycles of starting ambitious projects only to abandon them weeks later. Traditional productivity apps felt sterile and disconnected from my interests.
Everything changed when I discovered the manhwa "Solo Leveling." The story of Sung Jin-Woo's transformation from the weakest hunter to the Shadow Monarch resonated profoundly with my own journey. I realized that what I needed wasn't just another todo appโI needed a system that made personal growth feel like an epic adventure.
The mathematical elegance of RPG progression systems fascinated me. If we consider personal growth as a function $f(x) = \log_2(1 + x)$ where $x$ represents effort invested, then consistent daily effort compounds exponentially over time. This became the core philosophy: small daily quests leading to legendary transformation.
๐ง What I Learned
Technical Mastery
Building this platform taught me invaluable lessons across the full stack:
Frontend Architecture: Moving from scattered React components to a cohesive design system taught me the importance of component composition and state management patterns. Implementing Zustand instead of Redux showed me that simplicity often trumps complexity.
TypeScript Proficiency: Writing type-safe code for complex nested objects like quest schemas and AI responses deepened my understanding of TypeScript's advanced features:
interface QuestReward {
xp: number;
shadowPoints: number;
calculation: (difficulty: number, timeInvestment: number) => number;
}
Database Design: Creating relational schemas that could handle user progression, quest hierarchies, and achievement systems taught me about normalization vs. denormalization trade-offs in real applications.
AI Integration Challenges
Working with Google's Gemini AI API revealed the complexity of prompt engineering. The mathematical challenge was optimizing for both response quality and API cost efficiency:
$$\text{Optimal Prompt Length} = \arg\min_{L} \left( \frac{\text{Cost}(L)}{\text{Quality}(L)} \right)$$
Where $L$ represents prompt length, and I discovered that context-specific prompts around 200-300 tokens provided the best cost-to-quality ratio.
User Experience Psychology
The most surprising learning was about gamification psychology. I discovered that:
- Variable reward schedules (like random XP bonuses) create stronger engagement than fixed rewards
- Progress visualization through level bars triggers dopamine release similar to actual gaming
- Narrative consistency (maintaining the Solo Leveling theme) significantly impacts user retention
๐จ How I Built This Project
Phase 1: Foundation Architecture (Weeks 1-2)
Started with a solid technical foundation:
# Initial setup with modern tooling
npm create vite@latest solo-leveling-irl -- --template react-ts
npm install @clerk/clerk-react drizzle-orm @neondatabase/serverless
I chose Vite over Create React App for its superior build speed, and Clerk for authentication because building secure auth from scratch would have taken months.
Phase 2: Database Design (Week 3)
Designed the core schema focusing on scalability:
-- User progression table with mathematical constraints
CREATE TABLE users (
id SERIAL PRIMARY KEY,
xp INTEGER DEFAULT 0 CHECK (xp >= 0),
level INTEGER GENERATED ALWAYS AS (FLOOR(LOG(2, xp + 1))) STORED,
shadow_points INTEGER DEFAULT 0
);
The level calculation uses a logarithmic function to ensure that each level requires exponentially more XP, mimicking real skill development.
Phase 3: AI Integration (Weeks 4-5)
Integrating Gemini AI required solving several complex problems:
Prompt Optimization: Created a systematic approach to generate consistent, useful responses:
const generateQuestPrompt = (userContext: UserProfile, weatherData: WeatherInfo) => {
const contextWeight = calculateContextWeight(userContext);
const weatherModifier = getWeatherDifficultyModifier(weatherData);
return `Generate 3-5 realistic daily quests for a ${userContext.focusArea} hunter...`;
};
Rate Limiting: Implemented intelligent caching to minimize API calls while maintaining responsiveness.
Phase 4: UI/UX Polish (Weeks 6-8)
The visual design required balancing aesthetic appeal with functional usability:
- Glass morphism effects using CSS backdrop-filter
- Smooth animations with Framer Motion for state transitions
- Responsive design that works equally well on phones and ultrawide monitors
Phase 5: Audio Integration (Week 9)
Adding the Solo Leveling soundtrack created unexpected technical challenges:
- Audio autoplay policies in modern browsers
- Memory management for multiple audio tracks
- Seamless looping without audible gaps
๐ง Challenges I Faced
Challenge 1: AI Response Consistency
Problem: Gemini AI would sometimes generate wildly inconsistent quest rewards, breaking the game balance.
Solution: Implemented a mathematical validation layer:
const validateQuestReward = (difficulty: number, timeInvestment: number): boolean => {
const expectedXP = Math.floor(difficulty * timeInvestment * BASE_XP_MULTIPLIER);
const variance = 0.2; // 20% acceptable variance
return Math.abs(calculatedXP - expectedXP) <= expectedXP * variance;
};
This ensures all quest rewards follow a predictable mathematical progression.
Challenge 2: Database Performance
Problem: As user data grew, quest loading became noticeably slow.
Solution: Implemented strategic indexing and query optimization:
-- Composite index for efficient quest filtering
CREATE INDEX idx_user_quests ON quests(user_id, status, created_at DESC);
This reduced average query time from ~200ms to ~15ms.
Challenge 3: Cross-Platform Audio
Problem: Audio playback behavior varied dramatically across iOS Safari, Android Chrome, and desktop browsers.
Solution: Created a platform-aware audio manager:
class AudioManager {
private detectPlatform(): AudioPlatform {
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
const isMobile = window.innerWidth < 768;
return { isIOS, isMobile, requiresUserGesture: isIOS || isMobile };
}
}
Challenge 4: State Management Complexity
Problem: Managing user progress, quest states, AI responses, and UI state became unwieldy with useState hooks.
Solution: Migrated to Zustand with a carefully architected store structure:
interface GameState {
user: UserProfile;
quests: Quest[];
audioSettings: AudioConfig;
ui: UIState;
}
This centralized state management while maintaining the simplicity I wanted.
Challenge 5: TypeScript Complexity
Problem: Complex nested types for AI responses and quest objects were causing development slowdowns.
Solution: Implemented progressive type refinement:
// Base types
interface BaseQuest {
id: string;
title: string;
difficulty: number;
}
// Extended types
interface AIGeneratedQuest extends BaseQuest {
aiContext: GeminiResponse;
calculatedReward: QuestReward;
}
This approach made the codebase more maintainable while preserving type safety.
๐ Mathematical Models Behind the System
XP Progression Formula
The core progression uses a logarithmic scale to ensure meaningful advancement:
$$\text{Level} = \lfloor \log_2(\text{XP} + 1) \rfloor$$
This means:
- Level 1: 1 XP
- Level 2: 2 XP
- Level 3: 4 XP
- Level 4: 8 XP
- Level 10: 512 XP
Quest Difficulty Calculation
Quest rewards follow a polynomial function based on multiple factors:
$$\text{XP Reward} = \alpha \cdot D^{1.5} \cdot T^{0.8} \cdot M$$
Where:
- $D$ = Difficulty rating (1-10)
- $T$ = Time investment (hours)
- $M$ = Weather/context modifier (0.8-1.2)
- $\alpha$ = Base XP multiplier (adjustable)
This ensures that harder, longer quests provide proportionally better rewards while accounting for external factors.
๐ฏ Impact and Future Vision
Building Solo Leveling IRL taught me that the best productivity tools don't feel like tools at allโthey feel like games you want to keep playing. The mathematical progression systems, combined with narrative engagement, create genuine behavior change.
The project represents more than just a productivity app; it's a proof-of-concept for gamified personal development that respects both the user's intelligence and their need for genuine motivation.
Future plans include:
- Machine learning models to personalize quest generation based on completion patterns
- Social features enabling guild-based collaborative progress
- Integration APIs for fitness trackers, calendar apps, and other productivity tools
- Mobile app development for seamless cross-platform experience
The mathematical foundation I've built supports virtually unlimited feature expansion while maintaining the core progression balance that makes the system engaging.
๐ฎ Personal Transformation
Perhaps the most unexpected outcome was how building this project changed my own productivity habits. By dog-fooding my own creation, I've completed more personal development goals in the past few months than in the previous year.
The project validated my hypothesis: when you transform productivity into an epic narrative with mathematical progression, sustainable behavior change becomes not just possible, but inevitable.
Like Sung Jin-Woo's journey from E-Rank to Shadow Monarch, this project represents my own evolution from someone who struggled with consistency to someone who has built a system that makes growth feel like the most engaging
Built With
- clerk
- drizzle
- framer
- gemini
- howler
- neon
- progressive
- react
- tailwind
- typescript
- uploadthing
- vite
- zustand
Log in or sign up for Devpost to join the conversation.