Skip to content

feat: Add AI-Powered Visual Mind Map Generator with reactflow and supabase#72

Open
diyamajee-spec wants to merge 1 commit into
prabhakarshukla:mainfrom
diyamajee-spec:feature/visual-mind-map
Open

feat: Add AI-Powered Visual Mind Map Generator with reactflow and supabase#72
diyamajee-spec wants to merge 1 commit into
prabhakarshukla:mainfrom
diyamajee-spec:feature/visual-mind-map

Conversation

@diyamajee-spec

@diyamajee-spec diyamajee-spec commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

💡 Context & Problem Statement

EduFlow-AI excels at generating structured text markdown for course content, summaries, and study planners. However, visual learners often struggle to grasp complex relationships between subtopics when reading linear text. There was no native way for students to dynamically visualize how core concepts connect to their underlying principles.

🚀 Proposed Solution

This PR introduces an AI-Powered Visual Mind Map Generator feature. Instead of outputting standard markdown, a custom AI agent generates a hierarchical representation of a study topic, which the frontend renders into an interactive, zoomable, and draggable concept map.

Key Features:

  • Interactive Canvas: Draggable, pannable, and zoomable node layout built on reactflow.
  • Auto-Layout Algorithm: A custom horizontal-centering tree spacing algorithm automatically positions nodes on generation, preventing overlapping nodes.
  • Concept Inspector Side Panel: Clicking on any node displays a side panel detailing the AI-generated brief explanation.
  • Deep-Dive Navigation: An interactive "Deep-Dive" action button on the sidebar allows users to trigger a fresh mind map based on any subtopic node they are inspecting.
  • Supabase Integration: Saves and loads custom mind maps, enabling students to revise their maps later.

🛠 Technical Implementation Details

1. Database Layer

  • Added supabase/migrations/20260613_create_mind_maps.sql to define the mind_maps table structure (storing nodes and edges JSONB structures) and configured Row Level Security (RLS) policies so authenticated users only access their own maps.

2. AI Backend Agent & Router

  • Created lib/ai/agents/mindmap-agent.ts with a specialized system prompt enforcing a strict JSON output structure representing the hierarchy (id, label, parentId, description).
  • Updated lib/ai/agents/shared.ts and lib/ai/agents/agent-router.ts to register the new mindmap agent type.

3. API Layer

  • Created app/api/mindmap-generator/route.ts to trigger the mindmap agent and parse its JSON output, including utility logic to clean markdown format indicators.

4. Frontend Interface

  • Integrated reactflow packages in package.json.
  • Created app/dashboard/mind-maps/page.tsx implementing custom Tailind-styled glassmorphic node components (CustomNode), map controls, minimap, saved lists explorer, and layout styling matching the EduFlow-AI light/dark mode system.
  • Added a "Mind Maps" sidebar link in app/dashboard/layout.tsx.

5. Build Config Fallbacks

  • Modified lib/supabase-config.ts to prevent page prerendering from failing if Supabase env variables are not present during Next.js static asset compilation.

🧪 Verification & Testing

1. Production Build Successful

Ran npm run build to confirm compilation:

  • Result: Success. Compiled all routes, type-checked all declarations, and successfully built /dashboard/mind-maps.

2. Interactive Verification (Browser Subagent)

  • Navigated to /dashboard/mind-maps inside the browser sandbox.
  • Verified that the page handles authentication states correctly, redirecting unauthenticated users to /auth/login?next=/dashboard/mind-maps without throwing any JavaScript errors or warnings.

Closes #52

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

@diyamajee-spec is attempting to deploy a commit to the prabhakarshukla's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
eduflow-ai Ready Ready Preview, Comment Jun 13, 2026 8:13am

@prabhakarshukla

Copy link
Copy Markdown
Owner

Thanks for the contribution. @diyamajee-spec

I tested the Mind Maps feature locally. Mind map generation, node inspection, save/load functionality, and React Flow rendering are working correctly.
However, I could not verify the Deep-Dive functionality described in the PR. The "Deep-Dive Subtopic" button is visible in the Concept Inspector panel, but clicking it does not trigger any observable behavior (no new map generation, no API request, and no UI update).
Could you please verify whether this feature is fully implemented and provide reproduction steps or a fix?
image

@prabhakarshukla

Copy link
Copy Markdown
Owner

@diyamajee-spec please update the PR ASAP

@diyamajee-spec

Copy link
Copy Markdown
Contributor Author

I will do it by tonight

@prabhakarshukla

Copy link
Copy Markdown
Owner

I will do it by tonight

Done ??

@anay-208

Copy link
Copy Markdown

@diyamajee-spec hi, I'm the mentor for this project. If you need any help, please lmk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: AI-Powered Visual Mind Map Generator for Course Content using React Flow

3 participants