-
Vision
A single-page React application that lets any learner type in a topic (e.g. “React + TypeScript”, “Quantum Computing”, “IELTS Band 8”) and instantly receive a week-by-week, resource-rich, milestone-driven learning path. The path is generated on-the-fly by Google Gemini through a secure API call and is fully editable, shareable, and trackable.
-
Tech Stack
• Front-end: React 18 + Vite (fast HMR, tree-shaking)
• Routing: React-Router v6
• State: Zustand (lightweight) or Redux Toolkit
• Styling: TailwindCSS + HeadlessUI (dark/light mode)
• Icons: Lucide-React
• Charts: Recharts (progress bars, streaks)
• AI: Google Gemini REST API (via @google/generative-ai SDK)
• Storage: localStorage (offline cache) + optional Firebase/Firestore for cloud sync
• Auth (optional): Firebase Auth or Clerk for saving multiple plans
• CI/CD: GitHub Actions → Vercel/Netlify
-
Core User Flow
-
Landing page with a single input: “What do you want to learn?”
-
Optional filters:
• Current skill level (Beginner / Intermediate / Advanced)
• Weekly hours available
• Preferred content types (video, book, project, article)
• Deadline / exam date
-
“Generate Path” button shows a skeleton loader while the Gemini prompt is streamed.
-
Result screen:
• A vertical timeline of milestones (Week 1, Week 2, …)
• Each milestone contains: objectives, curated links, micro-projects, estimated hours, auto-check quizzes.
• Drag-and-drop to reorder or delete weeks.
• “Regenerate this week” button re-prompts Gemini with context.
-
Progress tracking: checkboxes update a progress ring; streak counter; export to PDF/ICS.
-
Share: generates a short URL (e.g. pathforge.app/s/a8b3c) that hydrates the same plan for other users.
-
Gemini Integration Details
• Prompt template (system + user) stored in src/lib/prompts/learningPath.ts
• Streaming: use fetch-event-source or the Gemini streaming endpoint to render tokens as they arrive.
• Token budget: ~4 k out, 2 k in; stop sequence “###” to delimit JSON.
• Response schema (JSON):
{
title,
weeks:[{weekNumber,title,description,hours,resources:[{type,title,url,duration}],quiz:[{question,options,answer}]}]
}
• Error handling: if Gemini returns malformed JSON, show “Retry” with a “strict mode” toggle that adds extra instructions.
-
Project Structure (Vite root)
src/
├─ api/gemini.ts // low-level fetch wrapper
├─ components/
│ ├─ PathTimeline.tsx
│ ├─ MilestoneCard.tsx
│ ├─ ProgressRing.tsx
│ └─ ShareModal.tsx
├─ hooks/
│ ├─ useGeneratePath.ts // React-Query mutation
│ └─ useLocalStorage.ts
├─ pages/
│ ├─ Home.tsx
│ ├─ Plan.tsx
│ └─ NotFound.tsx
├─ store/pathStore.ts // Zustand slice
├─ styles/index.css // Tailwind entry
└─ main.tsx
-
Key Components
• PathTimeline – virtualised list (react-window) for long plans.
• MilestoneCard – collapsible accordion; “Mark as done” updates global state.
• PromptEditor – advanced users can tweak the raw prompt before sending.
• ExportPanel – PDF via jspdf + html2canvas; iCalendar file for deadlines.
-
Security & Environment
.env
VITE_GEMINI_API_KEY=************************
VITE_FIREBASE_API_KEY=… (optional)
• API key is injected at build time; never exposed in serverless functions.
• Rate-limiting: 5 generations per IP per hour (Cloudflare KV).
-
Performance Optimisations
• Code-split pages with React.lazy.
• Debounce input fields (500 ms).
• Memoise heavy renders with React.memo & useMemo.
• Use Vite’s dynamic import to load Recharts only on the dashboard route.
-
Testing
• Unit: Vitest + React-Testing-Library for hooks & components.
• E2E: Playwright – generate a plan, mark first week complete, assert progress bar.
• Mock Gemini with MSW (Mock Service Worker) for offline dev.
-
Roadmap / Stretch Goals
• “Learning Buddy” chatbot sidebar (Gemini chat session) to answer questions about the current milestone.
• Spaced-repetition flashcards auto-generated from quiz questions.
• Community templates: browse & fork top-rated paths.
• Browser extension that injects the next recommended resource when you open YouTube / Medium.
• PWA: offline viewing of saved plans, push reminders.
-
Getting Started (README excerpt)
git clone …
cp .env.example .env
pnpm install
pnpm dev
→ http://localhost:5173
-
One-Sentence Pitch
“PathForge turns any learning goal into a crystal-clear, AI-crafted roadmap in under 10 seconds.”