DEV Community

Danilo Caffaro
Danilo Caffaro

Posted on

How I Built an AI Course Generator in a Weekend (DuoUniversal)

How I Built an AI Course Generator in a Weekend (DuoUniversal) Tags: #ai #gemini #react #microlearning Cover image: (to be generated in Phase 2) Canonical URL: (self-published) --- ## The Problem: Duolingo Only Works for Languages I love Duolingo. The gamification, the bite-sized lessons, the streaks — it's genuinely addictive in the best way. But what if I want to learn options trading with the same format? Or stoic philosophy? Or AWS certifications? The Duolingo formula works because it breaks complex topics into tiny, testable chunks with immediate feedback. But the platform is locked to languages. So I built DuoUniversal — Duolingo's format, but for any topic. Powered by AI. 🔗 Live demo: duouniversal.vercel.app 🔗 GitHub: github.com/danilocaffaro/duouniversal --- ## The Tech Stack (Keep It Simple) I wanted to ship fast, so I kept the stack minimal: - Frontend: Vite + React + Tailwind CSS - AI: Google Gemini 2.0 Flash (via API) - State: LocalStorage (no backend yet) - Deploy: Vercel (one-click) Total build time: ~12 hours across a weekend. --- ## How It Works (3-Step Pipeline) ### Step 1: User Describes a Topic Example: "I want to learn options trading" ### Step 2: AI Generates a Course Structure Gemini 2.0 Flash receives a prompt like this:


You are a course designer. Create a structured learning path for: "options trading" Output a JSON array of 10 lessons, ordered from beginner to advanced. Each lesson should have: - title (string) - description (2 sentences explaining what the learner will understand) - difficulty (beginner | intermediate | advanced) - estimatedMinutes (number, 3-7 min per lesson) Focus on concepts that can be taught in micro-lessons with multiple-choice questions.

Response example:

json [ { "title": "What Are Options? (Basics)", "description": "Understand the fundamental definition of stock options and the difference between calls and puts. Learn why traders use options instead of buying stocks directly.", "difficulty": "beginner", "estimatedMinutes": 5 }, { "title": "Strike Price and Expiration", "description": "Learn what a strike price is and how expiration dates affect option value. Understand the relationship between these two critical variables.", "difficulty": "beginner", "estimatedMinutes": 4 }, ... ]

### Step 3: AI Generates Lesson Content + Questions For each lesson, a second Gemini call generates: 1. Lesson content (3-5 short paragraphs, Duolingo-style) 2. 3-5 multiple-choice questions with: - Question text - 4 answer options - Correct answer index - Explanation of why the answer is correct Prompt:

Generate a micro-lesson for: "What Are Options? (Basics)" Include: 1. Lesson text (3-5 paragraphs, conversational tone, Duolingo-style simplicity) 2. 3 multiple-choice questions to test understanding Output as JSON.

Response:

json { "lessonText": "An option is a contract that gives you the *right* (but not the obligation) to buy or sell a stock at a specific price...", "questions": [ { "question": "What does owning a call option give you the right to do?", "options": [ "Sell a stock at any price", "Buy a stock at a predetermined price", "Borrow money from a broker", "Avoid paying taxes" ], "correctIndex": 1, "explanation": "A call option gives you the right to *buy* a stock at the strike price, not sell it." }, ... ] }

--- ## The UX: Duolingo's Formula Once the course is generated, the experience mirrors Duolingo: 1. Progress bar showing lesson completion 2. XP system — earn points for correct answers 3. Streaks (coming soon) — daily learning reminders 4. Levels — unlock harder lessons as you progress 5. Immediate feedback — see the correct answer + explanation after each question All progress is saved to LocalStorage (no login required for MVP). --- ## What Worked Well ### ✅ Gemini 2.0 Flash is Fast Course generation takes 2-5 seconds for a 10-lesson course. Fast enough that users don't get impatient. ### ✅ Structured Prompts = Consistent Output By enforcing JSON output with strict schemas, I avoided 90% of parsing issues. Gemini follows instructions well when you're specific. ### ✅ Vite + Tailwind = Rapid Prototyping I built the entire UI in ~4 hours. Tailwind's utility classes made it trivial to match Duolingo's clean aesthetic. --- ## What I'd Do Differently ### ❌ No Backend = No Analytics I can't track: - Which topics are most popular - Where users drop off - Conversion to premium (once I add it) Next step: Add a lightweight backend (Supabase or Firebase) just for analytics. ### ❌ Gemini Occasionally Generates Bad Questions Some questions are ambiguous or have typos. I need a curation layer where I manually review top topics (e.g., "Python", "Stock Trading") and lock those as "verified courses." ### ❌ No Mobile App The web app is responsive, but a native mobile app would be 10x stickier. Duolingo's streaks work because of push notifications. --- ## Monetization Strategy (The "First Dollar" Challenge) I'm running an experiment: Can I generate $1 from this in 7 days? Here's the plan: 1. Free tier with ads (Google AdSense) 2. Ko-fi "Buy Me a Coffee" button ($3 one-time donation) 3. Premium tier ($7.99/mo) — ad-free, unlimited courses, offline mode 4. Gumroad PWYW — "Support the project" with $0 minimum I'll report back on what actually converts. --- ## Open Source Plans The entire codebase will be open-sourced on GitHub: 🔗 Repo: github.com/danilocaffaro/duouniversal Why open source? - Educational value — Others can learn from the AI integration - Community contributions — Let people add features (e.g., flashcards, spaced repetition) - Credibility — "Here's the actual code" is more convincing than a landing page --- ## Try It Yourself 🔗 Live demo: duouniversal.vercel.app Suggested topics to try: - "Stoic philosophy" - "AWS Solutions Architect certification" - "Copywriting fundamentals" - "How to read financial statements" I'd love feedback — especially on: - Which topics generate good vs. bad lessons? - Would you pay $7.99/mo for ad-free + offline mode? - What features would make this a daily habit like Duolingo? --- ## Next Steps Week 1: - [ ] Add analytics (Vercel Analytics or Supabase) - [ ] Implement Ko-fi integration - [ ] Curate + verify 10 "premium" topics manually Week 2-4: - [ ] Launch on Product Hunt - [ ] Add user accounts (OAuth via Supabase) - [ ] Build streak/reminder system - [ ] Mobile app (React Native or PWA) --- Follow my progress: - Dev.to: @danilocaffaro - GitHub: @danilocaffaro - Gumroad: caffaro.gumroad.com If you build something with this idea, tag me — I want to see what you create! --- Published: 2026-02-27 | Read time: 5 min

Top comments (0)