Project Name: LocalRAG-Explorer
Type: Desktop Application (Electron)
Core Feature Summary: A local code base RAG (Retrieval-Augmented Generation) exploration tool that enables natural language queries over codebases using local Ollama LLM and embeddings.
Target Users: Developers who want to explore, understand, and navigate their codebases using natural language, with full privacy (all processing stays local).
Window Model:
- Single main window application
- Modal dialogs for settings and confirmations
- Minimum size: 1024x768
- Default size: 1400x900
Major Layout Areas:
┌─────────────────────────────────────────────────────────────┐
│ Header (Title Bar + Controls) │
├──────────────────┬──────────────────────────────────────────┤
│ │ │
│ Sidebar │ Main Content Area │
│ (250px) │ │
│ │ ┌────────────────────────────────────┐ │
│ - File Tree │ │ Query Input + Results │ │
│ - Index Status │ │ │ │
│ - Settings │ │ │ │
│ │ └────────────────────────────────────┘ │
│ │ │
│ │ ┌────────────────────────────────────┐ │
│ │ │ Code Viewer / Graph View │ │
│ │ │ │ │
│ │ └────────────────────────────────────┘ │
├──────────────────┴──────────────────────────────────────────┤
│ Status Bar (Indexing progress, LLM status, etc.) │
└─────────────────────────────────────────────────────────────┘
Color Palette:
- Primary Background:
#1e1e2e(Dark navy) - Secondary Background:
#282a36(Sidebar) - Accent Color:
#89b4fa(Blue highlights) - Success:
#a6e3a1(Green) - Warning:
#f9e2af(Yellow) - Error:
#f38ba8(Red/Pink) - Text Primary:
#cdd6f4(Light gray) - Text Secondary:
#a6adc8(Muted gray) - Border:
#45475a(Subtle border)
Typography:
- UI Font: system-ui, -apple-system, sans-serif
- Code Font: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace
- Heading Size: 18px (H1), 16px (H2), 14px (H3)
- Body Size: 14px
- Code Size: 13px
Spacing System:
- Base unit: 4px
- Small: 8px
- Medium: 16px
- Large: 24px
- XLarge: 32px
Visual Effects:
- Border radius: 8px (cards), 4px (buttons/inputs)
- Box shadow:
0 4px 12px rgba(0, 0, 0, 0.3)(elevated elements) - Transitions: 150ms ease-out
Sidebar Components:
- Project folder selector button
- File tree with expand/collapse
- Index status indicator (Ready/Indexing/Error)
- Index button with progress
- Settings toggle
Main Content Components:
- Query input field with search icon
- Query history dropdown
- Results list (scrollable)
- Code viewer panel with syntax highlighting
- Dependency graph toggle (canvas/SVG)
Component States:
- Default, Hover (+5% brightness), Active (accent color), Disabled (50% opacity)
- Loading states with spinner animations
- Empty states with helpful messages
F1: Project Folder Selection
- Open native folder picker dialog
- Display selected path in sidebar
- Remember last opened project
F2: Code Indexing
- Scan selected folder recursively
- Filter by supported extensions: .js, .ts, .jsx, .tsx, .py, .java, .go, .rs, .c, .cpp, .h, .cs, .rb, .php, .vue, .svelte
- Skip: node_modules, .git, dist, build, pycache, .venv, vendor
- Generate embeddings using local embedding model (default: nomic-embed-text)
- Store embeddings in local SQLite database
- Show progress during indexing
F3: Natural Language Query
- Input field for natural language queries
- Semantic search using embeddings
- Return top-k most relevant code chunks (default k=5)
- Display relevance scores
F4: Code Summarization
- Use Ollama LLM to summarize code chunks
- Provide concise explanations
- Highlight key functions and logic
F5: Dependency Graph Generation
- Parse import/require statements
- Generate directed graph of dependencies
- Visualize using D3.js force-directed graph
- Interactive: click to navigate
F6: Code Viewer
- Display code with syntax highlighting (highlight.js)
- Show file path and line numbers
- Copy code button
Flow 1: First Launch
- App opens with empty state
- User clicks "Select Project Folder"
- Native folder picker opens
- User selects folder
- Indexing starts automatically
- Status bar shows progress
Flow 2: Query Codebase
- User types question in query input
- Press Enter or click Search
- Loading spinner appears
- Results display with code snippets
- Click result to view full code
Flow 3: View Dependency Graph
- Click "Graph" toggle in main area
- Force-directed graph renders
- Hover nodes for file info
- Click node to open file
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ UI Layer │────▶│ IPC Bridge │────▶│ Main Process │
│ (Renderer) │◀────│ │◀────│ (Node.js) │
└──────────────┘ └──────────────┘ └──────────────┘
│
┌────────────────────┼────────────────────┐
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Indexer │ │ Query │ │ Graph │
│ (embed) │ │ Engine │ │ Generator │
└─────────────┘ └─────────────┘ └─────────────┘
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ SQLite │ │ Ollama │ │ D3.js │
│ (vector) │ │ (LLM) │ │ (render) │
└─────────────┘ └─────────────┘ └─────────────┘
Key Modules:
-
IndexingService
scanDirectory(path): Recursively scan fileschunkCode(content, fileType): Split into chunksgenerateEmbeddings(chunks): Call embedding modelstoreEmbeddings(chunks, vectors): Save to SQLite
-
QueryEngine
query(question, topK): Search embeddingsrerank(results): Sort by relevancesummarize(code, question): Use LLM for summary
-
DependencyGraph
parseImports(filePath): Extract dependenciesbuildGraph(files): Create graph datagetGraphData(): Return D3-compatible data
-
OllamaClient
checkConnection(): Verify Ollama runninggetEmbedding(text): Get embedding vectorgenerate(prompt): Get LLM response
-
DatabaseService
init(): Create tablesinsertChunks(chunks): Store code chunkssearch(query, topK): Vector similarity searchclear(): Clear index
- No Ollama installed: Show setup instructions
- Ollama not running: Prompt to start service
- Empty project folder: Show warning
- No index exists: Prompt to index first
- Large codebase: Paginate indexing, show progress
- Unsupported file types: Skip silently
- Network timeout: Retry with exponential backoff
- Invalid query: Show helpful error message
- Framework: Electron 28+
- Frontend: Vanilla JS + HTML + CSS
- Database: better-sqlite3 (SQLite)
- Embedding: Ollama API (nomic-embed-text)
- LLM: Ollama API (llama3.2, codellama, or mistral)
- Code Highlighting: highlight.js
- Graph: D3.js
- IPC: Electron IPC
- Application launches without errors
- User can select a project folder
- Indexing completes for a sample project
- Natural language queries return relevant results
- Code viewer displays syntax-highlighted code
- Dependency graph renders correctly
- Ollama connection works (embedding + LLM)
- Settings persist between sessions
- Empty State: Clean UI with "Select Project" prompt
- Indexing: Progress bar visible, status shows "Indexing..."
- Ready State: Green indicator, file tree populated
- Query Results: Cards with code snippets and scores
- Graph View: Interactive nodes with hover tooltips
Default Settings:
{
"ollamaHost": "http://localhost:11434",
"embeddingModel": "nomic-embed-text",
"llmModel": "llama3.2",
"topK": 5,
"chunkSize": 1000,
"chunkOverlap": 200
}Settings UI:
- Ollama URL input
- Model selection dropdowns
- Top-K slider (1-20)
- Theme toggle (dark only for MVP)