# allspaghettinocode/brokenaccesscontroldemo architecture

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

- Interactive diagram: https://gitdiagram.com/allspaghettinocode/brokenaccesscontroldemo
- Repository: https://github.com/allspaghettinocode/brokenaccesscontroldemo

## Overview

##### Project type & purpose (from README + tree)
This is a **Next.js (TypeScript) web application** that serves a **website explaining/demonstrating the OWASP “Broken Access Control” vulnerability**. The README indicates it’s deployed to **Vercel** (public URL). The file tree shows **no dedicated backend service**, no database, and no API routes folder—so the architecture is primarily a **content/UI-focused web app**.

Key signals:
- `next.config.ts`, `next-env.d.ts`, `tsconfig.json` → Next.js + TS
- `src/app/*` → Next.js **App Router** structure (layout/page)
- `Dockerfile`, `Dockerfile.prod`, `docker-compose*.yml` → containerized build/run options (dev/prod)
- No `src/pages/api` or `src/app/api` shown → likely **no API layer** (or it’s omitted)

##### Runtime / application layer
- `src/app/layout.tsx` → global shell (root layout)
- `src/app/page.tsx` → home page content and primary route (`/`)
- `src/app/globals.css`, `postcss.config.mjs` → styling pipeline (global CSS + PostCSS)
- `src/components/Header.tsx` → shared UI component(s)
- `src/tools/Toolkit.ts` → internal utility module (likely used by page/components)

##### Build & deployment layer
- `package.json` / `package-lock.json` → dependencies, scripts (build, dev, start)
- `Dockerfile` / `Dockerfile.prod` → container images (dev vs optimized prod)
- `docker-compose.yml` / `docker-compose-prod.yml` → local orchestration for running the app
- Vercel deployment (from README URL) → production hosting platform

**Goal:** Show who uses it and where it runs.

Include:
- **User (Browser)**
- **BrokenAccessControlDemo Website** (hosted on Vercel)
- Optional: **Vercel Platform** (build + CDN/edge distribution)

- User → Website: HTTPS requests
- Website → User: HTML/CSS/JS responses

**Goal:** Show deployable/runnable units.

##### Static assets/CDN edge (often handled by Vercel automatically)

**Local Dev/Prod containerization** as a separate deployment path:
- Developer machine → `docker-compose.yml` → Next.js container
- Production → Vercel build pipeline → Vercel runtime (Node/Edge)

- Browser ↔ Vercel Edge/CDN ↔ Next.js runtime (if SSR)

**Goal:** Show the major modules and how they compose pages.

- `Root Layout` (`src/app/layout.tsx`)
- `Home Page Route` (`src/app/page.tsx`)
- `Header Component` (`src/components/Header.tsx`)
- `Toolkit Utility` (`src/tools/Toolkit.ts`)
- `Global Styles` (`src/app/globals.css`) + `PostCSS pipeline` (`postcss.config.mjs`)

- `layout.tsx` → uses → `Header.tsx` (if imported there)
- `page.tsx` → uses → `Header.tsx` (if imported directly)
- `page.tsx`/`Header.tsx` → uses → `Toolkit.ts` (if applicable)
- `layout.tsx` → includes → `globals.css`

##### Important architectural patterns/design principles to highlight
- **Next.js App Router**: routing by filesystem (`src/app/page.tsx`, `layout.tsx`)
- **Component-based UI composition**: shared components in `src/components`
- **Separation of concerns**:
- UI components (`src/components`)
- Route-level composition (`src/app`)
- Utility/helpers (`src/tools`)
- Styling pipeline (global CSS + PostCSS)
- **Multi-target deployment**: can run via Docker locally and deploy to Vercel in production

Use consistent notation and explicit labels:

