# ethics-for-youth/web-frontend architecture

> Architecture diagram of the GitHub repository ethics-for-youth/web-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ethics-for-youth/web-frontend
- Repository: https://github.com/ethics-for-youth/web-frontend

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built with React and Vite.
- It’s purely a front-end client that fetches and updates data via RESTful APIs (see the `src/services` folder).
- It uses TypeScript, Tailwind CSS, and the shadcn-ui component library for a modular UI.

##### File structure
- Top-level config and build files: `vite.config.ts`, `tsconfig.json`, `tailwind.config.ts`, `postcss.config.js`.
- Public/static assets in `public/` and `index.html` as the application shell.
- Source code under `src/` subdivided into:
- `components/` (shared UI bits and layout)
- `pages/` (route targets)
- `services/` (API clients)
- `contexts/` (React context providers, e.g. Auth).
- `hooks/` (custom hooks wrapping API calls and local state).
- `lib/` (utility abstractions, e.g. `apiClient.ts`).
- `config/` (endpoint configuration).

##### README for additional insights
- Confirms Vite dev server for development and static build for production.
- Mentions deployment to any static host (Vercel, Netlify, S3).
- No built-in backend—calls out to external REST endpoints.

##### Detail and essential elements
- Separation of front-end layers (Routing, UI, Data).
- How configuration, build, and deployment fit together.
- External API endpoint as its own service node to highlight the micro-API integrations.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Development Environment
    subgraph "Development Environment"
        direction TB
        VITE["Vite Dev Server / Build"]:::build
        TSCONFIG["TypeScript Configs"]:::build
        POSTCSS["PostCSS Config"]:::build
        TAILWIND["Tailwind Config"]:::build
    end

    %% Production Environment
    subgraph "Production Environment"
        direction TB
        CDN["Static Hosting / CDN"]:::pipeline
        PUBLIC["Public Assets"]:::pipeline
    end

    %% Build process
    VITE -->|"bundle at build time"| CDN
    TSCONFIG --> VITE
    POSTCSS --> VITE
    TAILWIND --> VITE
    PUBLIC --> CDN

    %% Browser SPA Runtime
    subgraph "Browser SPA" 
        direction TB
        ENTRY["Entry & Shell"]:::frontend
        subgraph "Routing Layer"
            direction TB
            ROUTER["React Router (src/pages)"]:::frontend
        end
        subgraph "UI Layer"
            direction TB
            UIKIT["Component Library (shadcn-ui)"]:::frontend
            LAYOUT["Layout & Shared Components"]:::frontend
        end
        subgraph "State & Data Layer"
            direction TB
            CONTEXT["React Context Providers"]:::backend
            HOOKS["Custom Hooks"]:::backend
            SERVICES["REST API Clients"]:::backend
            APICLIENT["apiClient.ts"]:::backend
            CONFIG["Endpoint Config"]:::backend
        end
    end

    %% Runtime interactions
    CDN -->|"serves index.html"| ENTRY
    ENTRY --> ROUTER
    ROUTER --> UIKIT
    ROUTER --> LAYOUT
    UIKIT --> LAYOUT
    LAYOUT --> CONTEXT
    CONTEXT --> HOOKS
    HOOKS --> SERVICES
    SERVICES --> APICLIENT
    APICLIENT --> CONFIG
    SERVICES -->|"REST calls"| EXTERNAL_APIS

    %% External APIs
    subgraph "External REST APIs"
        direction TB
        AUTH["Auth API"]:::db
        COURSES["Courses API"]:::db
        EVENTS["Events API"]:::db
        MESSAGES["Messages API"]:::db
        REGISTRATIONS["Registrations API"]:::db
        SUGGESTIONS["Suggestions API"]:::db
        VOLUNTEERS["Volunteers API"]:::db
        COMPETITIONS["Competitions API"]:::db
        ADMINSTATS["Admin Stats API"]:::db
    end
    EXTERNAL_APIS --> AUTH
    EXTERNAL_APIS --> COURSES
    EXTERNAL_APIS --> EVENTS
    EXTERNAL_APIS --> MESSAGES
    EXTERNAL_APIS --> REGISTRATIONS
    EXTERNAL_APIS --> SUGGESTIONS
    EXTERNAL_APIS --> VOLUNTEERS
    EXTERNAL_APIS --> COMPETITIONS
    EXTERNAL_APIS --> ADMINSTATS

    %% Click Events
    click ENTRY "https://github.com/ethics-for-youth/web-frontend/blob/develop/index.html"
    click ENTRY "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/main.tsx"
    click ENTRY "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/App.tsx"
    click VITE "https://github.com/ethics-for-youth/web-frontend/blob/develop/vite.config.ts"
    click TSCONFIG "https://github.com/ethics-for-youth/web-frontend/blob/develop/tsconfig.json"
    click TSCONFIG "https://github.com/ethics-for-youth/web-frontend/blob/develop/tsconfig.app.json"
    click TSCONFIG "https://github.com/ethics-for-youth/web-frontend/blob/develop/tsconfig.node.json"
    click POSTCSS "https://github.com/ethics-for-youth/web-frontend/blob/develop/postcss.config.js"
    click TAILWIND "https://github.com/ethics-for-youth/web-frontend/blob/develop/tailwind.config.ts"
    click PUBLIC "https://github.com/ethics-for-youth/web-frontend/tree/develop/public/"
    click PUBLIC "https://github.com/ethics-for-youth/web-frontend/blob/develop/public/robots.txt"
    click ROUTER "https://github.com/ethics-for-youth/web-frontend/tree/develop/src/pages/"
    click UIKIT "https://github.com/ethics-for-youth/web-frontend/tree/develop/src/components/ui/"
    click LAYOUT "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/components/Layout.tsx"
    click LAYOUT "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/components/Navbar.tsx"
    click LAYOUT "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/components/Footer.tsx"
    click LAYOUT "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/components/ErrorBoundary.tsx"
    click LAYOUT "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/components/ProtectedRoute.tsx"
    click LAYOUT "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/components/RegistrationForm.tsx"
    click CONTEXT "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/contexts/AuthContext.tsx"
    click APICLIENT "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/lib/apiClient.ts"
    click CONFIG "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/config/api.ts"
    click SERVICES "https://github.com/ethics-for-youth/web-frontend/tree/develop/src/services/"
    click HOOKS "https://github.com/ethics-for-youth/web-frontend/tree/develop/src/hooks/"
    click SERVICES "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/services/coursesApi.ts"
    click SERVICES "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/services/eventsApi.ts"
    click SERVICES "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/services/registrationsApi.ts"
    click SERVICES "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/services/messagesApi.ts"
    click SERVICES "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/services/suggestionsApi.ts"
    click SERVICES "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/services/volunteersApi.ts"
    click SERVICES "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/services/competitionsApi.ts"
    click SERVICES "https://github.com/ethics-for-youth/web-frontend/blob/develop/src/services/adminStatsApi.ts"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,stroke-width:1px
    classDef backend fill:#E8F5E9,stroke:#2E7D32,stroke-width:1px
    classDef db fill:#E3F2FD,stroke:#1976D2,stroke-width:1px,stroke-dasharray: 5 5
    classDef build fill:#FFF3E0,stroke:#FB8C00,stroke-width:1px
    classDef pipeline fill:#F3E5F5,stroke:#8E24AA,stroke-width:1px
```
