report-leptos
Leptos SSR renderer for generating static HTML reports from code analysis data.
Overview
report-leptos is a standalone library that generates beautiful, interactive HTML reports using Leptos server-side rendering. Originally built for loctree codebase analysis, it can be used independently for any static report generation needs.
Key Features
- Zero JavaScript Runtime - Pure SSR, no hydration needed
- Component-Based Architecture - Modular, reusable UI components
- Interactive Graph Visualization - Cytoscape.js integration for dependency graphs
- Responsive Design - Works on desktop and mobile
- Dark Mode Ready - Built-in theme support
- Type-Safe - Full Rust type safety from data to HTML
Installation
Add to your Cargo.toml:
[]
= "0.1"
Quick Start
use ;
Architecture
report-leptos/
├── src/
│ ├── lib.rs # Public API: render_report(), JsAssets
│ ├── types.rs # Data structures (ReportSection, GraphData, etc.)
│ ├── styles.rs # CSS constants
│ └── components/ # Leptos UI components
│ ├── mod.rs # Component exports
│ ├── document.rs # Root HTML document wrapper
│ ├── section.rs # Report section container
│ ├── tabs.rs # Tab navigation UI
│ ├── insights.rs # AI insights panel
│ ├── duplicates.rs # Duplicate exports table
│ ├── cascades.rs # Cascade dependencies list
│ ├── dynamic_imports.rs # Dynamic imports table
│ ├── commands.rs # Tauri command coverage
│ └── graph.rs # Cytoscape graph container
Components
ReportDocument
Root component that wraps the entire HTML document:
use ReportDocument;
view!
ReportSectionView
Displays a single analyzed directory with tabbed content:
use ReportSectionView;
view!
TabBar & TabContent
Reusable tab navigation:
use ;
view!
Data Types
ReportSection
Main container for analysis results:
GraphData
For interactive dependency visualization:
AiInsight
AI-generated code quality hints:
Styling
CSS is embedded in the generated HTML. To customize:
use REPORT_CSS;
// Extend or override styles
let custom_css = format!;
Graph Visualization
The library integrates with Cytoscape.js for interactive graphs. You need to provide the JS asset paths:
let js_assets = JsAssets ;
Or bundle them locally for offline use.
Integration with loctree
This library is the rendering engine for loctree HTML reports. When using loctree with --html-report:
The report is generated using this library's SSR components.
Leptos 0.8 SSR
This library uses Leptos 0.8's RenderHtml trait for server-side rendering:
use *;
use RenderHtml;
let view = view! ;
let html: String = view.to_html;
No reactive runtime or hydration is needed - pure static HTML generation.
Performance
- Fast - Leptos SSR is compiled Rust, not interpreted templates
- Small - No JavaScript framework overhead in output
- Streaming - Large reports render progressively (when using async)
Examples
See the examples/ directory:
Contributing
Contributions welcome! Please read CONTRIBUTING.md first.
License
MIT License - see LICENSE for details.
Developed with 💀 by The Loctree Team (c)2025