Skip to content

pradeepverse/sparkle-app

Repository files navigation

✨ Sparkle

A habit gamification app for kids β€” powered by a magical unicorn pet

Live App Deploy PWA React TypeScript


Built for a 5-year-old girl who deserves a magical way to build good habits. Every completed habit feeds her unicorn β€” and earns stars she can spend on real rewards.


How it works

For the child

  1. Open the app each morning and tap habits as you do them
  2. Every tap earns ⭐ stars β€” watch the unicorn change mood!
  3. Habits that need parent sign-off show a "⏳ Waiting…" badge
  4. Save up stars and spend them in the πŸͺ Reward Shop

For the parent

  1. Tap πŸ‘©β€πŸ‘§ Parent β†’ enter your 4-digit PIN
  2. Review pending habits and tap βœ… Approve (25% chance of a lucky bonus star!)
  3. Award stars directly for habits you observed yourself
  4. Check the πŸ“Š Dashboard for streaks and weekly progress
  5. Use βš™οΈ Configure to customise habits, rewards, and data backup

Features

Child view

Feature Details
Daily habit checklist Grouped into Morning / All Day / Evening
Once-daily habits Big tap button, turns green when done
Repeatable habits Tap multiple times (water glasses, potty), shows progress dots
Parent-approve habits Tapping sends to parent queue β€” child sees "⏳ Waiting…"
Parent-only habits Hidden from child, awarded directly by parent
Star counter Animated bump on every completion
Unicorn pet 5 mood states driven by daily completion percentage
Streak banner πŸ”₯ Shown whenever current streak > 0
Reward shop Redeem accumulated stars for real prizes
Sound effects Chime tones on completion (toggleable πŸ””/πŸ”•)
Browser navigation Back/forward buttons work via History API

Unicorn moods

Mood Trigger Feeling
😴 Sleepy Nothing done yet Grey, half-closed eyes
😐 Okay 1–39% of daily stars earned Neutral
😊 Happy 40–69% earned Smiling, gentle glow
✨ Magical 70–99% earned Sparkles, glowing mane
πŸŽ‰ Party 100% earned or 7-day streak + 70% Rainbow, dancing

Parent section (PIN-gated)

Feature Details
PIN gate 4-digit PIN with dot indicators β€” setup on first use
Approvals tab Review pending habits, approve with optional lucky star bonus
Direct award Grant stars for parent-observed habits (calm voice, etc.)
Dashboard Streak stats, today's snapshot, 7-day star bar chart
Configure β€” Habits Add / edit / archive habits, set emoji, points, type, time of day
Configure β€” Rewards Add / edit rewards with custom emoji or uploaded thumbnail
Configure β€” Backup Export all data to JSON / restore from JSON file
Undo today Reset today's entries if something was tapped by mistake
Change PIN Update PIN from within Configure

Unicorn level names

Stars earned (total) Level Name
Starting out 1 Baby Sparkle
Growing up 2 Sparkle
Getting powerful 3 Super Sparkle
Maximum magic 4 Rainbow Sparkle

Tech stack

Concern Choice Why
UI framework React 19 + TypeScript 5 Type-safe, component-driven
Build tool Vite 6 Instant HMR, fast production builds
Styling CSS Modules Scoped styles, no runtime cost
Local persistence localStorage UserProgress + parent PIN (simple key/value)
Structured storage IndexedDB via idb v8 Habits, daily entries, rewards β€” queryable, survives reloads
PWA vite-plugin-pwa + Workbox Service worker, offline cache, installable on any device
Navigation history.pushState + popstate Back/forward button support without a router
Sound Web Audio API Synthesised chimes β€” no audio files, works fully offline
Deployment GitHub Actions β†’ GitHub Pages Auto-deploys on every push to main

Data flow

