# yashkulshrestha1102/data-protection-galaxy architecture

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

- Interactive diagram: https://gitdiagram.com/yashkulshrestha1102/data-protection-galaxy
- Repository: https://github.com/yashkulshrestha1102/data-protection-galaxy

## Overview

Legal Galaxy is a data-protection information and self-service platform. Its visible user journeys include exploring country-law comparisons, taking a DPDPA certification course, and submitting assessments or tool inputs to receive emailed reports. The graph preserves the major content, resource, mapping, course, and report branches listed in the tree. Some pages and integrations were not sampled; those relationships are omitted or marked unverified rather than assumed.

Main entry points: [`app/map/page.tsx`](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/map/page.tsx) (Global law map), [`app/api/lead-capture/route.ts`](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/api/lead-capture/route.ts) (Lead and tool submissions), [`app/certificate-course/[...slug]/page.tsx`](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/certificate-course/%5B...slug%5D/page.tsx) (Module lessons), [`app/resources/page.tsx`](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/resources/page.tsx) (Insights and resources)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_home["Home and navigation<br/>[page.tsx]"]
end

subgraph group_knowledge["Law and resources"]
  node_country_pages["Country detail pages<br/>[page.tsx]"]
  node_map_page["Global law map<br/>[page.tsx]"]
  node_country_data[("Country law data<br/>[countries.ts]")]
  node_globe["3D globe<br/>[Globe3D.tsx]"]
  node_country_detail["Country detail panel<br/>[CountryDetail.tsx]"]
  node_legal_guidance["DPDPA guidance pages<br/>[page.tsx]"]
  node_content_hub["Insights and resources<br/>[page.tsx]"]
  node_insight_detail["Insight articles<br/>[page.tsx]"]
  node_insight_data[("Insight content<br/>[insights.ts]")]
  node_guide_data[("Guide content<br/>[guides.ts]")]
  node_case_data[("Case study content<br/>[case-studies.ts]")]
end

subgraph group_learning["Certification course"]
  node_course_catalog["Course catalog<br/>[page.tsx]"]
  node_course_lesson["Module lessons<br/>[page.tsx]"]
  node_course_quiz["Module quizzes<br/>[page.tsx]"]
  node_course_data[("Course modules<br/>[index.ts]")]
  node_lesson_completion["Lesson completion control"]
  node_certificate_api["Certificate result email<br/>[route.ts]"]
end

subgraph group_assessment["Assessments and reports"]
  node_scorecard["Compliance scorecard<br/>[page.tsx]"]
  node_score_api["Score report endpoint<br/>[route.ts]"]
  node_lead_api["Lead and tool submissions<br/>[route.ts]"]
  node_generator_page["Document generator<br/>[page.tsx]"]
end

subgraph group_services["Email and document services"]
  node_pdf_report["Assessment PDF report<br/>[PDFReport.tsx]"]
  node_pdf_generator["Tool PDF generation<br/>[pdf-generator.ts]"]
  node_inbound_api["Inbound email webhook<br/>[route.ts]"]
  node_email_worker["Email worker endpoint<br/>[route.ts]"]
  node_resend["Resend email service"]
  node_sheets[("Google Sheets")]
end

node_visitor(("Visitor"))
node_learner(("Learner"))

node_visitor -->|"opens"| node_home
node_visitor -->|"explores laws"| node_map_page
node_map_page -->|"filters and looks up"| node_country_data
node_map_page -->|"renders"| node_globe
node_map_page -->|"renders"| node_country_detail
node_country_detail -->|"reads"| node_country_data
node_visitor -->|"reads guidance"| node_legal_guidance
node_visitor -->|"browses resources"| node_content_hub
node_insight_detail -->|"reads article data"| node_insight_data
node_visitor -->|"reads article"| node_insight_detail
node_content_hub -.->|"uses guide content"| node_guide_data
node_content_hub -.->|"uses case studies"| node_case_data
node_learner -->|"starts course"| node_course_catalog
node_course_catalog -->|"loads modules"| node_course_data
node_course_lesson -->|"loads module"| node_course_data
node_course_lesson -->|"uses control"| node_lesson_completion
node_course_catalog -->|"links to lessons"| node_course_lesson
node_course_lesson -->|"links to quiz"| node_course_quiz
node_course_quiz -.->|"submits result"| node_certificate_api
node_visitor -->|"completes assessment"| node_scorecard
node_scorecard -.->|"requests report"| node_score_api
node_score_api -->|"renders PDF"| node_pdf_report
node_score_api -->|"emails report"| node_resend
node_visitor -->|"uses generator"| node_generator_page
node_generator_page -.->|"submits inputs"| node_lead_api
node_lead_api -->|"generates PDF"| node_pdf_generator
node_lead_api -->|"emails submission result"| node_resend
node_lead_api -->|"appends demo leads"| node_sheets
node_certificate_api -->|"emails result"| node_resend
node_inbound_api -->|"fetches received email"| node_resend
node_email_worker -.->|"processes queued mail"| node_resend

