Open source · MIT License

Your codebase,
visualized by AI

ArchiLens reads your Git repository and generates layered C4-style architecture diagrams — automatically, using AST analysis and AI enrichment. No manual diagrams. No stale docs.

Get started → View on GitHub
archilens — bash
$ python -m archilens analyze --repo ./my-service
Analysing repository...
 
┌──────────────────────────────────────────┐
│ Modules Discovered │
├──────────────┬──────┬──────┬─────────────┤
orders │ 1842 │ 3 │ Order Mgmt │
payments │ 987 │ 2 │ Billing │
notifications │ 432 │ 1 │ Alerts │
└──────────────┴──────┴──────┴─────────────┘
 
Detected patterns: layered_mvc, event_driven
 
OK Generated 8 diagrams in .archilens/diagrams
-> L0_system_context.md
-> L1_module_architecture.md
-> L2_orders.md L2_payments.md ...
 
$ python -m archilens serve --port 8765
ArchiLens Viewer → http://localhost:8765
5
Languages supported
3
Output formats
4
Diagram levels
0
Config needed
Everything your architecture needs

From a single CLI command to a full interactive viewer — ArchiLens covers the whole workflow.

🌲

AST-Accurate Extraction

Tree-sitter parses Python, JavaScript, TypeScript, Java, and Go at the AST level — no regex guesswork. Classes, functions, imports, and inheritance are extracted with line-level precision.

tree-sitter 0.25
🤖

AI-Powered Summaries

Claude reads each module and writes a one-line business capability summary. Diagrams show what the code does, not just what it's named. Swap any OpenAI-compatible provider.

Claude / OpenAI / Ollama
📊

Three Output Formats

Generate diagrams as Mermaid, D2, or PlantUML. All formats support every level — L0 through L3 — so you can embed diagrams anywhere: GitHub, Confluence, Notion, or your own docs.

Mermaid · D2 · PlantUML
🔍

Interactive Web Viewer

Run archilens serve for a dark-themed SPA. Click any module in the L1 diagram to drill straight into its L2 component view. Search, filter, and re-analyse without leaving the browser.

Flask · Mermaid.js v11

Evolution Timeline

Point ArchiLens at your semver tags and watch your architecture grow over time. Detects module additions, removals, and LOC trends with a Mermaid timeline diagram and full markdown report.

archilens history
🔄

PR Drift Detection

The diff command compares architecture between any two Git refs without touching the working tree. Catches layer-skipping, fan-out violations, and new cross-cutting dependencies before they merge.

archilens diff
Diagrams generated in seconds

Real Mermaid output from a sample microservices repo — no configuration required.

Click a tab to switch diagram level
flowchart LR subgraph API["API Layer"] gateway["API Gateway"] end subgraph BIZ["Business Layer"] orders["Orders - Order management"] payments["Payments - Billing"] inventory["Inventory - Stock tracking"] end subgraph DATA["Data Layer"] db[("PostgreSQL")] cache[("Redis Cache")] end gateway -->|REST| orders gateway -->|REST| inventory orders -->|gRPC| payments orders -->|event| inventory orders --> db payments --> db inventory --> cache

Modules detected automatically from directory structure and import analysis

AI assigns a one-line business capability label to every module

Dependency edges come from real import statements — not guesses

Click any node in the interactive viewer to drill into the next level

Four levels of architecture

Each level zooms in further — start with the big picture and drill into any module.

L0

System Context

Your system and its external actors — users, third-party services, databases. The 30,000-foot view.

L1

Module Architecture

All detected modules and the dependency edges between them, grouped by capability layer.

L2

Component Detail

Classes, interfaces, and inheritance within a single module. Rendered as a class diagram.

L3

Process Flow

Sequence diagrams for each detected process flow — request handling, async events, and more.

Up and running in 60 seconds

No sign-up. No API key required for the basic analysis (AI enrichment is opt-in).

1

Install

Works with Python 3.10+ on macOS, Linux, and Windows.

2

Analyse

Point it at any Git repo — local or freshly cloned.

3

Explore

Open the interactive viewer or read the generated markdown diagrams.

# Install from GitHub
pip install git+https://github.com/saurabh-oss/archilens.git
 
# Or clone and install in editable mode
git clone https://github.com/saurabh-oss/archilens.git
pip install -e "./archilens[viewer]"
 
# Analyse a repo
python -m archilens analyze --repo ./my-project
 
# Launch the interactive viewer
python -m archilens serve --repo ./my-project --port 8765
 
# Detect architectural drift between branches
python -m archilens diff --base main --head feature/refactor

Stop drawing diagrams.
Start understanding your code.

ArchiLens is free, open source, and runs entirely on your machine.