# aryand2006/shadowstack architecture

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

- Interactive diagram: https://gitdiagram.com/aryand2006/shadowstack
- Repository: https://github.com/aryand2006/shadowstack

## Overview

ShadowStack is an enterprise code-modernization workbench: developers submit projects for language-specific refactoring, receive syntax/compile-gated patches with verification evidence, and explicitly accept or reject them in a human review queue. The README documents baseline capture, semantic analysis, patch generation, layered verification, review, and migration-corpus learning. The graph preserves language adapters, analytics, audit, and embedding/retrieval capabilities. Some service and worker wiring is unsampled, so uncertain links are dashed rather than presented as observed calls.

Main entry points: [`apps/api/src/main/java/com/shadowstack/api/service/ReviewService.java`](https://github.com/aryand2006/shadowstack/blob/main/apps/api/src/main/java/com/shadowstack/api/service/ReviewService.java) (Human Review), [`apps/api/src/main/java/com/shadowstack/api/controllers`](https://github.com/aryand2006/shadowstack/tree/main/apps/api/src/main/java/com/shadowstack/api/controllers) (REST API), [`packages/migration-corpus/src/main/java/com/shadowstack/corpus/MigrationCorpusService.java`](https://github.com/aryand2006/shadowstack/blob/main/packages/migration-corpus/src/main/java/com/shadowstack/corpus/MigrationCorpusService.java) (Migration Corpus), [`apps/worker/src/main/java/com/shadowstack/worker/jobs/JobClaimService.java`](https://github.com/aryand2006/shadowstack/blob/main/apps/worker/src/main/java/com/shadowstack/worker/jobs/JobClaimService.java) (Job Worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Workbench"]
  node_web["Workbench UI"]
  node_reviewui["Review Queue UI<br/>[page.tsx]"]
end

subgraph group_control["API and Jobs"]
  node_api["REST API"]
  node_orchestration["Refactor Orchestration"]
  node_worker["Job Worker"]
end

subgraph group_transformation["Transformation Engine"]
  node_baseline["Baseline Capture"]
  node_analysis["Static Analysis"]
  node_adapters["Language Adapters"]
  node_jsengine["JavaScript AST Engine<br/>[ast_engine.mjs]"]
  node_refactor["Refactor Engine"]
end

subgraph group_assurance["Verification and Review"]
  node_verifytask["Verification Task"]
  node_verification["Verification Pipeline"]
  node_review["Human Review<br/>[ReviewService.java]"]
end

subgraph group_learning["Migration Intelligence"]
  node_analytics["Analytics"]
  node_corpus["Migration Corpus"]
  node_audit["Audit Logging<br/>[AuditService.java]"]
  node_corpusdb[("Corpus Store")]
  node_embedder["Embedding Retrieval<br/>[retrieval.py]"]
end

node_developer(("Developer"))
node_postgres[("PostgreSQL")]

node_developer -.->|"submits work"| node_web
node_web -.->|"sends requests"| node_api
node_api -.->|"dispatches work"| node_orchestration
node_orchestration -.->|"enqueues jobs"| node_worker
node_worker -.->|"captures baseline"| node_baseline
node_baseline -->|"provides snapshot"| node_analysis
node_analysis -->|"models semantics"| node_adapters
node_adapters -->|"produces candidates"| node_refactor
node_refactor -->|"submits patches"| node_verification
node_worker -->|"runs task"| node_verifytask
node_verifytask -.->|"verifies patch"| node_verification
node_verification -->|"gates review"| node_review
node_api -->|"serves decisions"| node_review
node_review -->|"loads patches"| node_orchestration
node_reviewui -.->|"requests review"| node_api
node_review -.->|"records outcomes"| node_corpus
node_review -.->|"records actions"| node_audit
node_corpus -->|"queries entries"| node_corpusdb
node_corpus -->|"builds metrics"| node_analytics
node_corpusdb -.->|"persists records"| node_postgres
node_embedder -.->|"retrieves similar"| node_corpus
node_adapters -.->|"uses AST engine"| node_jsengine

click node_web "https://github.com/aryand2006/shadowstack/tree/main/apps/web/src/app"
click node_api "https://github.com/aryand2006/shadowstack/tree/main/apps/api/src/main/java/com/shadowstack/api/controllers"
click node_orchestration "https://github.com/aryand2006/shadowstack/blob/main/apps/api/src/main/java/com/shadowstack/api/service/RefactorOrchestrationService.java"
click node_worker "https://github.com/aryand2006/shadowstack/blob/main/apps/worker/src/main/java/com/shadowstack/worker/jobs/JobClaimService.java"
click node_baseline "https://github.com/aryand2006/shadowstack/blob/main/packages/core-analysis/src/main/java/com/shadowstack/analysis/BaselineCapture.java"
click node_analysis "https://github.com/aryand2006/shadowstack/tree/main/packages/core-analysis/src/main/java/com/shadowstack/analysis"
click node_adapters "https://github.com/aryand2006/shadowstack/tree/main/packages/language-adapters/src/main/java/com/shadowstack/adapters"
click node_jsengine "https://github.com/aryand2006/shadowstack/blob/main/packages/language-adapters/native-engines/js/ast_engine.mjs"
click node_refactor "https://github.com/aryand2006/shadowstack/blob/main/packages/refactor-engine/src/main/java/com/shadowstack/refactor/RefactorEngine.java"
click node_verifytask "https://github.com/aryand2006/shadowstack/blob/main/apps/worker/src/main/java/com/shadowstack/worker/tasks/VerificationTask.java"
click node_verification "https://github.com/aryand2006/shadowstack/blob/main/packages/verify-engine/src/main/java/com/shadowstack/verify/VerificationPipeline.java"
click node_review "https://github.com/aryand2006/shadowstack/blob/main/apps/api/src/main/java/com/shadowstack/api/service/ReviewService.java"
click node_reviewui "https://github.com/aryand2006/shadowstack/blob/main/apps/web/src/app/review/page.tsx"
click node_analytics "https://github.com/aryand2006/shadowstack/blob/main/packages/migration-corpus/src/main/java/com/shadowstack/corpus/CorpusAnalytics.java"
click node_corpus "https://github.com/aryand2006/shadowstack/blob/main/packages/migration-corpus/src/main/java/com/shadowstack/corpus/MigrationCorpusService.java"
click node_audit "https://github.com/aryand2006/shadowstack/blob/main/packages/migration-corpus/src/main/java/com/shadowstack/corpus/AuditService.java"
click node_corpusdb "https://github.com/aryand2006/shadowstack/blob/main/packages/migration-corpus/src/main/java/com/shadowstack/corpus/MigrationCorpusRepository.java"
click node_embedder "https://github.com/aryand2006/shadowstack/blob/main/packages/embedder/src/shadowstack_embedder/retrieval.py"

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_web,node_reviewui toneBlue
class node_api,node_orchestration,node_worker,node_postgres toneAmber
class node_baseline,node_analysis,node_adapters,node_jsengine,node_refactor toneMint
class node_verifytask,node_verification,node_review toneRose
class node_analytics,node_corpus,node_audit,node_corpusdb,node_embedder,node_developer toneIndigo
```

## Components

### Workbench

- [Workbench UI](https://github.com/aryand2006/shadowstack/tree/main/apps/web/src/app): `apps/web/src/app`
- [Review Queue UI](https://github.com/aryand2006/shadowstack/blob/main/apps/web/src/app/review/page.tsx): `apps/web/src/app/review/page.tsx`

### API and Jobs

- [REST API](https://github.com/aryand2006/shadowstack/tree/main/apps/api/src/main/java/com/shadowstack/api/controllers): `apps/api/src/main/java/com/shadowstack/api/controllers`
- [Refactor Orchestration](https://github.com/aryand2006/shadowstack/blob/main/apps/api/src/main/java/com/shadowstack/api/service/RefactorOrchestrationService.java): `apps/api/src/main/java/com/shadowstack/api/service/RefactorOrchestrationService.java`
- [Job Worker](https://github.com/aryand2006/shadowstack/blob/main/apps/worker/src/main/java/com/shadowstack/worker/jobs/JobClaimService.java): `apps/worker/src/main/java/com/shadowstack/worker/jobs/JobClaimService.java`

### Transformation Engine

- [Baseline Capture](https://github.com/aryand2006/shadowstack/blob/main/packages/core-analysis/src/main/java/com/shadowstack/analysis/BaselineCapture.java): `packages/core-analysis/src/main/java/com/shadowstack/analysis/BaselineCapture.java`
- [Static Analysis](https://github.com/aryand2006/shadowstack/tree/main/packages/core-analysis/src/main/java/com/shadowstack/analysis): `packages/core-analysis/src/main/java/com/shadowstack/analysis`
- [Language Adapters](https://github.com/aryand2006/shadowstack/tree/main/packages/language-adapters/src/main/java/com/shadowstack/adapters): `packages/language-adapters/src/main/java/com/shadowstack/adapters`
- [JavaScript AST Engine](https://github.com/aryand2006/shadowstack/blob/main/packages/language-adapters/native-engines/js/ast_engine.mjs): `packages/language-adapters/native-engines/js/ast_engine.mjs`
- [Refactor Engine](https://github.com/aryand2006/shadowstack/blob/main/packages/refactor-engine/src/main/java/com/shadowstack/refactor/RefactorEngine.java): `packages/refactor-engine/src/main/java/com/shadowstack/refactor/RefactorEngine.java`

### Verification and Review

- [Verification Task](https://github.com/aryand2006/shadowstack/blob/main/apps/worker/src/main/java/com/shadowstack/worker/tasks/VerificationTask.java): `apps/worker/src/main/java/com/shadowstack/worker/tasks/VerificationTask.java`
- [Verification Pipeline](https://github.com/aryand2006/shadowstack/blob/main/packages/verify-engine/src/main/java/com/shadowstack/verify/VerificationPipeline.java): `packages/verify-engine/src/main/java/com/shadowstack/verify/VerificationPipeline.java`
- [Human Review](https://github.com/aryand2006/shadowstack/blob/main/apps/api/src/main/java/com/shadowstack/api/service/ReviewService.java): `apps/api/src/main/java/com/shadowstack/api/service/ReviewService.java`

### Migration Intelligence

- [Analytics](https://github.com/aryand2006/shadowstack/blob/main/packages/migration-corpus/src/main/java/com/shadowstack/corpus/CorpusAnalytics.java): `packages/migration-corpus/src/main/java/com/shadowstack/corpus/CorpusAnalytics.java`
- [Migration Corpus](https://github.com/aryand2006/shadowstack/blob/main/packages/migration-corpus/src/main/java/com/shadowstack/corpus/MigrationCorpusService.java): `packages/migration-corpus/src/main/java/com/shadowstack/corpus/MigrationCorpusService.java`
- [Audit Logging](https://github.com/aryand2006/shadowstack/blob/main/packages/migration-corpus/src/main/java/com/shadowstack/corpus/AuditService.java): `packages/migration-corpus/src/main/java/com/shadowstack/corpus/AuditService.java`
- [Corpus Store](https://github.com/aryand2006/shadowstack/blob/main/packages/migration-corpus/src/main/java/com/shadowstack/corpus/MigrationCorpusRepository.java): `packages/migration-corpus/src/main/java/com/shadowstack/corpus/MigrationCorpusRepository.java`
- [Embedding Retrieval](https://github.com/aryand2006/shadowstack/blob/main/packages/embedder/src/shadowstack_embedder/retrieval.py): `packages/embedder/src/shadowstack_embedder/retrieval.py`

### Other components

- **Developer**
- **PostgreSQL**

## Connections

- Developer → Workbench UI: submits work
- Workbench UI → REST API: sends requests
- REST API → Refactor Orchestration: dispatches work
- Refactor Orchestration → Job Worker: enqueues jobs
- Job Worker → Baseline Capture: captures baseline
- Baseline Capture → Static Analysis: provides snapshot (evidence: `README.md`)
- Static Analysis → Language Adapters: models semantics (evidence: `README.md`)
- Language Adapters → Refactor Engine: produces candidates (evidence: `README.md`)
- Refactor Engine → Verification Pipeline: submits patches (evidence: `README.md`)
- Job Worker → Verification Task: runs task
- Verification Task → Verification Pipeline: verifies patch
- Verification Pipeline → Human Review: gates review (evidence: `README.md`)
- REST API → Human Review: serves decisions (evidence: `apps/api/src/main/java/com/shadowstack/api/controllers/ReviewController.java`)
- Human Review → Refactor Orchestration: loads patches (evidence: `apps/api/src/main/java/com/shadowstack/api/service/ReviewService.java`)
- Review Queue UI → REST API: requests review
- Human Review → Migration Corpus: records outcomes
- Human Review → Audit Logging: records actions
- Migration Corpus → Corpus Store: queries entries (evidence: `packages/migration-corpus/src/main/java/com/shadowstack/corpus/MigrationCorpusService.java`)
- Migration Corpus → Analytics: builds metrics (evidence: `packages/migration-corpus/src/main/java/com/shadowstack/corpus/MigrationCorpusService.java`)
- Corpus Store → PostgreSQL: persists records
- Embedding Retrieval → Migration Corpus: retrieves similar
- Language Adapters → JavaScript AST Engine: uses AST engine
