Skip to content
Arxo Arxo

Introduction to Arxo

Arxo is a comprehensive architecture analysis tool that helps you understand, measure, and enforce architectural patterns in your codebase. It supports TypeScript/JavaScript, Python, Rust, Java, Kotlin, and Go — all from a single binary written in Rust.

Arxo parses your source code, builds dependency graphs, computes architectural metrics, and evaluates policy invariants — giving you a quantitative view of your architecture and automated guardrails to prevent drift.

Cycles

Detect and eliminate circular dependencies with SCC analysis.

Coupling

Measure propagation cost — how far changes ripple through the system.

Centrality

Find hub modules with high fan-in/fan-out that are risky to change.

Analyze polyglot codebases with a single tool:

  • TypeScript / JavaScript — React, Next.js, Node.js, Bun
  • Python — Django, Flask, FastAPI
  • Rust — Cargo workspaces
  • Java — Maven, Gradle
  • Kotlin — Android, Spring
  • Go — Go modules
CategoryMetrics
StructuralSCC (cycle detection), Centrality (fan-in, fan-out, betweenness)
CouplingPropagation Cost (change impact), Coupling Analysis (composite coupling hotspots), Ricci Curvature (dependency bottlenecks)
SynthesisL1 Overview (aggregate risk score from structural + coupling metrics)

Define architectural rules in YAML and enforce them in CI/CD to prevent regressions:

policy:
invariants:
- metric: scc.max_cycle_size
op: "=="
value: 0
message: "No circular dependencies"
- metric: propagation_cost.system.ratio
op: "<="
value: 0.10
message: "Keep system propagation cost under 10%"
FormatUse case
ConsoleHuman-readable terminal output with pass/fail indicators
JSONMachine-readable for CI/CD pipelines and custom tooling
HTMLInteractive web reports with dependency graph visualization
SARIFGitHub Code Scanning and VS Code Problems panel integration
  • Parallel computation — Metrics run concurrently across available cores.
  • Cached results — Repeated analysis returns instantly until the cache TTL expires.
  • Incremental mode — Only recompute metrics affected by changed files.
  • Preset-based — Run only the metrics you need: quick finishes in seconds, full runs everything.

Install the pre-built binary from GitHub Releases, or use npm:

Terminal window
npm install -g arxo

See Installation for other options (Docker, direct download).

Terminal window
# Quick health check — SCC, centrality, overview (~seconds)
arxo analyze --preset quick
# Full analysis — all available metrics
arxo analyze --preset full
Analyzing project...
Parsed 247 files
Built import graph (183 nodes, 412 edges)
Results:
scc.max_cycle_size: 0 No cycles
propagation_cost.system.ratio: 0.12 Low coupling
centrality.module.hub_like_count: 0 No hubs
No policy violations
  1. Parse

    Extract imports, function calls, and type relationships from source files across all supported languages.

  2. Build Graphs

    Construct import graphs (module-level dependencies), call graphs (function-level), and entity graphs (component relationships).

  3. Compute Metrics

    Run metrics in two phases: independent base metrics first (SCC, Propagation Cost, Centrality), then synthesizer metrics that aggregate the base results (L1 Overview).

  4. Evaluate Policies

    Check each policy invariant against computed metric values. Report violations with expected vs. actual values.

  5. Report

    Output results in your chosen format — Console, JSON, HTML, or SARIF — and exit with a non-zero code if any invariant fails.

See Architecture Overview for a deep dive into the engine internals.

Quantitative measures of architectural properties. Each metric produces one or more numeric values and optional findings (warnings about specific modules or edges).

  • SCC — Detects circular dependencies via Tarjan’s algorithm.
  • Propagation Cost — Fraction of reachable pairs in the dependency graph (0–1). Lower is better.
  • Centrality — Betweenness, fan-in, fan-out, PageRank. Identifies hub modules that sit on many dependency paths.
  • L1 Overview — Aggregates base metrics into an overall structural risk score.
  • Flow Analysis — Measures dependency flow: node/link count, density, and max fan-in.
  • Coupling Analysis — Identifies coupling hotspots across the module graph.

The import graph powers the analysis:

GraphCapturesUsed by
Import GraphModule-level import / require / use edgesSCC, Propagation Cost, Centrality, Flow Analysis, Coupling Analysis, L1 Overview

Declarative invariants that must hold. Each invariant references a metric value, a comparison operator, and a threshold:

invariants:
- metric: scc.max_cycle_size
op: "=="
value: 0
- metric: propagation_cost.system.ratio
op: "<="
value: 0.10

When an invariant fails, the CLI exits with a non-zero code and reports the violation — making it easy to use as a CI gate.

Pre-configured analysis profiles that control which metrics run:

PresetMetricsTypical time
quickSCC, L1 Overview, Centrality1–5 seconds
fullAll available metricsVaries by project size
  • Pre-commit hooks — Run arxo analyze --preset quick to catch cycles and hub modules before committing.
  • IDE integration — The VS Code extension shows violations inline and provides a metrics dashboard.
  • MCP for AI assistants — The MCP server lets Cursor, Claude, and other AI tools call architecture analysis directly.
  • Pull request gates — Enforce policies automatically with --fail-fast.
  • Baseline comparison — Compare metrics against main to catch regressions in PRs.
  • Code scanning — Export SARIF reports for GitHub Code Scanning or GitLab integration.
  • Dependency analysis — Measure propagation cost and find tightly coupled modules.
  • Hub detection — Identify god modules with high fan-in and fan-out that are risky to change.
  • Cycle elimination — Find and break circular dependencies before they spread.
arxo.yaml
policy:
invariants:
- metric: scc.max_cycle_size
op: "=="
value: 0
message: "No circular dependencies allowed"
Terminal window
arxo analyze --preset quick --fail-fast
data:
import_graph:
group_by: folder
group_depth: 2
metrics:
- id: propagation_cost
- id: scc
policy:
invariants:
- metric: propagation_cost.system.ratio
op: "<="
value: 0.15
message: "Modules must stay loosely coupled"
- metric: scc.max_cycle_size
op: "=="
value: 0
message: "No circular dependencies"
metrics:
- id: centrality
policy:
invariants:
- metric: centrality.module.hub_like_count
op: "=="
value: 0
message: "No god modules with high fan-in and fan-out"
- metric: centrality.module.max_fan_out
op: "<="
value: 15
message: "No module should depend on more than 15 others"
  • CI/CD Integration — Automate checks in GitHub Actions, GitLab CI, and Jenkins.
  • Library Integration — Use Arxo as a Rust library in your own applications.
  • VS Code Extension — Real-time analysis, inline violations, and metrics dashboard.
  • MCP Server — Architecture analysis for AI assistants (Cursor, Claude Desktop).