# sourcerer-io/sourcerer-app architecture

> Architecture diagram of the GitHub repository sourcerer-io/sourcerer-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sourcerer-io/sourcerer-app
- Repository: https://github.com/sourcerer-io/sourcerer-app

## Overview

Sourcerer is a CLI app for building a visual software-engineer profile from local Git repositories. Its main workflow is to configure and select repositories, inspect commit history and diffs, derive language/library and contribution statistics, then send statistical data to Sourcerer’s API. The README also highlights broad language/library detection, repository summaries, and interesting facts. Several subsystem links below rely on README statements or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/main/kotlin/app/hashers/CommitCrawler.kt`](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/hashers/CommitCrawler.kt) (Git commit crawler), [`src/main/kotlin/app/api/Api.kt`](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/api/Api.kt) (API contract), [`src/main/kotlin/app/Main.kt`](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/Main.kt) (CLI entry), [`src/main/kotlin/app/config/FileConfigurator.kt`](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/config/FileConfigurator.kt) (Configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and setup"]
  node_main["CLI entry<br/>[Main.kt]"]
  node_console["Console wizard<br/>[ConsoleUi.kt]"]
  node_auth["Authentication<br/>[AuthState.kt]"]
  node_email["Email setup<br/>[EmailState.kt]"]
  node_repo_states["Repository actions<br/>[AddRepoState.kt]"]
  node_config["Configuration"]
  node_logger["Logging and telemetry<br/>[Logger.kt]"]
  node_file_helper["Local file access<br/>[FileHelper.kt]"]
end

subgraph group_analysis["Repository analysis"]
  node_local_repo["Local repository model<br/>[LocalRepo.kt]"]
  node_repo_helper["Repository discovery<br/>[RepoHelper.kt]"]
  node_crawler["Git commit crawler<br/>[CommitCrawler.kt]"]
  node_extractors["Language extractors"]
  node_classifier["Library classifier"]
  node_heuristics["Language heuristics<br/>[Heuristics.kt]"]
end

subgraph group_insights["Profile insights"]
  node_repo_hasher["Repository hasher<br/>[RepoHasher.kt]"]
  node_fact_hashers["Fact and longevity analysis<br/>[CodeLongevity.kt]"]
  node_distance_hasher["Author distance analysis"]
  node_models["Profile data models"]
end

subgraph group_sync["Server synchronization"]
  node_api["API contract<br/>[Api.kt]"]
  node_server_api["Server client<br/>[ServerApi.kt]"]
end

node_engineer(("Engineer"))
node_service{{"Sourcerer service"}}

node_engineer -->|"runs"| node_main
node_main -->|"starts wizard"| node_console
node_main -->|"loads settings"| node_config
node_console -.->|"routes to"| node_auth
node_auth -->|"routes to"| node_email
node_auth -->|"authorizes"| node_api
node_main -->|"supports commands"| node_repo_states
node_config -->|"stores selections"| node_local_repo
node_repo_states -.->|"manages repos"| node_repo_helper
node_repo_helper -->|"reads history"| node_crawler
node_email -->|"checks commits"| node_crawler
node_crawler -->|"creates commit data"| node_models
node_crawler -.->|"supplies diffs"| node_extractors
node_extractors -->|"uses classifier"| node_classifier
node_heuristics -->|"implements detection"| node_extractors
node_email -.->|"starts hashing"| node_repo_hasher
node_repo_hasher -.->|"crawls commits"| node_crawler
node_repo_hasher -.->|"uploads statistics"| node_api
node_fact_hashers -->|"uses history"| node_crawler
node_fact_hashers -->|"submits facts"| node_api
node_distance_hasher -->|"submits distances"| node_api
node_server_api -->|"implements"| node_api
node_server_api -->|"reads credentials"| node_config
node_api -->|"exchanges profile data"| node_service
node_main -.->|"logs events"| node_logger
node_config -->|"uses file paths"| node_file_helper

click node_main "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/Main.kt"
click node_console "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/ui/ConsoleUi.kt"
click node_auth "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/ui/AuthState.kt"
click node_email "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/ui/EmailState.kt"
click node_repo_states "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/ui/AddRepoState.kt"
click node_config "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/config/FileConfigurator.kt"
click node_local_repo "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/model/LocalRepo.kt"
click node_repo_helper "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/utils/RepoHelper.kt"
click node_crawler "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/hashers/CommitCrawler.kt"
click node_extractors "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/extractors/ExtractorInterface.kt"
click node_classifier "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/extractors/ClassifierManager.kt"
click node_heuristics "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/extractors/Heuristics.kt"
click node_repo_hasher "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/hashers/RepoHasher.kt"
click node_fact_hashers "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/hashers/CodeLongevity.kt"
click node_distance_hasher "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/hashers/AuthorDistanceHasher.kt"
click node_models "https://github.com/sourcerer-io/sourcerer-app/tree/develop/src/main/kotlin/app/model"
click node_api "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/api/Api.kt"
click node_server_api "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/api/ServerApi.kt"
click node_logger "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/Logger.kt"
click node_file_helper "https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/utils/FileHelper.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_console,node_auth,node_email,node_repo_states,node_config,node_logger,node_file_helper toneBlue
class node_local_repo,node_repo_helper,node_crawler,node_extractors,node_classifier,node_heuristics toneAmber
class node_repo_hasher,node_fact_hashers,node_distance_hasher,node_models toneMint
class node_api,node_server_api toneRose
class node_engineer,node_service toneIndigo
```