click node_home "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/page.tsx"
click node_country_pages "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/country/%5Bid%5D/page.tsx"
click node_map_page "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/map/page.tsx"
click node_country_data "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/data/countries.ts"
click node_globe "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/components/map/Globe3D.tsx"
click node_country_detail "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/components/map/CountryDetail.tsx"
click node_legal_guidance "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/obligations/page.tsx"
click node_content_hub "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/resources/page.tsx"
click node_insight_detail "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/insight/%5Bslug%5D/page.tsx"
click node_insight_data "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/data/insights.ts"
click node_guide_data "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/data/guides.ts"
click node_case_data "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/data/case-studies.ts"
click node_course_catalog "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/certificate-course/page.tsx"
click node_course_lesson "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/certificate-course/%5B...slug%5D/page.tsx"
click node_course_quiz "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/certificate-course/%5BmoduleId%5D/quiz/page.tsx"
click node_course_data "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/data/modules/index.ts"
click node_lesson_completion "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/components/certificate-course/CompleteLessonButton.tsx"
click node_scorecard "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/scorecard/page.tsx"
click node_score_api "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/api/score-report/route.ts"
click node_lead_api "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/api/lead-capture/route.ts"
click node_generator_page "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/generator/page.tsx"
click node_pdf_report "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/components/generator/PDFReport.tsx"
click node_pdf_generator "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/lib/pdf-generator.ts"
click node_certificate_api "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/api/send-result/route.ts"
click node_inbound_api "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/api/inbound/route.ts"
click node_email_worker "https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/api/email-worker/route.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_home toneBlue
class node_country_pages,node_map_page,node_country_data,node_globe,node_country_detail,node_legal_guidance,node_content_hub,node_insight_detail,node_insight_data,node_guide_data,node_case_data toneAmber
class node_course_catalog,node_course_lesson,node_course_quiz,node_course_data,node_lesson_completion,node_certificate_api toneMint
class node_scorecard,node_score_api,node_lead_api,node_generator_page toneRose
class node_pdf_report,node_pdf_generator,node_inbound_api,node_email_worker,node_resend,node_sheets,node_visitor,node_learner toneIndigo
```

## Components

### Web experience

- [Home and navigation](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/page.tsx): `app/page.tsx`

### Law and resources

- [Country detail pages](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/country/%5Bid%5D/page.tsx): `app/country/[id]/page.tsx`
- [Global law map](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/map/page.tsx): `app/map/page.tsx`
- [Country law data](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/data/countries.ts): `data/countries.ts`
- [3D globe](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/components/map/Globe3D.tsx): `components/map/Globe3D.tsx`
- [Country detail panel](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/components/map/CountryDetail.tsx): `components/map/CountryDetail.tsx`
- [DPDPA guidance pages](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/obligations/page.tsx): `app/obligations/page.tsx`
- [Insights and resources](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/resources/page.tsx): `app/resources/page.tsx`
- [Insight articles](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/insight/%5Bslug%5D/page.tsx): `app/insight/[slug]/page.tsx`
- [Insight content](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/data/insights.ts): `data/insights.ts`
- [Guide content](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/data/guides.ts): `data/guides.ts`
- [Case study content](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/data/case-studies.ts): `data/case-studies.ts`

### Certification course

- [Course catalog](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/certificate-course/page.tsx): `app/certificate-course/page.tsx`
- [Module lessons](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/certificate-course/%5B...slug%5D/page.tsx): `app/certificate-course/[...slug]/page.tsx`
- [Module quizzes](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/certificate-course/%5BmoduleId%5D/quiz/page.tsx): `app/certificate-course/[moduleId]/quiz/page.tsx`
- [Course modules](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/data/modules/index.ts): `data/modules/index.ts`
- [Lesson completion control](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/components/certificate-course/CompleteLessonButton.tsx): `components/certificate-course/CompleteLessonButton.tsx`
- [Certificate result email](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/api/send-result/route.ts): `app/api/send-result/route.ts`

### Assessments and reports

- [Compliance scorecard](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/scorecard/page.tsx): `app/scorecard/page.tsx`
- [Score report endpoint](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/api/score-report/route.ts): `app/api/score-report/route.ts`
- [Lead and tool submissions](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/api/lead-capture/route.ts): `app/api/lead-capture/route.ts`
- [Document generator](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/generator/page.tsx): `app/generator/page.tsx`

### Email and document services

- [Assessment PDF report](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/components/generator/PDFReport.tsx): `components/generator/PDFReport.tsx`
- [Tool PDF generation](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/lib/pdf-generator.ts): `app/lib/pdf-generator.ts`
- [Inbound email webhook](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/api/inbound/route.ts): `app/api/inbound/route.ts`
- [Email worker endpoint](https://github.com/yashkulshrestha1102/data-protection-galaxy/blob/main/app/api/email-worker/route.ts): `app/api/email-worker/route.ts`
- **Resend email service**
- **Google Sheets**

### Other components

- **Visitor**
- **Learner**

## Connections

- Visitor → Home and navigation: opens
- Visitor → Global law map: explores laws
- Global law map → Country law data: filters and looks up (evidence: `app/map/page.tsx`)
- Global law map → 3D globe: renders (evidence: `app/map/page.tsx`)
- Global law map → Country detail panel: renders (evidence: `app/map/page.tsx`)
- Country detail panel → Country law data: reads (evidence: `components/map/CountryDetail.tsx`)
- Visitor → DPDPA guidance pages: reads guidance
- Visitor → Insights and resources: browses resources
- Insight articles → Insight content: reads article data (evidence: `app/insight/[slug]/page.tsx`)
- Visitor → Insight articles: reads article
- Insights and resources → Guide content: uses guide content
- Insights and resources → Case study content: uses case studies
- Learner → Course catalog: starts course
- Course catalog → Course modules: loads modules (evidence: `app/certificate-course/page.tsx`)
- Module lessons → Course modules: loads module (evidence: `app/certificate-course/[...slug]/page.tsx`)
- Module lessons → Lesson completion control: uses control (evidence: `app/certificate-course/[...slug]/page.tsx`)
- Course catalog → Module lessons: links to lessons (evidence: `app/certificate-course/[...slug]/page.tsx`)
- Module lessons → Module quizzes: links to quiz (evidence: `app/certificate-course/[...slug]/page.tsx`)
- Module quizzes → Certificate result email: submits result
- Visitor → Compliance scorecard: completes assessment
- Compliance scorecard → Score report endpoint: requests report
- Score report endpoint → Assessment PDF report: renders PDF (evidence: `app/api/score-report/route.ts`)
- Score report endpoint → Resend email service: emails report (evidence: `app/api/score-report/route.ts`)
- Visitor → Document generator: uses generator
- Document generator → Lead and tool submissions: submits inputs
- Lead and tool submissions → Tool PDF generation: generates PDF (evidence: `app/api/lead-capture/route.ts`)
- Lead and tool submissions → Resend email service: emails submission result (evidence: `app/api/lead-capture/route.ts`)
- Lead and tool submissions → Google Sheets: appends demo leads (evidence: `app/api/lead-capture/route.ts`)
- Certificate result email → Resend email service: emails result (evidence: `app/api/send-result/route.ts`)
- Inbound email webhook → Resend email service: fetches received email (evidence: `app/api/inbound/route.ts`)
- Email worker endpoint → Resend email service: processes queued mail
