# dsanchezcr/website architecture

> Architecture diagram of the GitHub repository dsanchezcr/website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dsanchezcr/website
- Repository: https://github.com/dsanchezcr/website

## Overview

##### Project Type and Purpose
- This is a Jamstack-style personal website built with Docusaurus (React + MDX) and hosted as an Azure Static Web App.
- It includes a small C# Azure Function in the api folder to handle contact-form email sending.

##### Main Components
a. Frontend (Static Site)
- Docusaurus framework under src, blog, disney, universal and static asset folders
- React + MDX pages and custom components (.tsx/.js, .css)
- Internationalization data under i18n
b. Backend API
- Azure Function project in api with SendEmail.cs for contact‐form submissions
- host.json configuration
c. Hosting & CDN
- Azure Static Web Apps service (builds and serves the static files)
- Azure Functions runtime for the API endpoint
d. CI/CD Pipeline
- GitHub Actions workflows:
– azure-static-web-apps-delightful-moss for frontend
– api.yml for functions deployment
e. External Services
- Email delivery service (e.g., SendGrid or SMTP) invoked by the Azure Function

##### Component Relationships & Data Flow
- User’s Browser → HTTP GET → Azure Static Web Apps CDN → serves static HTML/CSS/JS
- Browser (Contact Form) → HTTP POST → /api/SendEmail endpoint → Azure Function → calls external email service → returns status
- GitHub (repo) → on push → GitHub Actions → build & deploy frontend to Static Web Apps and backend to Azure Functions

##### Architectural Patterns & Principles
- Jamstack: pre-built static assets + client-side hydration
- Microservice for dynamic behavior: single API function for email
- CI/CD: GitOps via GitHub Actions
- Separation of concerns: static content vs. serverless compute

##### Key Technologies & Frameworks
- Docusaurus (React, MDX)
- TypeScript/JavaScript for UI components
- C# Azure Functions for backend
- Azure Static Web Apps & Azure Functions hosting
- GitHub Actions for CI/CD

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    BrowserClient["Browser / Client"]:::client
    GitHubRepo["GitHub Repo"]:::cd

    %% Frontend Subgraph
    subgraph "Frontend: Docusaurus Site"
        direction TB
        DConfig["docusaurus.config.js"]:::frontend
        Blog["Blog Posts (MDX)"]:::frontend
        Disney["Disney Docs"]:::frontend
        Universal["Universal Docs"]:::frontend
        I18n["i18n Data"]:::frontend
        Pages["Pages (src/pages)"]:::frontend
        Components["UI Components (src/components)"]:::frontend
        Theme["Theme Override"]:::frontend
        Styles1["custom.css"]:::frontend
        Styles2["styles.module.css"]:::frontend
        Assets["Images"]:::frontend
        Pkg["package.json"]:::frontend
        Lock["package-lock.json"]:::frontend
    end

    %% Backend API Subgraph
    subgraph "Backend API"
        direction TB
        SendEmail["Azure Function: SendEmail"]:::api
        Csproj["api.csproj"]:::api
        HostJson["host.json"]:::api
    end

    %% Hosting & CDN
    StaticHost(["Azure Static Web Apps CDN"]):::hosting

    %% External Service
    EmailSvc[(External Email Service)]:::external

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        direction TB
        GitHubActions["GitHub Actions CI/CD"]:::cd
        FrontendWF["Frontend Workflow"]:::cd
        BackendWF["Backend Workflow"]:::cd
    end

    %% Connections
    BrowserClient -->|HTTPS GET| StaticHost
    StaticHost -->|"Serves Static Files"| BrowserClient
    BrowserClient -->|HTTPS POST /api/SendEmail| SendEmail
    SendEmail -->|Calls SMTP/SendGrid| EmailSvc

    GitHubRepo --> GitHubActions
    GitHubActions --> FrontendWF
    GitHubActions --> BackendWF
    FrontendWF -->|yarn build / docusaurus build; deploy| StaticHost
    BackendWF -->|dotnet build/publish; deploy| SendEmail

    %% Click Events
    click DConfig "https://github.com/dsanchezcr/website/blob/main/docusaurus.config.js"
    click Blog "https://github.com/dsanchezcr/website/tree/main/blog/"
    click Disney "https://github.com/dsanchezcr/website/blob/main/disney/index.mdx"
    click Universal "https://github.com/dsanchezcr/website/blob/main/universal/index.mdx"
    click I18n "https://github.com/dsanchezcr/website/tree/main/i18n/"
    click Pages "https://github.com/dsanchezcr/website/tree/main/src/pages/"
    click Components "https://github.com/dsanchezcr/website/tree/main/src/components/"
    click Theme "https://github.com/dsanchezcr/website/blob/main/src/theme/BlogPostItem/index.tsx"
    click Styles1 "https://github.com/dsanchezcr/website/blob/main/src/css/custom.css"
    click Styles2 "https://github.com/dsanchezcr/website/blob/main/src/components/styles.module.css"
    click Assets "https://github.com/dsanchezcr/website/tree/main/static/img/"
    click SendEmail "https://github.com/dsanchezcr/website/blob/main/api/SendEmail.cs"
    click Csproj "https://github.com/dsanchezcr/website/blob/main/api/api.csproj"
    click HostJson "https://github.com/dsanchezcr/website/blob/main/api/host.json"
    click FrontendWF "https://github.com/dsanchezcr/website/blob/main/.github/workflows/azure-static-web-apps-delightful-moss-07d95f50f.yml"
    click BackendWF "https://github.com/dsanchezcr/website/blob/main/.github/workflows/api.yml"
    click Pkg "https://github.com/dsanchezcr/website/blob/main/package.json"
    click Lock "https://github.com/dsanchezcr/website/blob/main/package-lock.json"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085;
    classDef api fill:#d4edda,stroke:#155724,stroke-dasharray: 5 5;
    classDef hosting fill:#e2e3e5,stroke:#6c757d;
    classDef external fill:#f8d7da,stroke:#721c24;
    classDef cd fill:#fff3cd,stroke:#856404;
    classDef client fill:#d1ecf1,stroke:#0c5460;
```