## Components

### CLI and setup

- [CLI entry](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/Main.kt): `src/main/kotlin/app/Main.kt`
- [Console wizard](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/ui/ConsoleUi.kt): `src/main/kotlin/app/ui/ConsoleUi.kt`
- [Authentication](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/ui/AuthState.kt): `src/main/kotlin/app/ui/AuthState.kt`
- [Email setup](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/ui/EmailState.kt): `src/main/kotlin/app/ui/EmailState.kt`
- [Repository actions](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/ui/AddRepoState.kt): `src/main/kotlin/app/ui/AddRepoState.kt`
- [Configuration](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/config/FileConfigurator.kt): `src/main/kotlin/app/config/FileConfigurator.kt`
- [Logging and telemetry](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/Logger.kt): `src/main/kotlin/app/Logger.kt`
- [Local file access](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/utils/FileHelper.kt): `src/main/kotlin/app/utils/FileHelper.kt`

### Repository analysis

- [Local repository model](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/model/LocalRepo.kt): `src/main/kotlin/app/model/LocalRepo.kt`
- [Repository discovery](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/utils/RepoHelper.kt): `src/main/kotlin/app/utils/RepoHelper.kt`
- [Git commit crawler](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/hashers/CommitCrawler.kt): `src/main/kotlin/app/hashers/CommitCrawler.kt`
- [Language extractors](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/extractors/ExtractorInterface.kt): `src/main/kotlin/app/extractors/ExtractorInterface.kt`
- [Library classifier](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/extractors/ClassifierManager.kt): `src/main/kotlin/app/extractors/ClassifierManager.kt`
- [Language heuristics](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/extractors/Heuristics.kt): `src/main/kotlin/app/extractors/Heuristics.kt`

### Profile insights

- [Repository hasher](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/hashers/RepoHasher.kt): `src/main/kotlin/app/hashers/RepoHasher.kt`
- [Fact and longevity analysis](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/hashers/CodeLongevity.kt): `src/main/kotlin/app/hashers/CodeLongevity.kt`
- [Author distance analysis](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/hashers/AuthorDistanceHasher.kt): `src/main/kotlin/app/hashers/AuthorDistanceHasher.kt`
- [Profile data models](https://github.com/sourcerer-io/sourcerer-app/tree/develop/src/main/kotlin/app/model): `src/main/kotlin/app/model`

### Server synchronization

- [API contract](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/api/Api.kt): `src/main/kotlin/app/api/Api.kt`
- [Server client](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/kotlin/app/api/ServerApi.kt): `src/main/kotlin/app/api/ServerApi.kt`

### Other components

- **Engineer**
- **Sourcerer service**

## Connections

- Engineer → CLI entry: runs (evidence: `README.md`)
- CLI entry → Console wizard: starts wizard (evidence: `src/main/kotlin/app/Main.kt`)
- CLI entry → Configuration: loads settings (evidence: `src/main/kotlin/app/Main.kt`)
- Console wizard → Authentication: routes to (evidence: `src/main/kotlin/app/ui/AuthState.kt`)
- Authentication → Email setup: routes to (evidence: `src/main/kotlin/app/ui/AuthState.kt`)
- Authentication → API contract: authorizes (evidence: `src/main/kotlin/app/ui/AuthState.kt`)
- CLI entry → Repository actions: supports commands (evidence: `src/main/kotlin/app/Main.kt`)
- Configuration → Local repository model: stores selections (evidence: `src/main/kotlin/app/config/FileConfigurator.kt`)
- Repository actions → Repository discovery: manages repos
- Repository discovery → Git commit crawler: reads history (evidence: `src/main/kotlin/app/utils/RepoHelper.kt`)
- Email setup → Git commit crawler: checks commits (evidence: `src/main/kotlin/app/ui/EmailState.kt`)
- Git commit crawler → Profile data models: creates commit data (evidence: `src/main/kotlin/app/hashers/CommitCrawler.kt`)
- Git commit crawler → Language extractors: supplies diffs
- Language extractors → Library classifier: uses classifier (evidence: `src/main/kotlin/app/extractors/ExtractorInterface.kt`)
- Language heuristics → Language extractors: implements detection (evidence: `src/main/kotlin/app/extractors/Heuristics.kt`)
- Email setup → Repository hasher: starts hashing
- Repository hasher → Git commit crawler: crawls commits
- Repository hasher → API contract: uploads statistics
- Fact and longevity analysis → Git commit crawler: uses history (evidence: `src/main/kotlin/app/hashers/CodeLongevity.kt`)
- Fact and longevity analysis → API contract: submits facts (evidence: `src/main/kotlin/app/hashers/CodeLongevity.kt`)
- Author distance analysis → API contract: submits distances (evidence: `src/main/kotlin/app/hashers/AuthorDistanceHasher.kt`)
- Server client → API contract: implements (evidence: `src/main/kotlin/app/api/ServerApi.kt`)
- Server client → Configuration: reads credentials (evidence: `src/main/kotlin/app/api/ServerApi.kt`)
- API contract → Sourcerer service: exchanges profile data (evidence: `README.md`)
- CLI entry → Logging and telemetry: logs events (evidence: `src/main/kotlin/app/Main.kt`)
- Configuration → Local file access: uses file paths (evidence: `src/main/kotlin/app/config/FileConfigurator.kt`)
