Step 1: Learn the Three Stages of Data (5 min)
Stage 1: Mock Data (Prototype)
const habits = [
{ id: 1, name: 'Drink water', streak: 5, completed: true },
{ id: 2, name: 'Exercise', streak: 3, completed: false },
]
Hardcoded in code. Same data every time. Good for: prototyping UI, testing layouts. Limitations: no persistence, can't add/edit/delete for real.
Stage 2: LocalStorage (Prototype+)
const habits = JSON.parse(localStorage.getItem('habits') || '[]')
localStorage.setItem('habits', JSON.stringify(habits))
Stored in browser. Persists across refreshes. Good for: single-user apps, personal tools. Limitations: device-specific, no multi-user, ~5MB limit.
Stage 3: Real Database (Production)
const { data, error } = await supabase.from('habits').select('*')
Stored on server. Good for: production, multi-user, cross-device sync. Limitations: requires setup, auth, async patterns, error handling.
Don't skip to Stage 3 too early
A common mistake: jumping straight to a real database before the UI is stable. Build with mock data first. Get the UI right. Then localStorage to test persistence. Then a real database when you need multi-user or cross-device. Each stage adds complexity — only add it when you need it.
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers Step 2: Identify Your Current Stage (3 min), Current Stage, Step 3: Plan the Transition (7 min), Next Stage: [stage name], Step 4: Make the Decision (5 min), Decision: [Transition now / Stay at current stage], Reasoning, If Transitioning — Spec for the AI, You're Done — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.