# datomic/codeq architecture

> Architecture diagram of the GitHub repository datomic/codeq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/datomic/codeq
- Repository: https://github.com/datomic/codeq

## Overview

Key Components to Include:

##### Core System Components
- Git Repository Interface
- Datomic Database
- Code Analysis Engine
- Import Pipeline

##### Main Architectural Flow

A. Input Layer:
- Git Repository (external)
- Git Shell Interface (for executing git commands)

B. Processing Layer:
- Import Pipeline (from src/datomic/codeq/core.clj)
- Code Analyzers (from src/datomic/codeq/analyzers/)
- Specifically highlight the Clojure Analyzer (analyzers/clj.clj)

C. Storage Layer:
- Datomic Free Database

D. Integration Points:
- Datomic Peer Connection
- REST Service Interface (optional component)

Design Guidelines:

- Git repo → Import Pipeline
- Import Pipeline → Analyzers
- Analyzers → Datomic Database
- Datomic Peer/REST → Database

##### Specific technical details
- Clojure implementation
- Datomic Free protocol
- REST service port (8080)
- Memory requirements (1g as mentioned in README)

##### Incremental nature of the import process
- How new commits are detected and processed
- Incremental analysis pipeline

##### Monitoring/output components
- Progress tracking
- Analysis status reporting

##### Configuration points
- Memory settings
- Database connection parameters
- File type analysis mappings

Level of Detail:

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef external fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef analyzer fill:#FFE4B5,stroke:#333,stroke-width:2px
    classDef storage fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef service fill:#FFB6C1,stroke:#333,stroke-width:2px

    %% Input Layer
    subgraph Input
        GitRepo[("Git Repository")]:::external
        GitShell["Git Shell Interface"]:::core
    end

    %% Processing Layer
    subgraph Processing
        ImportPipeline["Import Pipeline"]:::core
        AnalysisEngine["Code Analysis Engine"]:::analyzer
        ClojureAnalyzer["Clojure Analyzer (.clj)"]:::analyzer
        AnalyzerFramework["Analyzers Framework"]:::analyzer
        UtilFuncs["Utility Functions"]:::core
    end

    %% Storage Layer
    subgraph Storage
        DatomicDB[(Datomic Free DB<br>localhost:4334)]:::storage
        Schema[("Schema")]:::storage
    end

    %% Integration Layer
    subgraph Integration
        DatomicPeer["Datomic Peer"]:::service
        REST["REST Service<br>:8080"]:::service
    end

    %% Connections
    GitRepo --> GitShell
    GitShell --> ImportPipeline
    ImportPipeline --> AnalysisEngine
    AnalysisEngine --> AnalyzerFramework
    AnalyzerFramework --> ClojureAnalyzer
    UtilFuncs -.-> ImportPipeline
    UtilFuncs -.-> AnalysisEngine
    ClojureAnalyzer --> DatomicPeer
    DatomicPeer --> DatomicDB
    REST --> DatomicPeer
    Schema -.-> DatomicDB

    %% Click Events
    click ImportPipeline "https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/core.clj"
    click AnalysisEngine "https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/analyzer.clj"
    click ClojureAnalyzer "https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/analyzers/clj.clj"
    click AnalyzerFramework "https://github.com/Datomic/codeq/tree/master/src/datomic/codeq/analyzers/"
    click UtilFuncs "https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/util.clj"

    %% Legend
    subgraph Legend
        L1[External Systems]:::external
        L2[Core Components]:::core
        L3[Analyzers]:::analyzer
        L4[Storage]:::storage
        L5[Services]:::service
    end
```
