# yashodhar-exe/byte-guard architecture

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

- Interactive diagram: https://gitdiagram.com/yashodhar-exe/byte-guard
- Repository: https://github.com/yashodhar-exe/byte-guard

## Overview

Byte Guard is a digital risk protection prototype for investigating possible brand impersonation across social profiles, app listings, and web sources. Analysts configure brands and trusted official assets, launch scans, inspect findings and evidence, and review findings; the product explicitly does not take down or contact third-party accounts. The React app supports either a synthetic demo workspace or a Supabase-backed workspace, with a Supabase Edge Function responsible for live scan orchestration. The scan implementation and migrations were not excerpted, so their internal data-flow details are not expanded here.

Main entry points: [`src/App.tsx`](https://github.com/yashodhar-exe/byte-guard/blob/main/src/App.tsx) (App and routes), [`src/data/workspace.tsx`](https://github.com/yashodhar-exe/byte-guard/blob/main/src/data/workspace.tsx) (Workspace state), [`src/lib/supabase.ts`](https://github.com/yashodhar-exe/byte-guard/blob/main/src/lib/supabase.ts) (Supabase client), [`src/components/auth.tsx`](https://github.com/yashodhar-exe/byte-guard/blob/main/src/components/auth.tsx) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_app["App and routes<br/>[App.tsx]"]
  node_auth["Authentication<br/>[auth.tsx]"]
  node_layout["Application shell<br/>[layout.tsx]"]
  node_ui["Shared UI<br/>[ui.tsx]"]
end

subgraph group_workspace["Workspace and brands"]
  node_workspace["Workspace state<br/>[workspace.tsx]"]
  node_demo["Demo workspace<br/>[demo-data.ts]"]
  node_brands["Brand assets<br/>[brands.tsx]"]
  node_settings["Workspace settings<br/>[settings.tsx]"]
end

subgraph group_investigation["Monitoring and review"]
  node_monitor["Source monitoring<br/>[monitor.tsx]"]
  node_dashboard["Risk dashboard<br/>[dashboard.tsx]"]
  node_findings["Findings review<br/>[findings.tsx]"]
  node_engine["Heuristic detection<br/>[engine.ts]"]
end

subgraph group_backend["Live scan backend"]
  node_supabase["Supabase client<br/>[supabase.ts]"]
  node_scan["Live scan orchestrator<br/>[index.ts]"]
  node_schema[("Workspace schema")]
end

node_analyst(("Analyst"))
node_providers["Discovery providers"]

node_analyst -->|"uses"| node_app
node_app -->|"routes to"| node_auth
node_app -->|"provides"| node_workspace
node_app -->|"renders"| node_layout
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_brands
node_app -->|"routes to"| node_monitor
node_app -->|"routes to"| node_findings
node_app -->|"routes to"| node_settings
node_auth -->|"authenticates with"| node_supabase
node_workspace -->|"loads"| node_demo
node_workspace -->|"reads and writes"| node_supabase
node_brands -->|"creates assets"| node_workspace
node_monitor -->|"reads scans"| node_workspace
node_dashboard -->|"reads summary"| node_workspace
node_findings -->|"reviews findings"| node_workspace
node_workspace -->|"invokes"| node_scan
node_supabase -.->|"uses project data"| node_schema
node_scan -.->|"uses adapters"| node_providers

click node_app "https://github.com/yashodhar-exe/byte-guard/blob/main/src/App.tsx"
click node_auth "https://github.com/yashodhar-exe/byte-guard/blob/main/src/components/auth.tsx"
click node_layout "https://github.com/yashodhar-exe/byte-guard/blob/main/src/components/layout.tsx"
click node_ui "https://github.com/yashodhar-exe/byte-guard/blob/main/src/components/ui.tsx"
click node_workspace "https://github.com/yashodhar-exe/byte-guard/blob/main/src/data/workspace.tsx"
click node_demo "https://github.com/yashodhar-exe/byte-guard/blob/main/src/data/demo-data.ts"
click node_brands "https://github.com/yashodhar-exe/byte-guard/blob/main/src/pages/brands.tsx"
click node_settings "https://github.com/yashodhar-exe/byte-guard/blob/main/src/pages/settings.tsx"
click node_monitor "https://github.com/yashodhar-exe/byte-guard/blob/main/src/pages/monitor.tsx"
click node_dashboard "https://github.com/yashodhar-exe/byte-guard/blob/main/src/pages/dashboard.tsx"
click node_findings "https://github.com/yashodhar-exe/byte-guard/blob/main/src/pages/findings.tsx"
click node_engine "https://github.com/yashodhar-exe/byte-guard/blob/main/src/detection/engine.ts"
click node_supabase "https://github.com/yashodhar-exe/byte-guard/blob/main/src/lib/supabase.ts"
click node_scan "https://github.com/yashodhar-exe/byte-guard/blob/main/supabase/functions/scan-brand/index.ts"
click node_schema "https://github.com/yashodhar-exe/byte-guard/tree/main/supabase/migrations"

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_app,node_auth,node_layout,node_ui toneBlue
class node_workspace,node_demo,node_brands,node_settings toneAmber
class node_monitor,node_dashboard,node_findings,node_engine toneMint
class node_supabase,node_scan,node_schema toneRose
class node_analyst,node_providers toneIndigo
```

## Components

### Application

- [App and routes](https://github.com/yashodhar-exe/byte-guard/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/yashodhar-exe/byte-guard/blob/main/src/components/auth.tsx): `src/components/auth.tsx`
- [Application shell](https://github.com/yashodhar-exe/byte-guard/blob/main/src/components/layout.tsx): `src/components/layout.tsx`
- [Shared UI](https://github.com/yashodhar-exe/byte-guard/blob/main/src/components/ui.tsx): `src/components/ui.tsx`

### Workspace and brands

- [Workspace state](https://github.com/yashodhar-exe/byte-guard/blob/main/src/data/workspace.tsx): `src/data/workspace.tsx`
- [Demo workspace](https://github.com/yashodhar-exe/byte-guard/blob/main/src/data/demo-data.ts): `src/data/demo-data.ts`
- [Brand assets](https://github.com/yashodhar-exe/byte-guard/blob/main/src/pages/brands.tsx): `src/pages/brands.tsx`
- [Workspace settings](https://github.com/yashodhar-exe/byte-guard/blob/main/src/pages/settings.tsx): `src/pages/settings.tsx`

### Monitoring and review

- [Source monitoring](https://github.com/yashodhar-exe/byte-guard/blob/main/src/pages/monitor.tsx): `src/pages/monitor.tsx`
- [Risk dashboard](https://github.com/yashodhar-exe/byte-guard/blob/main/src/pages/dashboard.tsx): `src/pages/dashboard.tsx`
- [Findings review](https://github.com/yashodhar-exe/byte-guard/blob/main/src/pages/findings.tsx): `src/pages/findings.tsx`
- [Heuristic detection](https://github.com/yashodhar-exe/byte-guard/blob/main/src/detection/engine.ts): `src/detection/engine.ts`

### Live scan backend

- [Supabase client](https://github.com/yashodhar-exe/byte-guard/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Live scan orchestrator](https://github.com/yashodhar-exe/byte-guard/blob/main/supabase/functions/scan-brand/index.ts): `supabase/functions/scan-brand/index.ts`
- [Workspace schema](https://github.com/yashodhar-exe/byte-guard/tree/main/supabase/migrations): `supabase/migrations`

### Other components

- **Analyst**
- **Discovery providers**

## Connections

- Analyst → App and routes: uses (evidence: `README.md`)
- App and routes → Authentication: routes to (evidence: `src/App.tsx`)
- App and routes → Workspace state: provides (evidence: `src/App.tsx`)
- App and routes → Application shell: renders (evidence: `src/App.tsx`)
- App and routes → Risk dashboard: routes to (evidence: `src/App.tsx`)
- App and routes → Brand assets: routes to (evidence: `src/App.tsx`)
- App and routes → Source monitoring: routes to (evidence: `src/App.tsx`)
- App and routes → Findings review: routes to (evidence: `src/App.tsx`)
- App and routes → Workspace settings: routes to (evidence: `src/App.tsx`)
- Authentication → Supabase client: authenticates with (evidence: `src/components/auth.tsx`)
- Workspace state → Demo workspace: loads (evidence: `src/data/workspace.tsx`)
- Workspace state → Supabase client: reads and writes (evidence: `src/data/workspace.tsx`)
- Brand assets → Workspace state: creates assets (evidence: `src/pages/brands.tsx`)
- Source monitoring → Workspace state: reads scans (evidence: `src/pages/monitor.tsx`)
- Risk dashboard → Workspace state: reads summary (evidence: `src/pages/dashboard.tsx`)
- Findings review → Workspace state: reviews findings (evidence: `src/pages/findings.tsx`)
- Workspace state → Live scan orchestrator: invokes (evidence: `src/data/workspace.tsx`)
- Supabase client → Workspace schema: uses project data (evidence: `README.md`)
- Live scan orchestrator → Discovery providers: uses adapters (evidence: `README.md`)
