# madhavc8/accessibility-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/madhavc8/accessibility-analyzer
- Repository: https://github.com/madhavc8/accessibility-analyzer

## Overview

##### Project type and purpose
- This is a full-stack web application called “Accessibility Analyzer.”
- Frontend: A React SPA that uses Firebase Authentication and Firestore, and Chart.js for visualization.
- Backend: A Node.js + Express API that invokes the Pa11y library to perform accessibility audits.

##### File structure
- Top-level separates “frontend” and “backend” as two independently deployed services.
- CI/deployment configs:
- /.github/workflows/firebase-deploy.yml → GitHub Action for deploying frontend to Firebase Hosting
- frontend/firebase.json, .firebaserc → Firebase Hosting (and possibly Functions) config
- backend/render.yaml & backend/vercel.json → Render or Vercel deployment settings for the Express API
- Frontend src/ contains React components, Chart.js integrations, and firebase.js (init code for Auth and Firestore).
- Backend index.js is the single entry point exposing HTTP endpoints that wrap Pa11y.

##### Key insights from the README
- Users can authenticate, analyze any website’s accessibility, view detailed charts, and compare multiple runs.
- Analysis engine (Pa11y) runs in the backend.
- Saved reports imply a persistent store (handled client-side via Firestore).

a. Main components
- Client browser (user UI)
- React frontend (hosted on Firebase Hosting)
- Firebase services: Authentication & Firestore (data store for saved reports)
- Express backend API (hosted on Render/Vercel)
- Pa11y engine (invoked by backend)
- Chart.js (in-browser lib for rendering visualizations)
- CI/CD pipelines (GitHub Actions for frontend; Render/Vercel auto-deploy for backend)
b. Relationships and interactions
1. User opens web app → React served from Firebase Hosting
2. React app initializes Firebase Auth → user signs in
3. User submits URL for analysis → React calls Express API endpoint (HTTPS)
4. Express API spawns Pa11y scan → returns JSON of errors/warnings
5. React receives results → renders charts via Chart.js
6. User optionally saves report → React writes to Firestore
7. User later fetches saved reports → React reads from Firestore
c. Architectural patterns
- Clear separation of concerns (frontend SPA vs. backend API microservice)
- Serverless‐style hosting for frontend (Firebase) and containerized/managed hosting for backend (Render/Vercel)
- Event-driven flow: user events → HTTP calls → analysis tasks → real-time visualization
d. Key technologies
- React, React Router (implied), Chart.js
- Firebase: Auth, Firestore, Hosting
- Node.js, Express.js, Pa11y
- CI/CD: GitHub Actions, Render/Vercel deployment

