# sanjaybtechaids-ai/brandguard_1 architecture

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

- Interactive diagram: https://gitdiagram.com/sanjaybtechaids-ai/brandguard_1
- Repository: https://github.com/sanjaybtechaids-ai/brandguard_1

## Overview

BrandGuard AI is a multi-tenant digital risk protection application. Analysts enroll trusted brand identities, discover and compare suspicious apps, domains, and social accounts, assess risk, then investigate and remediate threats through dashboards and reports. The README documents the overall detection sequence; the source index and excerpts support several API-to-service and service-to-engine links. Some UI and provider wiring is documented but not sampled, so those relationships are identified as documented rather than inferred from folder structure.

Main entry points: [`src/app/api/brands/route.ts`](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/app/api/brands/route.ts) (Product API routes), [`src/services/brand-discovery.service.ts`](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/brand-discovery.service.ts) (Brand discovery), [`src/services/url-verification.service.ts`](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/url-verification.service.ts) (URL verification), [`src/services/brands.service.ts`](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/brands.service.ts) (Brand profiles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Analyst experience"]
  node_workbench["SOC workbench<br/>[page.tsx]"]
  node_brand_ui["Brand enrollment<br/>[BrandDiscovery.tsx]"]
  node_threat_ui["Threat investigation<br/>[page.tsx]"]
  node_reports_ui["Reports and alerts<br/>[page.tsx]"]
end

subgraph group_api["API access"]
  node_api_routes["Product API routes<br/>[route.ts]"]
end

subgraph group_identity["Brand identity and discovery"]
  node_brand_service["Brand profiles<br/>[brands.service.ts]"]
  node_discovery["Brand discovery"]
  node_providers["Discovery providers<br/>[brand.provider.ts]"]
  node_official_records["Official app records<br/>[apps.ts]"]
end

subgraph group_analysis["Risk analysis"]
  node_risk_engine["Risk scoring<br/>[risk-engine.ts]"]
  node_normalization["Domain normalization<br/>[normalization.ts]"]
  node_url_service["URL verification"]
  node_app_service["App monitoring<br/>[apps.service.ts]"]
end

subgraph group_operations["Threat operations"]
  node_threat_service["Threat management<br/>[threats.service.ts]"]
  node_report_service["Report generation<br/>[reports.service.ts]"]
  node_alert_service["Security alerts<br/>[alerts.service.ts]"]
  node_supabase[("Supabase data store<br/>[server.ts]")]
end

node_analyst(("Security analyst"))

node_analyst -->|"uses"| node_workbench
node_analyst -->|"enrolls brands"| node_brand_ui
node_analyst -->|"investigates"| node_threat_ui
node_analyst -->|"reviews"| node_reports_ui
node_brand_ui -.->|"submits identity"| node_api_routes
node_api_routes -->|"manages brands"| node_brand_service
node_api_routes -->|"starts discovery"| node_discovery
node_api_routes -->|"serves app data"| node_app_service
node_api_routes -->|"verifies URLs"| node_url_service
node_api_routes -->|"serves threats"| node_threat_service
node_api_routes -->|"serves reports"| node_report_service
node_api_routes -->|"serves alerts"| node_alert_service
node_discovery -->|"queries sources"| node_providers
node_discovery -->|"evaluates candidates"| node_risk_engine
node_discovery -->|"uses profiles"| node_brand_service
node_app_service -->|"loads fallback data"| node_official_records
node_app_service -->|"resolves brand"| node_brand_service
node_url_service -->|"scores URL"| node_risk_engine
node_url_service -->|"normalizes input"| node_normalization
node_risk_engine -->|"normalizes signals"| node_normalization
node_url_service -->|"records findings"| node_threat_service
node_threat_ui -.->|"reviews cases"| node_threat_service
node_reports_ui -.->|"requests dossiers"| node_report_service
node_brand_service -->|"reads and writes"| node_supabase
node_discovery -->|"persists results"| node_supabase
node_threat_service -->|"reads and writes"| node_supabase

click node_workbench "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/app/dashboard/page.tsx"
click node_brand_ui "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/components/brands/BrandDiscovery.tsx"
click node_threat_ui "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/app/threats/%5Bid%5D/page.tsx"
click node_reports_ui "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/app/reports/page.tsx"
click node_api_routes "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/app/api/brands/route.ts"
click node_brand_service "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/brands.service.ts"
click node_discovery "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/brand-discovery.service.ts"
click node_providers "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/providers/brand.provider.ts"
click node_official_records "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/data/apps.ts"
click node_risk_engine "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/lib/risk/risk-engine.ts"
click node_normalization "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/lib/risk/normalization.ts"
click node_url_service "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/url-verification.service.ts"
click node_app_service "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/apps.service.ts"
click node_threat_service "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/threats.service.ts"
click node_report_service "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/reports.service.ts"
click node_alert_service "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/alerts.service.ts"
click node_supabase "https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/lib/supabase/server.ts"

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_workbench,node_brand_ui,node_threat_ui,node_reports_ui toneBlue
class node_api_routes toneAmber
class node_brand_service,node_discovery,node_providers,node_official_records toneMint
class node_risk_engine,node_normalization,node_url_service,node_app_service toneRose
class node_threat_service,node_report_service,node_alert_service,node_supabase,node_analyst toneIndigo
```

## Components

### Analyst experience

- [SOC workbench](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Brand enrollment](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/components/brands/BrandDiscovery.tsx): `src/components/brands/BrandDiscovery.tsx`
- [Threat investigation](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/app/threats/%5Bid%5D/page.tsx): `src/app/threats/[id]/page.tsx`
- [Reports and alerts](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/app/reports/page.tsx): `src/app/reports/page.tsx`

### API access

- [Product API routes](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/app/api/brands/route.ts): `src/app/api/brands/route.ts`

### Brand identity and discovery

- [Brand profiles](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/brands.service.ts): `src/services/brands.service.ts`
- [Brand discovery](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/brand-discovery.service.ts): `src/services/brand-discovery.service.ts`
- [Discovery providers](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/providers/brand.provider.ts): `src/providers/brand.provider.ts`
- [Official app records](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/data/apps.ts): `src/data/apps.ts`

### Risk analysis

- [Risk scoring](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/lib/risk/risk-engine.ts): `src/lib/risk/risk-engine.ts`
- [Domain normalization](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/lib/risk/normalization.ts): `src/lib/risk/normalization.ts`
- [URL verification](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/url-verification.service.ts): `src/services/url-verification.service.ts`
- [App monitoring](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/apps.service.ts): `src/services/apps.service.ts`

### Threat operations

- [Threat management](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/threats.service.ts): `src/services/threats.service.ts`
- [Report generation](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/reports.service.ts): `src/services/reports.service.ts`
- [Security alerts](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/services/alerts.service.ts): `src/services/alerts.service.ts`
- [Supabase data store](https://github.com/sanjaybtechaids-ai/brandguard_1/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`

### Other components

- **Security analyst**

## Connections

- Security analyst → SOC workbench: uses (evidence: `README.md`)
- Security analyst → Brand enrollment: enrolls brands (evidence: `README.md`)
- Security analyst → Threat investigation: investigates (evidence: `README.md`)
- Security analyst → Reports and alerts: reviews (evidence: `README.md`)
- Brand enrollment → Product API routes: submits identity
- Product API routes → Brand profiles: manages brands (evidence: `src/app/api/brands/route.ts`)
- Product API routes → Brand discovery: starts discovery
- Product API routes → App monitoring: serves app data
- Product API routes → URL verification: verifies URLs
- Product API routes → Threat management: serves threats
- Product API routes → Report generation: serves reports
- Product API routes → Security alerts: serves alerts
- Brand discovery → Discovery providers: queries sources (evidence: `src/services/brand-discovery.service.ts`)
- Brand discovery → Risk scoring: evaluates candidates (evidence: `src/services/brand-discovery.service.ts`)
- Brand discovery → Brand profiles: uses profiles (evidence: `src/services/brand-discovery.service.ts`)
- App monitoring → Official app records: loads fallback data (evidence: `src/services/apps.service.ts`)
- App monitoring → Brand profiles: resolves brand (evidence: `src/services/apps.service.ts`)
- URL verification → Risk scoring: scores URL (evidence: `src/services/url-verification.service.ts`)
- URL verification → Domain normalization: normalizes input (evidence: `src/services/url-verification.service.ts`)
- Risk scoring → Domain normalization: normalizes signals (evidence: `src/lib/risk/risk-engine.ts`)
- URL verification → Threat management: records findings (evidence: `src/services/url-verification.service.ts`)
- Threat investigation → Threat management: reviews cases
- Reports and alerts → Report generation: requests dossiers
- Brand profiles → Supabase data store: reads and writes (evidence: `src/services/brands.service.ts`)
- Brand discovery → Supabase data store: persists results (evidence: `src/services/brand-discovery.service.ts`)
- Threat management → Supabase data store: reads and writes (evidence: `src/services/threats.service.ts`)