##### Labels
- Platform/runtime labels (e.g., “Vercel (Build + Edge/CDN + Runtime)”)

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =========================
  %% Level A — System Context
  %% =========================
  subgraph "A) System Context"
    U["User (Browser)"]:::external
    W["Broken Access Control Demo Website<br/>(Next.js on Vercel)"]:::system
    V["Vercel Platform<br/>(Build + Edge/CDN + Runtime)"]:::platform
  end

  U -->|"HTTPS requests"| V
  V -->|"HTML/CSS/JS responses"| U
  V -->|"hosts & serves"| W

  %% =========================
  %% Level B — Container / Deployment View
  %% =========================
  subgraph "B) Container / Deployment View"
    direction TB

    subgraph "Production (Vercel)"
      direction TB
      VBuild["Vercel Build Pipeline"]:::platform
      VEdge["Vercel Edge/CDN<br/>(static assets distribution)"]:::platform
      VRun["Next.js Runtime<br/>(SSR/SSG depending on configuration)"]:::container
      Artifacts["Build Artifacts<br/>(HTML/JS/CSS bundles)"]:::artifact
    end

    subgraph "Local (Docker)"
      direction TB
      Dev["Developer Machine"]:::external
      DCDev["docker-compose (Dev)"]:::devops
      DCProd["docker-compose (Prod)"]:::devops
      ImgDev["Docker Image (Dev)"]:::artifact
      ImgProd["Docker Image (Prod)"]:::artifact
      NextContainer["Next.js Container<br/>(Node.js + Next.js)"]:::container
    end

    NoteNoDB["No dedicated backend service<br/>No database / persistence detected"]:::note
  end

  %% Runtime traffic (prod)
  U -->|"HTTPS"| VEdge
  VEdge -->|"serves static assets"| U
  VEdge -->|"routes dynamic requests"| VRun
  VRun -->|"renders/returns HTML"| VEdge

  %% Build-time flow (prod)
  VBuild -.->|"build outputs"| Artifacts
  Artifacts -.->|"deployed to"| VEdge
  Artifacts -.->|"deployed to"| VRun

  %% Local docker build/run paths (dev/prod)
  Dev -->|"compose up"| DCDev
  Dev -->|"compose up"| DCProd
  DCDev -.->|"builds"| ImgDev
  DCProd -.->|"builds"| ImgProd
  ImgDev -.->|"runs"| NextContainer
  ImgProd -.->|"runs"| NextContainer
  U -->|"HTTP (local)"| NextContainer
  NextContainer -->|"HTML/CSS/JS"| U

  %% =========================
  %% Level C — Component / Code Structure
  %% =========================
  subgraph "C) Next.js App Components (Code Structure)"
    direction TB

    subgraph "Configuration & Tooling"
      direction TB
      Pkg["package.json<br/>(deps + scripts)"]:::config
      Lock["package-lock.json"]:::config
      NextCfg["next.config.ts"]:::config
      TsCfg["tsconfig.json"]:::config
      NextEnv["next-env.d.ts"]:::config
      Readme["README.md<br/>(project overview + Vercel URL)"]:::doc
    end

    subgraph "App Router (src/app)"
      direction TB
      AppDir["App Router Directory"]:::router
      Layout["Root Layout<br/>(layout.tsx)"]:::router
      Page["Home Page Route /<br/>(page.tsx)"]:::router
      Globals["Global Styles<br/>(globals.css)"]:::styling
    end

    subgraph "UI Components (src/components)"
      direction TB
      ComponentsDir["Shared UI Components Directory"]:::ui
      Header["Header Component<br/>(Header.tsx)"]:::ui
    end

    subgraph "Utilities (src/tools)"
      direction TB
      ToolsDir["Utility/Tools Directory"]:::util
      Toolkit["Toolkit Utility<br/>(Toolkit.ts)"]:::util
    end

    subgraph "Styling Pipeline"
      direction TB
      PostCSS["PostCSS Config<br/>(postcss.config.mjs)"]:::styling
    end
  end

  %% Code/runtime relationships (only what can be inferred safely)
  AppDir -->|"contains"| Layout
  AppDir -->|"contains"| Page
  AppDir -->|"contains"| Globals
  ComponentsDir -->|"contains"| Header
  ToolsDir -->|"contains"| Toolkit

  Layout -->|"includes"| Globals
  Globals -->|"processed by"| PostCSS

  Layout -.->|"imports/uses (if referenced)"| Header
  Page -.->|"imports/uses (if referenced)"| Header
  Page -.->|"uses utility (if referenced)"| Toolkit
  Header -.->|"uses utility (if referenced)"| Toolkit

  %% Link code structure to runtime container
  VRun -->|"executes"| AppDir
  NextContainer -->|"executes"| AppDir

  %% Link configuration to build/runtime
  VBuild -.->|"uses"| Pkg
  VBuild -.->|"uses"| NextCfg
  VBuild -.->|"uses"| TsCfg
  VBuild -.->|"uses"| PostCSS

  DCDev -.->|"uses"| Pkg
  DCProd -.->|"uses"| Pkg

  %% =========================
  %% Click Events (from component mapping)
  %% =========================
  click AppDir "https://github.com/allspaghettinocode/brokenaccesscontroldemo/tree/main/src/app/"
  click Layout "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/src/app/layout.tsx"
  click Page "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/src/app/page.tsx"
  click Globals "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/src/app/globals.css"
  click ComponentsDir "https://github.com/allspaghettinocode/brokenaccesscontroldemo/tree/main/src/components/"
  click Header "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/src/components/Header.tsx"
  click Toolkit "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/src/tools/Toolkit.ts"
  click ToolsDir "https://github.com/allspaghettinocode/brokenaccesscontroldemo/tree/main/src/tools/"
  click PostCSS "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/postcss.config.mjs"
  click NextCfg "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/next.config.ts"
  click TsCfg "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/tsconfig.json"
  click NextEnv "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/next-env.d.ts"
  click Pkg "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/package.json"
  click Lock "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/package-lock.json"
  click ImgDev "https://github.com/allspaghettinocode/brokenaccesscontroldemo/tree/main/Dockerfile"
  click ImgProd "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/Dockerfile.prod"
  click DCDev "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/docker-compose.yml"
  click DCProd "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/docker-compose-prod.yml"
  click Readme "https://github.com/allspaghettinocode/brokenaccesscontroldemo/blob/main/README.md"

  %% =========================
  %% Styles
  %% =========================
  classDef external fill:#FFF3E0,stroke:#E65100,stroke-width:1.5px,color:#3E2723
  classDef system fill:#E8F5E9,stroke:#1B5E20,stroke-width:1.5px,color:#1B5E20
  classDef platform fill:#E3F2FD,stroke:#0D47A1,stroke-width:1.5px,color:#0D47A1
  classDef container fill:#E1F5FE,stroke:#01579B,stroke-width:1.5px,color:#01579B
  classDef router fill:#F3E5F5,stroke:#4A148C,stroke-width:1.5px,color:#4A148C
  classDef ui fill:#E8EAF6,stroke:#1A237E,stroke-width:1.5px,color:#1A237E
  classDef util fill:#F1F8E9,stroke:#33691E,stroke-width:1.5px,color:#33691E
  classDef styling fill:#FCE4EC,stroke:#880E4F,stroke-width:1.5px,color:#880E4F
  classDef config fill:#ECEFF1,stroke:#263238,stroke-width:1.5px,color:#263238
  classDef devops fill:#FFFDE7,stroke:#F57F17,stroke-width:1.5px,color:#5D4037
  classDef artifact fill:#FAFAFA,stroke:#424242,stroke-width:1.5px,color:#212121
  classDef doc fill:#FFFFFF,stroke:#546E7A,stroke-width:1.5px,color:#263238
  classDef note fill:#FFF8E1,stroke:#FF6F00,stroke-width:1.5px,color:#5D4037
```