##### Detail
- How saved report metadata flows into Firestore and back into the dashboard.
- CI steps: code → GitHub → build → deploy to Firebase or Render/Vercel.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% CI/CD Pipelines
    subgraph "CI/CD"
        direction TB
        GH["GitHub Actions (Firebase Deploy)"]:::ci
        RenderCI["Render/Vercel Pipeline"]:::ci
    end

    %% Frontend Service
    subgraph "Frontend Service"
        direction TB
        Browser[/Client Browser/]:::client
        FirebaseHosting((Firebase Hosting)):::managed
        ReactSPA["React SPA"]:::client
        subgraph "React Core Components"
            direction TB
            Index["index.js"]:::client
            App["App.js"]:::client
            FirebaseInit["firebase.js"]:::client
        end
        subgraph "UI Components"
            direction TB
            AnalysisForm["AnalysisForm.js"]:::client
            ComparativeAnalysis["ComparativeAnalysis.js"]:::client
            ChartVis["ChartVisualization.js"]:::client
            DetailedChart["DetailedChartVisualization.js"]:::client
            Results["Results.js"]:::client
            Dashboard["UserDashboard.js"]:::client
            AuthForms["AuthForms.js"]:::client
            AuthModal["AuthModal.js"]:::client
            ProfileButton["ProfileButton.js"]:::client
            Loading["LoadingAnimation.js"]:::client
            SaveNotif["SaveNotification.js"]:::client
        end
        subgraph "Firebase Services"
            direction TB
            Auth(("Firebase Auth")):::managed
            Firestore(("Firestore DB")):::managed
        end
    end

    %% Backend Service
    subgraph "Backend Service"
        direction TB
        ExpressAPI["Express API"]:::backend
        subgraph "Backend Core"
            direction TB
            IndexBE["index.js"]:::backend
            Pkg["package.json"]:::backend
            Pa11y["Pa11y Engine"]:::backend
        end
    end

    %% Documentation
    subgraph "Documentation"
        direction TB
        Readme["README.md"]:::docs
        FEReadme["frontend/README.md"]:::docs
        BEReadme["backend/README.md"]:::docs
    end

    %% Deployments
    GH -->|deploys| FirebaseHosting
    RenderCI -->|deploys| ExpressAPI

    %% User Flow
    Browser -->|GET /| FirebaseHosting
    FirebaseHosting -->|serves| ReactSPA
    ReactSPA -->|init| Index
    ReactSPA -->|mount| App
    ReactSPA -->|init| FirebaseInit
    ReactSPA -->|renders| AnalysisForm
    ReactSPA -->|renders| ComparativeAnalysis
    ReactSPA -->|renders| ChartVis
    ReactSPA -->|renders| DetailedChart
    ReactSPA -->|renders| Results
    ReactSPA -->|renders| Dashboard
    ReactSPA -->|renders| AuthForms
    ReactSPA -->|renders| AuthModal
    ReactSPA -->|renders| ProfileButton
    ReactSPA -->|renders| Loading
    ReactSPA -->|renders| SaveNotif

    ReactSPA -->|SDK calls| Auth
    ReactSPA -->|SDK calls| Firestore

    ReactSPA -->|POST /analyze| ExpressAPI
    ExpressAPI -->|invokes| Pa11y
    Pa11y -->|returns JSON| ExpressAPI
    ExpressAPI -->|returns JSON| ReactSPA

    ReactSPA -->|write report| Firestore
    ReactSPA -->|read reports| Firestore

    %% Click Events
    click App "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/App.js"
    click Index "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/index.js"
    click FirebaseInit "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/firebase.js"
    click AnalysisForm "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/components/AnalysisForm.js"
    click ComparativeAnalysis "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/components/ComparativeAnalysis.js"
    click ChartVis "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/components/ChartVisualization.js"
    click DetailedChart "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/components/DetailedChartVisualization.js"
    click Results "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/components/Results.js"
    click Dashboard "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/components/UserDashboard.js"
    click AuthForms "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/components/AuthForms.js"
    click AuthModal "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/components/AuthModal.js"
    click ProfileButton "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/components/ProfileButton.js"
    click Loading "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/components/LoadingAnimation.js"
    click SaveNotif "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/src/components/SaveNotification.js"
    click IndexBE "https://github.com/madhavc8/accessibility-analyzer/blob/master/backend/index.js"
    click Pkg "https://github.com/madhavc8/accessibility-analyzer/blob/master/backend/package.json"
    click GH "https://github.com/madhavc8/accessibility-analyzer/blob/master/.github/workflows/firebase-deploy.yml"
    click FirebaseHosting "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/firebase.json"
    click Auth "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/.firebaserc"
    click RenderCI "https://github.com/madhavc8/accessibility-analyzer/blob/master/backend/render.yaml"
    click RenderCI "https://github.com/madhavc8/accessibility-analyzer/blob/master/backend/vercel.json"
    click Readme "https://github.com/madhavc8/accessibility-analyzer/blob/master/README.md"
    click FEReadme "https://github.com/madhavc8/accessibility-analyzer/blob/master/frontend/README.md"
    click BEReadme "https://github.com/madhavc8/accessibility-analyzer/blob/master/backend/README.md"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#54A0FF,color:#2E86DE
    classDef managed fill:#E8F9D0,stroke:#58D68D,color:#239B56
    classDef backend fill:#FFE5B4,stroke:#FF8C00,color:#C65C00
    classDef ci fill:#E0E0E0,stroke:#9E9E9E,color:#424242
    classDef docs fill:#F3E5F5,stroke:#CE93D8,color:#6A1B9A
```
