Skip to content

yucheng1554439/archlens

ArchLens — AI-Powered System Design Visualizer

ArchLens

Turn any codebase into a system design document — in minutes, inside VS Code.

Local static analysis · Interactive dependency graphs · RAG architecture chat · AI reviews

Build Tests TypeScript VS Code Extension React D3.js Mermaid Tree-sitter AI Powered OpenAI Claude Gemini MIT

Quick Start · Features · Architecture · Case Study · Benchmarks · Changelog · Contributing


Elevator Pitch

ArchLens is a production-grade VS Code extension that analyzes your repository locally, builds a structural knowledge graph, and surfaces architecture diagrams, dependency graphs, technical debt, and grounded AI chat — without uploading source code to a cloud analyzer.


Product Overview

Capability What you get
Architecture Discovery Detects MVC, Layered, Clean, Hexagonal, Microservices, Event-Driven patterns
Dependency Graph Interactive D3 force graph with zoom, pan, search, click-to-open
Architecture Chat RAG Q&A grounded in your analysis — files, paths, confidence scores
Technical Debt God classes, circular deps, layer violations, git hotspots
Auth Flow Detection JWT, Passport, middleware chains → Mermaid sequence diagrams
Database ERD Prisma, TypeORM, Sequelize, Mongoose → Mermaid ER diagrams
AI Architecture Review Structured strengths/weaknesses via OpenAI, Claude, or Gemini
Export System Markdown, JSON, Mermaid, HTML bundle to .archlens/export/

Demo

ArchLens demo — analyze repository, explore dashboard, ask architecture questions
Record a live demo GIF: README hero GIF guide


Screenshots

Architecture Dashboard Dependency Graph Architecture Chat
ArchLens dashboard with architecture stats and tabs Interactive D3 dependency graph RAG architecture chat with referenced files
Full analysis dashboard with stats, tabs, and Mermaid diagrams Force-directed graph — zoom, search, open files in VS Code Grounded Q&A with confidence and file references
Architecture Diagram Technical Debt Report Database ERD
Detected architecture layers and Mermaid flow Technical debt table with severity and file paths Database ERD from ORM schema detection
Pattern detection with layer flow visualization Severity-ranked debt issues and hotspot analysis Auto-generated entity-relationship diagram

Capture production PNGs/GIFs: docs/demo/recording-guide.md · docs/demo/screenshots/


Features

Architecture Chat (RAG)

Ask natural-language questions about your codebase. ArchLens retrieves relevant entities from a knowledge graph built during analysis, then generates answers with referenced files, dependency paths, and confidence scores.

You: Where does authentication happen?
ArchLens: JWT validation occurs in auth.middleware.ts → AuthService.verifyToken()
          Referenced: src/middleware/auth.ts, src/services/auth.service.ts
          Confidence: 87%

RAG pipeline docs · Demo script

Dependency Graph

A directed force graph built from import relationships and layer inference. Explore coupling visually, search nodes, and jump to source files.

Dependency engine docs

Technical Debt Analysis

Deterministic detectors surface structural risks before they become production incidents:

  • God classes and oversized modules
  • Circular dependencies
  • Layer violations (e.g. controller → repository)
  • Dead code signals
  • Git churn hotspots

Authentication Flow Detection

Identifies JWT, Passport, session middleware, and login endpoints. Produces Mermaid sequence diagrams of the auth lifecycle.

Database ERD Generation

Parses Prisma, TypeORM, Sequelize, and Mongoose schemas. Generates Mermaid ER diagrams from your actual model definitions.

AI Architecture Review

When configured with an API key, ArchLens produces structured reviews: strengths, weaknesses, scalability risks, and actionable recommendations — grounded in deterministic analysis, not raw file dumps.


Supported Languages

Language Extensions Parser
TypeScript .ts, .tsx ts-morph AST
JavaScript .js, .jsx, .mjs, .cjs Babel AST
Go .go Regex + structural parser

ORM and framework detection covers Express, NestJS, Next.js, React, Fastify, Prisma, TypeORM, Sequelize, Mongoose, Passport, and more.


Tech Stack

Layer Technologies
Extension Host TypeScript, VS Code Extension API
Dashboard UI React 18, Vite, D3.js, Mermaid
Static Analysis ts-morph, Babel, custom Go parser
Diagrams @archlens/diagram-engine (Mermaid + graph builder)
AI Layer OpenAI, Claude, Gemini REST APIs
RAG TF-IDF embeddings, knowledge graph, vector store
Testing Vitest, 64 tests, v8 coverage
Build npm workspaces, TypeScript project references

Installation

Prerequisites

  • Node.js 18+
  • npm 9+
  • VS Code 1.85+

From source

git clone https://github.com/archlens/archlens.git
cd archlens
npm install
npm run build:extension

Package and install:

cd apps/vscode-extension
npm run package
# Extensions → Install from VSIX

Quick Start

  1. Open any repository in VS Code (monorepo root recommended for development)
  2. Click the ArchLens icon in the Activity Bar
  3. Click Analyze Repository
  4. Explore the Dashboard — Architecture, Dependencies, Database, Auth, Debt, Review
  5. Open Architecture Chat for grounded Q&A
  6. Configure AI (optional): ArchLens: Configure API Key
{
  "archlens.aiProvider": "openai",
  "archlens.apiKey": "sk-...",
  "archlens.model": "gpt-4o-mini",
  "archlens.maxFiles": 10000,
  "archlens.useCache": true
}

Architecture Walkthrough

ArchLens is a TypeScript monorepo with strict package boundaries:

archlens/
├── apps/
│   ├── vscode-extension/    # Extension host, commands, webviews
│   └── webview-ui/          # React dashboard (bundled to media/)
└── packages/
    ├── shared/              # Types, constants, shared contracts
    ├── analysis-engine/     # Scanner, AST parsers, detectors
    ├── diagram-engine/      # Dependency graphs, Mermaid generation
    ├── ai-engine/           # LLM providers, docs, export
    └── rag-engine/          # Knowledge graph, embeddings, chat
flowchart TB
  subgraph VSCode["VS Code Extension"]
    CMD[8 Commands]
    SB[Sidebar]
    DB[React Dashboard]
    CH[Architecture Chat]
  end

  subgraph Engine["Analysis Engine"]
    SCAN[Repository Scanner]
    AST[AST Parsers]
    DET[Pattern Detectors]
    DEBT[Debt Scanner]
  end

  subgraph Intelligence["AI Layer"]
    KG[Knowledge Graph]
    RAG[RAG Retriever]
    LLM[OpenAI / Claude / Gemini]
  end

  CMD --> SCAN --> AST --> DET
  DET --> DEBT
  DET --> DB
  DET --> KG --> RAG --> LLM
  CH --> RAG
Loading

Deep dives: System Architecture · Analysis Pipeline · RAG Pipeline


Benchmark Results

Repository size Files LOC Cold analysis Warm cache Peak memory
Small 50 5K ~0.2s ~0.01s (31×) ~79 MB
Medium 500 50K ~0.7s ~0.05s (63×) ~189 MB
Large 2,000 200K ~3.2s ~0.18s (62×) ~216 MB
Enterprise 10,000 1M+ ~48s (est.) ~0.9s (est.) ~650 MB (est.)
npm run benchmark

Full methodology: docs/benchmarks.md


Example Outputs

Sample analyses for popular stacks:

Stack Architecture Graph Debt Onboarding AI Review
Express Report Graph Debt Guide Review
NestJS Report Graph Debt Guide Review
Next.js Report Graph Debt Guide Review
React Report Graph Debt Guide Review

Real-World Use Cases

Scenario How ArchLens helps
Onboarding New engineers explore architecture, dependencies, and debt in day one
System design interviews Generate defensible architecture narratives from real code
Refactoring planning Identify god classes, circular deps, and layer violations before a rewrite
Security review Trace authentication flows and database access paths
Tech due diligence Export structured reports for M&A or vendor assessment
Documentation drift Regenerate architecture docs when the codebase changes

Repository Structure

Path Purpose
apps/vscode-extension/ VS Code extension entry, commands, webview hosts
apps/webview-ui/ React dashboard (D3 + Mermaid)
packages/analysis-engine/ Scanner, parsers, detectors, cache
packages/diagram-engine/ Graph builder, Mermaid generators
packages/ai-engine/ LLM providers, doc generation, export
packages/rag-engine/ Knowledge graph, embeddings, RAG chat
packages/shared/ Shared types and constants
examples/ Sample outputs for Express, NestJS, Next.js, React
docs/ Architecture, demos, case study, recruiter guide
scripts/ Benchmark, command audit, analysis verification

Design Decisions

Decision Rationale
Local-first analysis Source code never leaves the machine for scanning/parsing
Structured before generative Deterministic AnalysisResult grounds all AI output
Monorepo packages Clear dependency direction; each engine is independently testable
Hash-based cache Second analysis run is 30–60× faster on unchanged repos
RAG over raw context Retrieves entities from knowledge graph — reduces hallucination
VS Code native Zero context switch; click graph nodes to open files

Resume Bullet Points

Use these when describing ArchLens on a resume or portfolio:

  • Built a VS Code extension with React webviews that analyzes codebases locally and generates architecture documentation, dependency graphs, and technical debt reports
  • Designed a TypeScript monorepo with 5 domain packages (analysis, diagram, AI, RAG, shared) and 64 automated tests
  • Implemented AST-based static analysis (ts-morph, Babel) with architecture pattern detection across 6+ patterns
  • Built an interactive D3.js force-directed dependency graph with search, zoom, and file navigation
  • Architected a RAG pipeline with knowledge graph construction, TF-IDF embeddings, and multi-provider LLM integration (OpenAI, Claude, Gemini)
  • Achieved sub-second analysis on medium repos (500 files) with hash-based incremental caching

Full ATS-friendly versions: docs/resume-snippets.md


Commands

Command Description
ArchLens: Analyze Repository Full codebase analysis + RAG index
ArchLens: Generate Documentation Write .archlens/docs/architecture.md
ArchLens: Show Dependency Graph Open interactive graph tab
ArchLens: Show Architecture Open architecture diagram tab
ArchLens: Architecture Chat RAG-powered Q&A panel
ArchLens: Export Report Bundle to .archlens/export/
ArchLens: Open Dashboard Open analysis dashboard
ArchLens: Configure API Key Set OpenAI / Claude / Gemini key

Output Locations

Path Contents
.archlens/analysis.json Full structured analysis snapshot
.archlens/cache/ Incremental analysis cache
.archlens/docs/ Generated markdown documentation
.archlens/index/ RAG knowledge graph + embeddings
.archlens/export/ Export bundle (MD, JSON, Mermaid, HTML)

Development

npm install
npm run build:extension   # Build all packages + extension
npm test                  # 64 unit/integration tests
npm run test:coverage     # Coverage report
npm run benchmark         # Performance benchmarks

Open the monorepo root → Run ExtensionF5. See docs/contributing.md.


Documentation

Document Audience
docs/architecture/ Engineers — system design deep dives
docs/case-study.md Engineering leaders — build narrative
docs/recruiter-guide.md Recruiters — non-technical overview
docs/resume-snippets.md Candidates — ATS bullet points
docs/project-metrics.md Contributors — project statistics
docs/release-readiness.md Maintainers — launch checklist
CHANGELOG.md Everyone — version history

Contributing

We welcome contributions. See CONTRIBUTING.md and docs/contributing.md.

  1. Fork the repository
  2. Create a feature branch
  3. Run npm test and npm run build:extension
  4. Open a pull request

License

MIT © ArchLens Contributors

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors