A comprehensive desktop application for analyzing codebases, providing quality metrics, documentation management, and architectural visualization. Built with Vite + React + TypeScript frontend and Fastify + SQLite backend, designed for future Tauri desktop packaging.
CodeViewer helps developers understand and maintain codebases by providing:
- Dashboard: Overview metrics, project health scores, and recent activity
- Wiki View: Searchable documentation with filtering and categorization
- File Explorer: Interactive tree view and table view with advanced search and bulk operations
- Flow Chart View: Visual dependency mapping and architectural diagrams
- Code Analysis: Automated quality metrics, complexity scoring, and issue detection
- MCP Integration: Future Model Context Protocol server for AI-assisted code understanding
- Bun - Ultra-fast JavaScript runtime and package manager
- Bun Workspaces - Monorepo management for frontend/backend coordination
- Vite - Fast development with hot reload and optimized builds (via bunx)
- React + TypeScript - Component-based UI with strong type safety
- Tailwind CSS - Utility-first styling for consistent design
- Lucide Icons - Clean, consistent iconography
- Fastify - High-performance web framework running on Bun
- SQLite - Lightweight, embedded database for local storage
- Simple Git - Git integration for repository analysis
- Better SQLite3 - High-performance SQLite driver
- Tauri - Desktop packaging for native performance and security
- MCP Server - Model Context Protocol for AI tool integration
src/
├── components/ # React components
│ ├── Dashboard.tsx # Project overview and metrics
│ ├── WikiView.tsx # Documentation browser
│ ├── FileExplorer.tsx # File tree and table views
│ ├── FlowChartView.tsx # Dependency visualization
│ ├── Layout.tsx # App shell and navigation
│ └── Navigation.tsx # Main navigation component
├── lib/
│ ├── api.ts # Backend API client
│ └── mockData.ts # Development mock data
├── types/
│ └── index.ts # TypeScript type definitions
└── App.tsx # Main application component
backend/
├── src/
│ ├── database/ # Database schema and migrations
│ ├── routes/ # API endpoint handlers
│ ├── services/ # Business logic and analysis
│ └── utils/ # Helper functions
└── package.json # Backend dependencies
- projects - Repository metadata and scan results
- files - File structure and metadata
- file_analysis - Code quality metrics and issues
- git_info - Version control status and history
- Complexity Metrics: Cyclomatic complexity calculation
- Maintainability Scoring: File length, comments, line length analysis
- Test Coverage Estimation: Heuristic-based coverage scoring
- Dependency Mapping: Import and include relationship tracking
- Issue Detection: Code smells, security vulnerabilities, and style violations
- Tree View: Hierarchical file browser with expand/collapse
- Table View: Sortable columns with detailed metadata
- Directory Grouping: Organized view by directory structure
- Advanced Search: Search by name, path, content, author, language, or tags
- Bulk Operations: Analyze, download, copy paths, or delete multiple files
- Wiki System: Searchable knowledge base with categorization
- Faceted Search: Filter by type, category, tags, and status
- Document Types: Support for various documentation formats
- Metadata Management: Tags, categories, and custom properties
- Flow Charts: Interactive dependency graphs with drag-and-drop
- Node Filtering: Filter by component type (service, class, module)
- Zoom Controls: Navigate large architectural diagrams
- Connection Mapping: Visual representation of code relationships
- Bun - Install from bun.sh:
curl -fsSL https://bun.sh/install | bash - Git - For repository analysis features
# Clone and setup (one command!)
./dev.sh-
Install Bun Configuration:
# Copy Bun-optimized package.json files cp package.bun.json package.json cp backend/package.bun.json backend/package.json -
Install Dependencies:
# Install all workspace dependencies bun install cd backend && bun install
-
Initialize Database:
bun run migrate
-
Start Development (Both Frontend & Backend):
bun run dev
bun run dev- Start both frontend and backend in parallelbun run dev:frontend- Start Vite frontend only (port 5200)bun run dev:backend- Start Fastify backend only (port 7900)bun run build- Build frontend production bundlebun run build:backend- Build backend for productionbun run lint- Run ESLint code quality checksbun run migrate- Initialize/update databasebun run start- Start both production serversbun run scan- Scan a new repository using CLI promptbun run test-llm- Test LLM analysis functionality
bun run dev- Start backend with file watchingbun run start- Start production backend serverbun run migrate- Run database migrationsbun run build- Build backend bundle for production
curl -X POST http://localhost:7900/api/v1/projects/scan \
-H "Content-Type: application/json" \
-d '{
"name": "My Project",
"path": "/path/to/repository",
"description": "Project description"
}'curl http://localhost:7900/api/v1/projects/{projectId}/filescurl -X POST http://localhost:7900/api/v1/files/{fileId}/analyzeTo package as a desktop application:
-
Add Tauri:
npm install -D @tauri-apps/cli npx tauri init
-
Configure File System Access:
// tauri.conf.json { "allowlist": { "fs": { "readDir": true, "readFile": true, "scope": ["**"] } } }
For AI integration, implement Model Context Protocol:
// Future MCP server endpoints
app.get('/mcp/tools', getMCPTools);
app.post('/mcp/call', callMCPTool);
app.get('/mcp/resources', getMCPResources);The application includes built-in code quality analysis:
- Line length violations (>120 characters)
- Console.log detection in production code
- TODO/FIXME comment tracking
- Security vulnerability patterns (eval, innerHTML)
- Import/dependency analysis
- Follow the existing code style (ESLint configuration)
- Add TypeScript types for new features
- Update mock data for UI development
- Test with real repositories before committing
- Maintain database schema migrations
- Tauri Integration: Desktop packaging with native file system access
- Advanced Analysis: Integration with ESLint, TypeScript compiler API, and language servers
- Git Integration: Enhanced version control analysis and history tracking
- MCP Server: AI tool integration for automated code understanding
- Plugin System: Extensible analysis tools and custom metrics
- Team Features: Shared analysis results and collaborative documentation
- Performance: Incremental analysis and file watching for large codebases
This project is designed for local development and codebase analysis. Adapt licensing as needed for your use case.