# revylai/greenlight architecture

> Architecture diagram of the GitHub repository revylai/greenlight, 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/revylai/greenlight
- Repository: https://github.com/revylai/greenlight

## Overview

Greenlight is a mobile-app store compliance scanner: its main workflow runs applicable static checks over project source and optional build artifacts, combines findings, then formats a report and CI gate result. The README also documents App Store Connect metadata checks and an optional cloud-device verification tier. Edges below follow sampled calls or explicit README descriptions; several scanner internals and CLI wiring are not shown, so their relations are omitted where unsupported.

Main entry points: [`internal/preflight/runner.go`](https://github.com/revylai/greenlight/blob/main/internal/preflight/runner.go) (Static scan orchestrator), [`internal/verify/runner.go`](https://github.com/revylai/greenlight/blob/main/internal/verify/runner.go) (Flow verification runner), [`internal/playscan/scanner.go`](https://github.com/revylai/greenlight/blob/main/internal/playscan/scanner.go) (Android policy scan), [`internal/cli/preflight.go`](https://github.com/revylai/greenlight/blob/main/internal/cli/preflight.go) (Preflight command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_main["Executable entry<br/>[main.go]"]
  node_cli["Command interface<br/>[root.go]"]
  node_preflight_cli["Preflight command<br/>[preflight.go]"]
  node_codescan_cli["Codescan command<br/>[codescan.go]"]
  node_playscan_cli["Playscan command<br/>[playscan.go]"]
  node_auth_cli["Authentication commands<br/>[auth.go]"]
  node_verify_cli["Verify command<br/>[verify.go]"]
end

subgraph group_static["Offline compliance"]
  node_preflight["Static scan orchestrator<br/>[runner.go]"]
  node_metadata["Local metadata checks<br/>[metadata.go]"]
  node_codescan["Source rules scan<br/>[scanner.go]"]
  node_privacy["Privacy manifest scan<br/>[scanner.go]"]
  node_playscan["Android policy scan<br/>[scanner.go]"]
  node_android_archive["Android archive analysis<br/>[archive.go]"]
  node_ipa["IPA inspection<br/>[inspect.go]"]
end

subgraph group_apple["Apple Connect checks"]
  node_asc_runner["App Store check runner<br/>[runner.go]"]
  node_asc_checks["Metadata and content checks<br/>[tier1_metadata.go]"]
  node_asc_api["App Store Connect client<br/>[client.go]"]
end

subgraph group_runtime["Runtime verification"]
  node_verify_runner["Flow verification runner<br/>[runner.go]"]
  node_flow_specs["Flow definitions<br/>[flows.go]"]
  node_revyl{{"Revyl device service<br/>[client.go]"}}
end

subgraph group_output["Findings and reports"]
  node_findings["Unified findings<br/>[runner.go]"]
  node_report["Static report output<br/>[preflight.go]"]
  node_sarif["SARIF encoding<br/>[sarif.go]"]
end

node_user(("App developer"))
node_project["App project"]
node_asc_service{{"App Store Connect"}}

node_user -->|"runs"| node_main
node_main -->|"executes"| node_cli
node_user -->|"requests scan"| node_preflight_cli
node_preflight_cli -->|"runs"| node_preflight
node_preflight_cli -->|"optionally runs"| node_verify_runner
node_user -->|"requests scan"| node_codescan_cli
node_codescan_cli -->|"invokes"| node_codescan
node_user -->|"requests scan"| node_playscan_cli
node_playscan_cli -->|"invokes"| node_playscan
node_user -->|"manages access"| node_auth_cli
node_auth_cli -->|"authenticates"| node_asc_api
node_project -->|"scans"| node_preflight
node_preflight -->|"runs"| node_metadata
node_preflight -->|"runs"| node_codescan
node_preflight -->|"runs"| node_privacy
node_preflight -->|"runs"| node_playscan
node_preflight -->|"runs"| node_ipa
node_project -->|"provides source"| node_codescan
node_project -->|"provides manifests"| node_privacy
node_project -->|"provides Android inputs"| node_playscan
node_project -->|"provides optional archive"| node_android_archive
node_playscan -.->|"analyzes archive"| node_android_archive
node_preflight -->|"aggregates"| node_findings
node_project -.->|"checks submission"| node_asc_runner
node_asc_runner -->|"executes"| node_asc_checks
node_asc_checks -->|"queries metadata"| node_asc_api
node_asc_api -.->|"requests data"| node_asc_service
node_findings -->|"formats"| node_report
node_report -->|"encodes SARIF"| node_sarif
node_user -->|"requests verification"| node_verify_cli
node_verify_cli -->|"runs"| node_verify_runner
node_verify_runner -->|"selects flows"| node_flow_specs
node_verify_runner -->|"dispatches device runs"| node_revyl
node_project -->|"supplies app"| node_verify_runner

click node_main "https://github.com/revylai/greenlight/blob/main/cmd/greenlight/main.go"
click node_cli "https://github.com/revylai/greenlight/blob/main/internal/cli/root.go"
click node_preflight_cli "https://github.com/revylai/greenlight/blob/main/internal/cli/preflight.go"
click node_codescan_cli "https://github.com/revylai/greenlight/blob/main/internal/cli/codescan.go"
click node_playscan_cli "https://github.com/revylai/greenlight/blob/main/internal/cli/playscan.go"
click node_auth_cli "https://github.com/revylai/greenlight/blob/main/internal/cli/auth.go"
click node_preflight "https://github.com/revylai/greenlight/blob/main/internal/preflight/runner.go"
click node_metadata "https://github.com/revylai/greenlight/blob/main/internal/preflight/metadata.go"
click node_codescan "https://github.com/revylai/greenlight/blob/main/internal/codescan/scanner.go"
click node_privacy "https://github.com/revylai/greenlight/blob/main/internal/privacy/scanner.go"
click node_playscan "https://github.com/revylai/greenlight/blob/main/internal/playscan/scanner.go"
click node_android_archive "https://github.com/revylai/greenlight/blob/main/internal/playscan/archive.go"
click node_ipa "https://github.com/revylai/greenlight/blob/main/internal/ipa/inspect.go"
click node_asc_runner "https://github.com/revylai/greenlight/blob/main/internal/checks/runner.go"
click node_asc_checks "https://github.com/revylai/greenlight/blob/main/internal/checks/tier1_metadata.go"
click node_asc_api "https://github.com/revylai/greenlight/blob/main/internal/asc/client.go"
click node_verify_cli "https://github.com/revylai/greenlight/blob/main/internal/cli/verify.go"
click node_verify_runner "https://github.com/revylai/greenlight/blob/main/internal/verify/runner.go"
click node_flow_specs "https://github.com/revylai/greenlight/blob/main/internal/verify/flows.go"
click node_revyl "https://github.com/revylai/greenlight/blob/main/internal/revyl/client.go"
click node_findings "https://github.com/revylai/greenlight/blob/main/internal/preflight/runner.go"
click node_report "https://github.com/revylai/greenlight/blob/main/internal/cli/preflight.go"
click node_sarif "https://github.com/revylai/greenlight/blob/main/internal/sarif/sarif.go"

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_cli,node_preflight_cli,node_codescan_cli,node_playscan_cli,node_auth_cli,node_verify_cli toneBlue
class node_preflight,node_metadata,node_codescan,node_privacy,node_playscan,node_android_archive,node_ipa toneAmber
class node_asc_runner,node_asc_checks,node_asc_api toneMint
class node_verify_runner,node_flow_specs,node_revyl toneRose
class node_findings,node_report,node_sarif,node_user,node_project,node_asc_service toneIndigo
```

## Components

### CLI entry

- [Executable entry](https://github.com/revylai/greenlight/blob/main/cmd/greenlight/main.go): `cmd/greenlight/main.go`
- [Command interface](https://github.com/revylai/greenlight/blob/main/internal/cli/root.go): `internal/cli/root.go`
- [Preflight command](https://github.com/revylai/greenlight/blob/main/internal/cli/preflight.go): `internal/cli/preflight.go`
- [Codescan command](https://github.com/revylai/greenlight/blob/main/internal/cli/codescan.go): `internal/cli/codescan.go`
- [Playscan command](https://github.com/revylai/greenlight/blob/main/internal/cli/playscan.go): `internal/cli/playscan.go`
- [Authentication commands](https://github.com/revylai/greenlight/blob/main/internal/cli/auth.go): `internal/cli/auth.go`
- [Verify command](https://github.com/revylai/greenlight/blob/main/internal/cli/verify.go): `internal/cli/verify.go`

### Offline compliance

- [Static scan orchestrator](https://github.com/revylai/greenlight/blob/main/internal/preflight/runner.go): `internal/preflight/runner.go`
- [Local metadata checks](https://github.com/revylai/greenlight/blob/main/internal/preflight/metadata.go): `internal/preflight/metadata.go`
- [Source rules scan](https://github.com/revylai/greenlight/blob/main/internal/codescan/scanner.go): `internal/codescan/scanner.go`
- [Privacy manifest scan](https://github.com/revylai/greenlight/blob/main/internal/privacy/scanner.go): `internal/privacy/scanner.go`
- [Android policy scan](https://github.com/revylai/greenlight/blob/main/internal/playscan/scanner.go): `internal/playscan/scanner.go`
- [Android archive analysis](https://github.com/revylai/greenlight/blob/main/internal/playscan/archive.go): `internal/playscan/archive.go`
- [IPA inspection](https://github.com/revylai/greenlight/blob/main/internal/ipa/inspect.go): `internal/ipa/inspect.go`

### Apple Connect checks

- [App Store check runner](https://github.com/revylai/greenlight/blob/main/internal/checks/runner.go): `internal/checks/runner.go`
- [Metadata and content checks](https://github.com/revylai/greenlight/blob/main/internal/checks/tier1_metadata.go): `internal/checks/tier1_metadata.go`
- [App Store Connect client](https://github.com/revylai/greenlight/blob/main/internal/asc/client.go): `internal/asc/client.go`

### Runtime verification

- [Flow verification runner](https://github.com/revylai/greenlight/blob/main/internal/verify/runner.go): `internal/verify/runner.go`
- [Flow definitions](https://github.com/revylai/greenlight/blob/main/internal/verify/flows.go): `internal/verify/flows.go`
- [Revyl device service](https://github.com/revylai/greenlight/blob/main/internal/revyl/client.go): `internal/revyl/client.go`

### Findings and reports

- [Unified findings](https://github.com/revylai/greenlight/blob/main/internal/preflight/runner.go): `internal/preflight/runner.go`
- [Static report output](https://github.com/revylai/greenlight/blob/main/internal/cli/preflight.go): `internal/cli/preflight.go`
- [SARIF encoding](https://github.com/revylai/greenlight/blob/main/internal/sarif/sarif.go): `internal/sarif/sarif.go`

### Other components

- **App developer**
- **App project**
- **App Store Connect**

## Connections

- App developer → Executable entry: runs (evidence: `cmd/greenlight/main.go`)
- Executable entry → Command interface: executes (evidence: `cmd/greenlight/main.go`)
- App developer → Preflight command: requests scan
- Preflight command → Static scan orchestrator: runs (evidence: `internal/cli/preflight.go`)
- Preflight command → Flow verification runner: optionally runs (evidence: `internal/cli/preflight.go`)
- App developer → Codescan command: requests scan
- Codescan command → Source rules scan: invokes (evidence: `internal/cli/codescan.go`)
- App developer → Playscan command: requests scan
- Playscan command → Android policy scan: invokes (evidence: `internal/cli/playscan.go`)
- App developer → Authentication commands: manages access (evidence: `internal/cli/auth.go`)
- Authentication commands → App Store Connect client: authenticates (evidence: `internal/cli/auth.go`)
- App project → Static scan orchestrator: scans
- Static scan orchestrator → Local metadata checks: runs (evidence: `internal/preflight/runner.go`)
- Static scan orchestrator → Source rules scan: runs (evidence: `internal/preflight/runner.go`)
- Static scan orchestrator → Privacy manifest scan: runs (evidence: `internal/preflight/runner.go`)
- Static scan orchestrator → Android policy scan: runs (evidence: `internal/preflight/runner.go`)
- Static scan orchestrator → IPA inspection: runs (evidence: `internal/preflight/runner.go`)
- App project → Source rules scan: provides source
- App project → Privacy manifest scan: provides manifests
- App project → Android policy scan: provides Android inputs
- App project → Android archive analysis: provides optional archive
- Android policy scan → Android archive analysis: analyzes archive
- Static scan orchestrator → Unified findings: aggregates (evidence: `internal/preflight/runner.go`)
- App project → App Store check runner: checks submission
- App Store check runner → Metadata and content checks: executes (evidence: `internal/checks/runner.go`)
- Metadata and content checks → App Store Connect client: queries metadata
- App Store Connect client → App Store Connect: requests data
- Unified findings → Static report output: formats (evidence: `internal/cli/preflight.go`)
- Static report output → SARIF encoding: encodes SARIF (evidence: `internal/cli/preflight.go`)
- App developer → Verify command: requests verification
- Verify command → Flow verification runner: runs (evidence: `internal/cli/verify.go`)
- Flow verification runner → Flow definitions: selects flows (evidence: `internal/verify/flows.go`)
- Flow verification runner → Revyl device service: dispatches device runs (evidence: `internal/verify/runner.go`)
- App project → Flow verification runner: supplies app (evidence: `internal/verify/runner.go`)