App.tsx  ──(props + handlers)──▢  Screens / Components
            β–²
            β”‚ reads on mount, writes on every change
            β”‚
    localStorage ──── UserProgress (stars, streak, level), Parent PIN
    IndexedDB    ──── habits, daily_entries, rewards  (idb v8)

All state lives in App.tsx and flows down as props β€” no context, no global store.


Project structure

src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ HabitCard/          Tap button, repeatable dots, waiting badge
β”‚   β”œβ”€β”€ UnicornPet/         Mood-reactive image + CSS animations
β”‚   β”œβ”€β”€ StarBurst/          Celebration particle overlay on completion
β”‚   β”œβ”€β”€ WaterTracker/       5-dot water progress indicator
β”‚   └── PinGate/            4-digit PIN setup & verify (dot display + numpad)
β”œβ”€β”€ screens/
β”‚   β”œβ”€β”€ HomeScreen/         Child-facing habit checklist
β”‚   β”œβ”€β”€ ParentApprovalScreen/  Approve pending, award direct
β”‚   β”œβ”€β”€ ParentDashboard/    Streak calendar, weekly bar chart
β”‚   β”œβ”€β”€ ConfigureScreen/    Habits + rewards CRUD, backup/restore
β”‚   └── RewardsScreen/      Shop grid, redeem flow
β”œβ”€β”€ storage/
β”‚   β”œβ”€β”€ localStorage.ts     lsGet / lsSet typed wrappers
β”‚   β”œβ”€β”€ indexedDB.ts        getDB singleton + helpers (getEntriesForDate, getStarsPerDay, …)
β”‚   └── backup.ts           exportBackup() / importBackup()
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ habits.ts           DEFAULT_HABITS (seeded on first run)
β”‚   └── rewards.ts          DEFAULT_REWARDS (seeded on first run)
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ unicornMood.ts      computeMood(stars, max, streak) β†’ UnicornMood
β”‚   └── sounds.ts           Web Audio chime synthesiser
β”œβ”€β”€ styles/
β”‚   β”œβ”€β”€ global.css          CSS custom properties (colours, fonts, radii, shadows)
β”‚   └── animations.css      Keyframe animations (slide-up, sparkle-bump, dance, …)
└── types/index.ts          Shared types: Habit, DailyEntry, UserProgress, …

Getting started

git clone https://github.com/pradeepverse/sparkle-app.git
cd sparkle-app
npm install
npm run dev        # http://localhost:5173/sparkle-app/
npm run build      # TypeScript check + production build
npx tsc --noEmit   # type-check only

Manual UI testing is done with the Playwright MCP server configured in .mcp.json (headless Chromium, 390Γ—844 β€” iPhone viewport).


Deployment

Every push to main triggers .github/workflows/deploy.yml:

  1. npm ci β†’ npm run build (tsc --noEmit && vite build)
  2. Upload dist/ as a GitHub Pages artifact
  3. Deploy to https://pradeepverse.github.io/sparkle-app/

Note: The base: '/sparkle-app/' in vite.config.ts must match the GitHub repository name exactly.


Install as an app (PWA)

Platform Steps
Android (Chrome) Menu β†’ Add to Home Screen
iOS (Safari) Share button β†’ Add to Home Screen
Desktop (Chrome/Edge) Click the install icon in the address bar

Once installed, the app works fully offline β€” all assets are pre-cached by the service worker.


Data & privacy

Everything lives entirely on the device β€” no server, no account, no analytics, no tracking.

Use Parent β†’ Configure β†’ Backup to:

  • Export a JSON snapshot (download to your device)
  • Import to restore on a new device or after clearing browser storage

Roadmap

  • Phase 4 β€” animated unicorn evolution cutscene on level-up
  • Phase 5 β€” sibling profiles (multiple children, one device)
  • Phase 6 β€” weekly recap notification via Web Push

Built with love for one very sparkly little girl ✨

About

πŸ¦„ Habit gamification app for kids. Earn stars by completing daily habits and feed your magical unicorn pet. PWA, offline-ready, no server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors