# mohamednasr18/rasd architecture

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

- Interactive diagram: https://gitdiagram.com/mohamednasr18/rasd
- Repository: https://github.com/mohamednasr18/rasd

## Overview

RASD is a website SEO auditing application: a visitor submits a site for scanning, reviews scan and page-level findings, can generate a report, and can ask a scan-specific SEO assistant questions. The backend also supports guest or account ownership and bilingual interactions. The graph includes documented scan, report, chat, and authentication stages plus their principal internal services. The README is empty; frontend-to-backend wiring and queue-worker handoffs are not established by the excerpts, so those links are omitted or marked unverified.

Main entry points: [`rasd-backend/src/prisma/prisma.service.ts`](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/prisma/prisma.service.ts) (Application database), [`rasd-backend/src/chat/chat.service.ts`](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/chat/chat.service.ts) (Chat orchestration), [`rasd-backend/src/seo/seo.controller.ts`](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/seo/seo.controller.ts) (Scan API), [`rasd-backend/src/auth/viewer.service.ts`](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/auth/viewer.service.ts) (Viewer access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_web["Audit interface<br/>[page.tsx]"]
  node_scan_view["Scan details<br/>[page.tsx]"]
  node_page_view["Page details<br/>[page.tsx]"]
  node_report_view["Report display<br/>[ReportSection.tsx]"]
  node_auth_view["Sign-in dialog<br/>[AuthDialog.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_auth_api["Authentication API<br/>[auth.controller.ts]"]
  node_auth_service["Authentication<br/>[auth.service.ts]"]
  node_viewer["Viewer access<br/>[viewer.service.ts]"]
end

subgraph group_scanning["SEO scanning"]
  node_seo_api["Scan API<br/>[seo.controller.ts]"]
  node_scan_manager["Scan orchestration<br/>[seo.service.ts]"]
  node_crawler["Site crawler"]
  node_analyzer["SEO analyzer"]
  node_sitemap["Sitemap parsing<br/>[sitemap.utils.ts]"]
end

subgraph group_reporting["Reports"]
  node_report_api["Report API"]
  node_report_manager["Report orchestration<br/>[report.service.ts]"]
  node_aggregator["Scan aggregation"]
  node_report_generator["Report generation"]
end

subgraph group_assistant["SEO assistant"]
  node_chat_api["Chat API<br/>[chat.controller.ts]"]
  node_chat_service["Chat orchestration<br/>[chat.service.ts]"]
  node_agent["Chat agent"]
  node_knowledge["Knowledge retrieval"]
end

subgraph group_platform["Persistence and jobs"]
  node_database[("Application database<br/>[prisma.service.ts]")]
  node_redis[("Redis connection")]
end

node_visitor(("Site owner"))

node_visitor -->|"uses"| node_web
node_visitor -->|"signs in"| node_auth_view
node_seo_api -->|"enqueues scans"| node_scan_manager
node_seo_api -->|"resolves access"| node_viewer
node_scan_manager -->|"crawls sites"| node_crawler
node_scan_manager -->|"stores scan data"| node_database
node_scan_manager -->|"uses connection"| node_redis
node_analyzer -->|"parses sitemaps"| node_sitemap
node_report_api -->|"requests reports"| node_report_manager
node_report_api -->|"checks access"| node_viewer
node_report_manager -->|"reads scan data"| node_database
node_aggregator -->|"reads scan data"| node_database
node_report_generator -->|"uses aggregation"| node_aggregator
node_chat_api -->|"sends messages"| node_chat_service
node_chat_api -->|"checks access"| node_viewer
node_chat_service -->|"invokes agent"| node_agent
node_chat_service -->|"retrieves guidance"| node_knowledge
node_chat_service -->|"builds context"| node_aggregator
node_chat_service -->|"reads conversations"| node_database
node_auth_api -->|"handles auth"| node_auth_service
node_auth_service -->|"uses viewer"| node_viewer
node_auth_service -->|"stores credentials"| node_database
node_viewer -->|"checks sessions"| node_database
node_web -.->|"submits scans"| node_seo_api
node_scan_view -.->|"loads scan"| node_seo_api
node_page_view -.->|"loads page"| node_seo_api
node_report_view -.->|"requests report"| node_report_api
node_auth_view -.->|"authenticates"| node_auth_api

click node_web "https://github.com/mohamednasr18/rasd/blob/main/rasd-frontend/src/app/%5Blang%5D/page.tsx"
click node_scan_view "https://github.com/mohamednasr18/rasd/blob/main/rasd-frontend/src/app/%5Blang%5D/scans/%5Bid%5D/page.tsx"
click node_page_view "https://github.com/mohamednasr18/rasd/blob/main/rasd-frontend/src/app/%5Blang%5D/scans/%5Bid%5D/pages/%5BpageId%5D/page.tsx"
click node_report_view "https://github.com/mohamednasr18/rasd/blob/main/rasd-frontend/src/components/ReportSection.tsx"
click node_auth_view "https://github.com/mohamednasr18/rasd/blob/main/rasd-frontend/src/components/auth/AuthDialog.tsx"
click node_seo_api "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/seo/seo.controller.ts"
click node_scan_manager "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/seo/seo.service.ts"
click node_crawler "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/seo/site-crawler.service.ts"
click node_analyzer "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/seo/seo-analyzer.service.ts"
click node_sitemap "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/seo/sitemap.utils.ts"
click node_report_api "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/report/report.controller.ts"
click node_report_manager "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/report/report.service.ts"
click node_aggregator "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/report/report-aggregator.service.ts"
click node_report_generator "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/report/report-generator.service.ts"
click node_chat_api "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/chat/chat.controller.ts"
click node_chat_service "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/chat/chat.service.ts"
click node_agent "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/chat/chat-agent.service.ts"
click node_knowledge "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/chat/knowledge-base.service.ts"
click node_auth_api "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/auth/auth.controller.ts"
click node_auth_service "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/auth/auth.service.ts"
click node_viewer "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/auth/viewer.service.ts"
click node_database "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/prisma/prisma.service.ts"
click node_redis "https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/redis-connection.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_web,node_scan_view,node_page_view,node_report_view,node_auth_view toneBlue
class node_auth_api,node_auth_service,node_viewer toneAmber
class node_seo_api,node_scan_manager,node_crawler,node_analyzer,node_sitemap toneMint
class node_report_api,node_report_manager,node_aggregator,node_report_generator toneRose
class node_chat_api,node_chat_service,node_agent,node_knowledge,node_visitor toneIndigo
class node_database,node_redis toneTeal
```

## Components

### Web interface

- [Audit interface](https://github.com/mohamednasr18/rasd/blob/main/rasd-frontend/src/app/%5Blang%5D/page.tsx): `rasd-frontend/src/app/[lang]/page.tsx`
- [Scan details](https://github.com/mohamednasr18/rasd/blob/main/rasd-frontend/src/app/%5Blang%5D/scans/%5Bid%5D/page.tsx): `rasd-frontend/src/app/[lang]/scans/[id]/page.tsx`
- [Page details](https://github.com/mohamednasr18/rasd/blob/main/rasd-frontend/src/app/%5Blang%5D/scans/%5Bid%5D/pages/%5BpageId%5D/page.tsx): `rasd-frontend/src/app/[lang]/scans/[id]/pages/[pageId]/page.tsx`
- [Report display](https://github.com/mohamednasr18/rasd/blob/main/rasd-frontend/src/components/ReportSection.tsx): `rasd-frontend/src/components/ReportSection.tsx`
- [Sign-in dialog](https://github.com/mohamednasr18/rasd/blob/main/rasd-frontend/src/components/auth/AuthDialog.tsx): `rasd-frontend/src/components/auth/AuthDialog.tsx`

### Identity and access

- [Authentication API](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/auth/auth.controller.ts): `rasd-backend/src/auth/auth.controller.ts`
- [Authentication](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/auth/auth.service.ts): `rasd-backend/src/auth/auth.service.ts`
- [Viewer access](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/auth/viewer.service.ts): `rasd-backend/src/auth/viewer.service.ts`

### SEO scanning

- [Scan API](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/seo/seo.controller.ts): `rasd-backend/src/seo/seo.controller.ts`
- [Scan orchestration](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/seo/seo.service.ts): `rasd-backend/src/seo/seo.service.ts`
- [Site crawler](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/seo/site-crawler.service.ts): `rasd-backend/src/seo/site-crawler.service.ts`
- [SEO analyzer](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/seo/seo-analyzer.service.ts): `rasd-backend/src/seo/seo-analyzer.service.ts`
- [Sitemap parsing](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/seo/sitemap.utils.ts): `rasd-backend/src/seo/sitemap.utils.ts`

### Reports

- [Report API](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/report/report.controller.ts): `rasd-backend/src/report/report.controller.ts`
- [Report orchestration](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/report/report.service.ts): `rasd-backend/src/report/report.service.ts`
- [Scan aggregation](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/report/report-aggregator.service.ts): `rasd-backend/src/report/report-aggregator.service.ts`
- [Report generation](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/report/report-generator.service.ts): `rasd-backend/src/report/report-generator.service.ts`

### SEO assistant

- [Chat API](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/chat/chat.controller.ts): `rasd-backend/src/chat/chat.controller.ts`
- [Chat orchestration](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/chat/chat.service.ts): `rasd-backend/src/chat/chat.service.ts`
- [Chat agent](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/chat/chat-agent.service.ts): `rasd-backend/src/chat/chat-agent.service.ts`
- [Knowledge retrieval](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/chat/knowledge-base.service.ts): `rasd-backend/src/chat/knowledge-base.service.ts`

### Persistence and jobs

- [Application database](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/prisma/prisma.service.ts): `rasd-backend/src/prisma/prisma.service.ts`
- [Redis connection](https://github.com/mohamednasr18/rasd/blob/main/rasd-backend/src/redis-connection.ts): `rasd-backend/src/redis-connection.ts`

### Other components

- **Site owner**

## Connections

- Site owner → Audit interface: uses
- Site owner → Sign-in dialog: signs in
- Scan API → Scan orchestration: enqueues scans (evidence: `rasd-backend/src/seo/seo.controller.ts`)
- Scan API → Viewer access: resolves access (evidence: `rasd-backend/src/seo/seo.controller.ts`)
- Scan orchestration → Site crawler: crawls sites (evidence: `rasd-backend/src/seo/seo.service.ts`)
- Scan orchestration → Application database: stores scan data (evidence: `rasd-backend/src/seo/seo.service.ts`)
- Scan orchestration → Redis connection: uses connection (evidence: `rasd-backend/src/seo/seo.service.ts`)
- SEO analyzer → Sitemap parsing: parses sitemaps (evidence: `rasd-backend/src/seo/seo-analyzer.service.ts`)
- Report API → Report orchestration: requests reports (evidence: `rasd-backend/src/report/report.controller.ts`)
- Report API → Viewer access: checks access (evidence: `rasd-backend/src/report/report.controller.ts`)
- Report orchestration → Application database: reads scan data (evidence: `rasd-backend/src/report/report.service.ts`)
- Scan aggregation → Application database: reads scan data (evidence: `rasd-backend/src/report/report-aggregator.service.ts`)
- Report generation → Scan aggregation: uses aggregation (evidence: `rasd-backend/src/report/report-generator.service.ts`)
- Chat API → Chat orchestration: sends messages (evidence: `rasd-backend/src/chat/chat.controller.ts`)
- Chat API → Viewer access: checks access (evidence: `rasd-backend/src/chat/chat.controller.ts`)
- Chat orchestration → Chat agent: invokes agent (evidence: `rasd-backend/src/chat/chat.service.ts`)
- Chat orchestration → Knowledge retrieval: retrieves guidance (evidence: `rasd-backend/src/chat/chat.service.ts`)
- Chat orchestration → Scan aggregation: builds context (evidence: `rasd-backend/src/chat/chat.service.ts`)
- Chat orchestration → Application database: reads conversations (evidence: `rasd-backend/src/chat/chat.service.ts`)
- Authentication API → Authentication: handles auth (evidence: `rasd-backend/src/auth/auth.controller.ts`)
- Authentication → Viewer access: uses viewer (evidence: `rasd-backend/src/auth/auth.service.ts`)
- Authentication → Application database: stores credentials (evidence: `rasd-backend/src/auth/auth.service.ts`)
- Viewer access → Application database: checks sessions (evidence: `rasd-backend/src/auth/viewer.service.ts`)
- Audit interface → Scan API: submits scans
- Scan details → Scan API: loads scan
- Page details → Scan API: loads page
- Report display → Report API: requests report
- Sign-in dialog → Authentication API: authenticates
