Skip to main content

ARCLUX Architecture Deep Dive πŸ—οΈ

Understanding ARCLUX’s internal design and how everything connects.

Table of Contents

  1. Core Concepts
  2. Data Model
  3. The Pipeline in Detail
  4. Parser Architecture
  5. Indexer Algorithm
  6. Graph Construction
  7. Detector Pattern
  8. Performance Considerations

Core Concepts

Repository Model

Everything in ARCLUX is about the Repository object:

The Three Levels of Abstraction

Level 1: Files
Level 2: Modules (importable units)
Level 3: Graph (relationships)

Data Model

Module

Import

Export

Dependency


The Pipeline in Detail

Step 1: Git Operations

What happens:

Step 2: Parsing

For TypeScript:

Step 3: Indexing

Import Resolution Deep Dive

This is the hardest part!

Graph Construction

Dependency Graph

Call Graph (Advanced)


Detector Pattern

All 20 detectors follow same pattern:

Example: Circular Dependency Detection


Performance Considerations

Why It’s Fast

  1. Streaming parsing - Parse files as read
  2. Parallel processing - Parse multiple files at once
  3. Lazy evaluation - Only compute what’s needed
  4. Caching - Cache results of expensive operations

Bottlenecks

Optimization Strategies


Thread Model

ARCLUX is synchronous by design:
Benefits:
  • Easy to understand
  • No race conditions
  • Simple error handling
Trade-off:
  • Slower than parallel on large projects
  • But still fast enough!

Extensibility Hooks

Where you can extend ARCLUX:
  1. Add parser β†’ PARSER_REGISTRY
  2. Add detector β†’ DETECTOR_REGISTRY
  3. Add graph type β†’ Call from CLI
  4. Add rule β†’ RULES_REGISTRY
  5. Custom analysis β†’ Use programmatic API
All without modifying core!

Error Handling


Design Principles

  1. Single Responsibility - Each package does one thing
  2. Dependency Injection - Pass Repository around
  3. Immutability - Don’t modify Repository
  4. Composition - Build complex behavior from simple pieces
  5. Testability - Everything can be tested in isolation
These make ARCLUX:
  • Easy to understand
  • Easy to extend
  • Easy to test
  • Easy to maintain

Ready to dive into code? Start with packages/engine/pipeline.ts! πŸš€