Skip to content

feat: add interactive web UI for codebase visualization#48

Merged
harshkedia177 merged 16 commits intomainfrom
harsh/feat/web-ui
Mar 4, 2026
Merged

feat: add interactive web UI for codebase visualization#48
harshkedia177 merged 16 commits intomainfrom
harsh/feat/web-ui

Conversation

@harshkedia177
Copy link
Copy Markdown
Owner

Linked Issue

Issue: N/A — this is a major feature addition developed by the maintainer.

What Changed and Why

Axon previously only exposed its code intelligence through CLI and MCP tools. This PR adds a full interactive web UI (axon web) that lets developers visually explore their codebase's knowledge graph — browse files, inspect symbols, trace call flows, view community clusters, analyze coupling, and run Cypher queries — all through an interactive browser-based dashboard.

The backend is a FastAPI app serving REST endpoints over the existing Axon storage layer, and the frontend is a React + TypeScript app with force-directed graph visualization (Sigma.js), analysis dashboards, and a Cypher console.

What's Included

  • Backend: FastAPI app with routes for graph, search, files, analysis, cypher, diff, processes, and SSE events
  • Frontend: React + TypeScript + Vite with Sigma.js graph canvas, explorer sidebar, detail panels, analysis views (coupling heatmap, dead code, inheritance tree, health score), Cypher console, command palette, and minimap
  • CLI: New axon web command to launch the dashboard
  • Core improvements: Cypher guard for safe query execution, enhanced import resolution, improved embedder, refined dead code detection
  • Tests: 883-line backend route test suite + updated existing tests

How to Test

# Run backend tests
pytest tests/web/test_routes.py -v

# Run full test suite
pytest

# Launch the web UI manually
axon index .
axon web
# Open http://localhost:8421

Checklist

  • This PR is linked to a maintainer-approved issue (or is a trivial typo/link fix under 5 lines)
  • I have read CONTRIBUTING.md
  • One logical change only — no bundled/unrelated work
  • Tests added or updated for this change
  • pytest passes locally
  • ruff check src/ tests/ passes
  • I can explain every line of this PR when asked
  • No generated project-config files (CLAUDE.md, .cursorrules, etc.)

- FastAPI app factory with 16 API routes (graph, search, analysis, files, cypher, diff, processes, SSE events)
- axon ui CLI command (--port, --watch, --no-open, --dev flags)
- Vite + React 18 + TypeScript + Tailwind CSS v4 frontend scaffold
- Terminal-inspired design system with all color tokens from spec
- Typed API client (ky-based), Zustand stores (graph, view, data)
- App shell: Header, StatusBar, three-panel resizable PanelLayout
- Sigma.js v3 + Graphology graph canvas with ForceAtlas2 web worker layout
- Node rendering by type (color) and degree (size), edge dimming on select
- Explorer sidebar: file tree, node/edge filters, communities list, dead code list
- Right panel: context tab (callers/callees/types), impact tab (depth-grouped blast radius),
  code tab (Shiki syntax highlighting), processes tab (flow traces)
- All components follow terminal aesthetic with CSS custom properties
…ions, and SSE live reload

Wave 4+5 of the web UI:
- Analysis view with health score, dead code report, coupling heatmap, inheritance tree, branch diff
- Cypher console with query editor, results table, preset queries, and history
- Command palette (Cmd+K) with search and command modes via cmdk
- Keyboard shortcuts for all major actions
- Impact ripple and flow trace graph animations
- Community hull computation for graph overlays
- SSE hook for live reload on reindex
- Wire GraphCanvas and DetailPanel into App.tsx
…ckend tests

Wave 6 — final polish:
- Minimap (160x120px canvas) with viewport navigation and drag-to-pan
- Layout mode switching: force (FA2), tree (hierarchical), radial (concentric)
- Animated position transitions (500ms ease-out) between layout modes
- LoadingSpinner, EmptyState, ErrorBoundary shared components
- Loading/empty/error states added to GraphCanvas, DetailPanel, FileTree,
  ContextTab, ImpactTab, CodeTab, AnalysisView, CypherView
- Build pipeline: npm run build produces dist/, static file serving fixed
- Dev mode: --dev flag skips static mount for Vite HMR proxy
- pyproject.toml source-exclude prevents node_modules in wheel
- 48 backend API route tests (all passing)
- Add @sigma/node-border for bordered node rendering with muted color palette
- Tune ForceAtlas2 for better spacing (gravity 0.3, scalingRatio 8, strongGravity)
- Reduce label density and raise size threshold to prevent text overlap/flicker
- Hide unconnected edges on selection, dim unrelated nodes
- Fix API routing: add /api prefix to all router includes in app.py
- Extract shared TypeBadge component, consolidate N+1 community queries
- Clean up unused state and simplify component logic across dashboard
- Introduced `_detect_source_roots` function to identify source root directories in a `src/` layout.
- Updated `resolve_import_path` to utilize detected source roots for resolving absolute imports.
- Enhanced `_resolve_python_absolute` to attempt resolution with source root prefixes.
- Added unit tests for new import resolution features, ensuring correct handling of absolute imports in `src/` layouts.
…unctionality

- Added `cypher_guard.py` with regex for detecting write keywords in Cypher queries to enforce read-only execution.
- Updated `embedder.py` to include a new `embed_query` function for embedding query strings.
- Refactored `kuzu_backend.py` to use the new `escape_cypher` function for escaping Cypher literals.
- Enhanced `resources.py` to return raw dead-code rows and updated related functions for consistency.
- Modified `tools.py` to import `escape_cypher` from `kuzu_backend`.
- Updated various components and routes to utilize the new safety and embedding features, improving overall query handling and data retrieval.
- Replaced `uv_build` with `hatchling` for building the project.
- Updated `pyproject.toml` to reflect new build configurations and package exclusions.
- Enhanced `README.md` with detailed instructions for the new interactive web UI, including usage examples and API endpoints.
- Added frontend build steps to the GitHub Actions workflow for automated deployment.
- Updated GitHub Actions workflow to trigger on additional pull request events: synchronize and reopened.
- Modified diff.py to ensure worktree path is converted to string for cleanup.
- Added comments in kuzu_backend.py to clarify the use of escape_cypher for query safety.
- Refactored tools.py to utilize sanitize_cypher for comment stripping in Cypher queries.
- Updated frontend components to integrate DOMPurify for sanitizing HTML content.
- Enhanced useSearch hook to support aborting ongoing requests and improved error handling.
- Adjusted tsconfig.json to enforce stricter unused variable checks.
- Added tests for write keyword handling in Cypher queries and modified node serialization in diff endpoint.
- Updated total_symbols and dead_count calculations to explicitly cast results to integers, improving accuracy in health analysis metrics.
- Removed pagination parameters from the get_graph function to return all nodes and edges.
- Updated the serialization logic to directly return the total count of nodes instead of using offset and limit.
- Simplified the initialization of KuzuBackend to always set read_only to true.
- Enhanced CSS for graph node colors, transitioning to a hue-separated palette for better visual distinction.
- Modified edge type configuration to include color and arrow properties, improving edge visibility and interaction.
- Implemented custom rendering for node labels and hover effects to enhance clarity and user experience.
- Adjusted graph layout settings for smoother transitions and refined node size calculations for better visual hierarchy.
- Updated graph store to manage edge visibility dynamically based on node types, ensuring edges are only shown when relevant nodes are visible.
@harshkedia177 harshkedia177 merged commit 0216afd into main Mar 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant