Kemma - Visual Mind Mapping Platform β
Kemma is an advanced, interactive mind mapping SaaS application designed for creative professionals and teams. It combines intuitive visual collaboration with AI-powered ideation to help users brainstorm, organize thoughts, and innovate faster.
π― Overview β
Kemma offers a modern, web-based mind mapping experience with:
- Infinite Canvas: Pan and zoom to explore limitless workspace
- AI-Assisted Brainstorming: Generate related ideas with the "Spark" feature
- Real-time Interaction: Drag, edit, and organize nodes seamlessly
- Auto-save: Changes persist automatically as you work
- Keyboard Shortcuts: Efficient node creation and navigation
- Context Menus: Quick access to common operations
π οΈ Technology Stack β
Core Framework β
- React 19.2 - Modern UI framework with hooks and functional components
- TypeScript 5.9 - Type-safe development with full IDE support
- Vite 7.2 - Lightning-fast build tool and dev server with HMR (Hot Module Replacement)
Routing & Navigation β
- React Router DOM 7.9 - Client-side routing for SPA navigation
UI & Styling β
- Tailwind CSS 4.1 - Utility-first CSS framework for rapid styling
- @tailwindcss/vite - Native Tailwind integration with Vite
- shadcn/ui - High-quality, accessible React components built on Radix UI
@radix-ui/react-avatar- User profile avatars@radix-ui/react-context-menu- Right-click context menus@radix-ui/react-dropdown-menu- Dropdown interactions@radix-ui/react-slot- Composition utilities
- Lucide React - Beautiful, consistent icon library
- class-variance-authority - Type-safe component variants
- clsx & tailwind-merge - Conditional class composition
Design System β
- Inter Font - Modern, readable typography
- Glassmorphism - Backdrop blur effects for premium aesthetics
- Navy & Teal Palette - Brand colors (
kemma-navy,kemma-teal)
Development Tools β
- ESLint 9 - Code quality and consistency
- TypeScript ESLint 8 - TypeScript-specific linting rules
π§ Key Techniques & Architecture β
Mind Map Studio Implementation (Studio.tsx) β
The heart of Kemma is the Mindmap Studio, a sophisticated canvas-based editor. Here's how it works:
1. Data Model - Tree Structure β
Nodes: Each node represents an idea/topic with properties:
id: Unique identifier (randomly generated)parentId: Reference to parent node (creates hierarchy)text: Display contentx, y: Absolute position on canvascolor: Visual identifier for branch grouping
Dynamic Array Growth: Nodes are stored in React state as a dynamic array that grows automatically - no size limits beyond available memory.
2. Coordinate System & Transforms β
- Canvas Panning: Instead of moving individual nodes, a single container uses CSS
transform: translate()for performance - Zoom Implementation:
transform: scale()centered on mouse cursor using mathematical compensation:newOffset = (mousePos / newZoom) - (mousePos / oldZoom) + oldOffset - Dual-Mode Interaction:
isDragging: Move individual nodesisPanning: Move entire viewport- Flags prevent conflicting mouse event handlers
3. Node Positioning Algorithm β
Hierarchical Layout:
- Children positioned 200px to the right of parent
- Vertical spacing of 80px between siblings
- Offset calculated as:
(siblingCount * 80) - 40
Color Inheritance:
- Direct children of root get unique branch colors from a 7-color palette
- All descendants inherit parent color for visual grouping
4. Rendering Architecture β
Layer System:
- SVG layer (z-index behind): Connection lines using cubic BΓ©zier curves
- HTML layer (z-index front): Interactive node elements
Connection Lines: Drawn with SVG paths using control points:
cp1 = { x: start.x + (deltaX * 0.5), y: start.y } cp2 = { x: end.x - (deltaX * 0.5), y: end.y }Creates smooth "S" curves that exit/enter nodes horizontally
5. Undo/Redo System β
History Stack Pattern:
history: Array of past node states (2D array:any[][])future: States undone, used for redo
State Capture Points:
- Before drag operations (
dragStartNodes.current) - Before text editing (
textFocusState.current) - On structural changes (add/delete)
- Before drag operations (
6. Event Handling & UX Patterns β
Click-to-Edit Pattern:
// First click: Select
// Second click on same node: Enter edit mode
if (!hasDragged && clickTargetWasSelected) {
setEditingNodeId(nodeId);
}Keyboard Shortcuts:
Tab: Add child node (even while editing)Enter: Add sibling node (blur text first)Delete/Backspace: Remove node and descendantsCmd/Ctrl + Z: UndoCmd/Ctrl + Shift + ZorCmd/Ctrl + Y: Redo
Context Menu: Right-click reveals options for adding children or deleting nodes
7. Auto-Save Strategy β
- Debounced Save: Uses
useEffectwith[isDragging]dependency - Only saves when
isDraggingtransitions fromtruetofalse - Prevents excessive API calls during rapid mouse movements
- Text changes save on blur event
8. AI "Spark" Feature β
- Purpose: Generate AI-assisted ideas as child nodes
- Layout Intelligence:
- Calculates existing children count
- Positions new AI nodes below existing children to avoid overlap
- Applies same coloring rules as manual nodes
- Error Handling:
try/catch/finallyensures loading state resets even on failure
9. Responsive Node Sizing β
- Auto-expand:
- Max width: 40 characters (
40ch) - Text wraps vertically beyond max width
- Uses CSS Grid "ghost element" technique for auto-sizing
- Max width: 40 characters (
- Long Text Handling:
- Truncates to 200 chars when unselected
- Shows "(more)" indicator
- Full text visible when selected
10. Touch & Mouse Support β
- All interaction handlers check for both:typescript
const clientX = e.clientX || e.touches?.[0]?.clientX; - Supports
onMouseDown,onTouchStart, etc.
π Project Structure β
kemma/ # Monorepo root
βββ apps/
β βββ web-client/ # React + TypeScript + Vite
β β βββ public/
β β β βββ logo.png # App logo & favicon
β β βββ src/
β β β βββ components/
β β β β βββ landing/ # Landing page components
β β β β βββ studio/
β β β β β βββ Studio.tsx # π― Main mindmap canvas
β β β β βββ ui/ # shadcn/ui components
β β β βββ pages/
β β β β βββ LandingPage.tsx # Marketing homepage
β β β β βββ UserHome.tsx # Dashboard with mindmap list
β β β βββ lib/
β β β β βββ utils.ts # Utility functions
β β β βββ App.tsx # Route definitions
β β β βββ main.tsx # React entry point
β β β βββ index.css # Global styles
β β βββ index.html # HTML shell with SEO meta tags
β β βββ package.json
β β βββ vite.config.ts
β β βββ tsconfig.json
β β
β βββ server/ # FastAPI + Python backend
β βββ kemma/ # Python package
β β βββ api/ # API routes
β β βββ db/ # Database models & config
β β βββ services/ # Business logic
β β βββ main.py # FastAPI application
β βββ tests/ # pytest test suite
β βββ pyproject.toml # Python dependencies & config
β βββ uv.lock # Locked dependencies
β
βββ package.json # Root workspace config
βββ WORKSPACE.md # Workspace documentation
βββ README.md # This fileπ Getting Started β
Prerequisites β
- Node.js 20+ and npm (for web-client)
- Python 3.13+ (for server)
- uv - Fast Python package manager:
pip install uv
Installation β
# Clone the repository
git clone <repository-url>
cd kemma
# Install dependencies (Frontend & Backend)
npm install
# Install Python backend dependencies
cd apps/server && uv syncDevelopment β
Run Everything (Frontend + Backend):
npm run dev- Starts both servers in parallel using Turbo.
- Frontend:
http://localhost:5173 - Backend:
http://localhost:8000 - API docs at
http://localhost:8000/docs
Run Individually:
turbo dev --filter=web-client
turbo dev --filter=serverBuild for Production β
# Build web-client
npm run build
# Preview production build
cd apps/web-client && npm run previewCode Quality β
Linting:
npm run lint # Lint all packagesFormatting:
npm run format # Format all codeType Checking:
npm run typecheck # TypeScript + PyrightTesting:
npm run test # Run all testsFull Validation (CI):
npm run check # typecheck + lint + testπ‘ See WORKSPACE.md for complete command reference.
πΊοΈ Application Routes β
| Route | Component | Description |
|---|---|---|
/ | LandingPage | Marketing page with features, CTA |
/home | UserHome | User dashboard with mindmap gallery |
/mindmap | Studio | Interactive mindmap editor |
π¨ Design Philosophy β
Visual Hierarchy β
- Root Node: Large, bold, centered - dark gray (#333)
- Branch Nodes: Vibrant colors (blue, purple, pink, orange, etc.)
- Descendant Nodes: Inherit parent color
State Feedback β
- Selected: Blue ring, scale up 5%, elevated shadow
- Editing: Subtle blue border, no shadow (clean focus)
- Unselected: Minimal border, no shadow (symmetrical appearance)
- Hover: Slight shadow on unselected nodes
Glassmorphism & Modern UI β
- Header uses
backdrop-blur-smfor frosted glass effect - Floating instruction panel with white/80 opacity
- Rounded corners (
rounded-2xl,rounded-full) - Smooth transitions (
transition-all duration-200)
π Key Features Explained β
Infinite Canvas β
The canvas uses a viewport transformation pattern:
- Background grid provides spatial reference
- Pan by dragging empty space
- Zoom with mouse wheel (centered on cursor)
- Zoom controls show current scale percentage
Recursive Node Deletion β
Deleting a node removes its entire subtree:
// Recursively find all descendants
const getDescendants = (parentId, allNodes) => {
const children = allNodes.filter(n => n.parentId === parentId);
return children.flatMap(child =>
[child.id, ...getDescendants(child.id, allNodes)]
);
};Drag Offset Calculation β
Prevents nodes from "snapping" to cursor on drag:
dragOffset = {
x: (mouseX / zoom) - node.x - viewOffset.x,
y: (mouseY / zoom) - node.y - viewOffset.y
}Maintains relative click position within node bounds.
π€ Future Enhancements β
- Real Firebase Integration: Replace mock
saveMap()with Firestore persistence - Gemini AI Integration: Connect "Spark" feature to Google's Gemini API
- Collaborative Editing: WebSocket-based real-time multi-user support
- Templates: Pre-built mindmap structures (project planning, brainstorming, etc.)
- Export: Generate images (PNG/SVG) or structured data (JSON/XML)
- Custom Themes: User-selectable color palettes and node styles
π License β
This project is private and proprietary.
π₯ Contributing β
This is a private project. For questions or collaboration inquiries, please contact the repository owner.
Built with β€οΈ using React, TypeScript, and Vite