# ahad-2004/boardly-hub architecture

> Architecture diagram of the GitHub repository ahad-2004/boardly-hub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahad-2004/boardly-hub
- Repository: https://github.com/ahad-2004/boardly-hub

## Overview

##### Project Type and Purpose
- This is a full-stack, single-page application (“Digital Notice Board”) for educational institutions.
- Frontend: React + TypeScript + Vite + Tailwind + Shadcn/ui
- Backend-as-a-Service: Supabase (Authentication, Database, Realtime)

##### File Structure
- Top-level:
- src/ – React source code
- public/ – static assets (robots.txt, index.html)
- supabase/ – Supabase config.toml + SQL migrations
- Configuration: vite.config.ts, tailwind.config.ts, tsconfig, CI/CD workflow
- src/ subdirectories:
- components/ – reusable UI & domain components (NoticeCard, NoticeForm, plus Shadcn/ui primitives)
- pages/ – route-level views (Auth, StudentDashboard, FacultyDashboard)
- contexts/ – React context (AuthContext)
- hooks/ – custom hooks (use-mobile, use-toast)
- integrations/supabase – client.ts + types.ts for Supabase SDK initialization
- lib/ – business logic (notices.ts, utils.ts)

##### Extract Architectural Insights from README
- Two user roles: Faculty and Student
- Faculty → create/manage notices; Student → view filtered notices
- Real-time updates via Supabase Realtime
- Responsive & themable (dark mode) UI

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Hosting Layer
    HOST["Hosting / CDN"]:::external

    %% Client Layer
    subgraph "Client (Browser)" 
        direction TB
        ENTRY["Entry Point\n(src/main.tsx, src/App.tsx)"]:::frontend
        SPA["React SPA"]:::frontend

        subgraph "UI Components"
            direction TB
            NoticeCard["NoticeCard"]:::frontend
            NoticeForm["NoticeForm"]:::frontend
            UIPrimitives["Shadcn/ui Primitives"]:::frontend
        end

        subgraph "Pages"
            direction TB
            AuthPage["Auth Page"]:::frontend
            StudentDashboard["Student Dashboard"]:::frontend
            FacultyDashboard["Faculty Dashboard"]:::frontend
            IndexPage["Home / Index Page"]:::frontend
            NotFoundPage["404 Page"]:::frontend
        end

        subgraph "State & Logic"
            direction TB
            AuthContext["AuthContext"]:::frontend
            useMobile["use-mobile Hook"]:::frontend
            useToast["use-toast Hook"]:::frontend
            NoticesLib["notices.ts"]:::frontend
            UtilsLib["utils.ts"]:::frontend
        end

        subgraph "Integrations"
            direction TB
            SupabaseClient["Supabase Client"]:::frontend
            SupabaseTypes["Supabase Types"]:::frontend
        end
    end

    %% BaaS Layer
    subgraph "Supabase BaaS"
        direction TB
        Auth["Supabase Auth"]:::backend
        Realtime["Supabase Realtime"]:::realtime
        DB["Postgres Database"]:::db
        Config["Config & Migrations"]:::backend
    end

    %% Tooling & Config
    subgraph "Build & Tooling"
        direction TB
        ViteConfig["vite.config.ts"]:::external
        TailwindConfig["tailwind.config.ts"]:::external
        TSConfigApp["tsconfig.app.json"]:::external
        TSConfigNode["tsconfig.node.json"]:::external
        TSConfig["tsconfig.json"]:::external
        PostCSS["postcss.config.js"]:::external
        CICD["CI/CD Workflow"]:::external
    end

    %% Connections
    HOST -->|HTTPS GET index.html| ENTRY
    ENTRY -->|Bootstrap SPA| SPA
    SPA -->|import client| SupabaseClient
    SPA -->|import types| SupabaseTypes
    SPA -->|HTTPS Auth Requests| Auth
    SPA -->|HTTPS CRUD Notices| DB
    SPA -->|WebSocket Subscribe| Realtime
    Auth -->|JWT| SPA
    Config -->|defines schema| DB

    %% Click Events
    click ENTRY "https://github.com/ahad-2004/boardly-hub/blob/main/src/main.tsx"
    click ENTRY "https://github.com/ahad-2004/boardly-hub/blob/main/src/App.tsx"
    click AuthPage "https://github.com/ahad-2004/boardly-hub/blob/main/src/pages/Auth.tsx"
    click StudentDashboard "https://github.com/ahad-2004/boardly-hub/blob/main/src/pages/StudentDashboard.tsx"
    click FacultyDashboard "https://github.com/ahad-2004/boardly-hub/blob/main/src/pages/FacultyDashboard.tsx"
    click IndexPage "https://github.com/ahad-2004/boardly-hub/blob/main/src/pages/Index.tsx"
    click NotFoundPage "https://github.com/ahad-2004/boardly-hub/blob/main/src/pages/NotFound.tsx"
    click UIPrimitives "https://github.com/ahad-2004/boardly-hub/tree/main/src/components/ui/"
    click NoticeCard "https://github.com/ahad-2004/boardly-hub/blob/main/src/components/NoticeCard.tsx"
    click NoticeForm "https://github.com/ahad-2004/boardly-hub/blob/main/src/components/NoticeForm.tsx"
    click AuthContext "https://github.com/ahad-2004/boardly-hub/blob/main/src/contexts/AuthContext.tsx"
    click useMobile "https://github.com/ahad-2004/boardly-hub/blob/main/src/hooks/use-mobile.tsx"
    click useToast "https://github.com/ahad-2004/boardly-hub/blob/main/src/hooks/use-toast.ts"
    click SupabaseClient "https://github.com/ahad-2004/boardly-hub/blob/main/src/integrations/supabase/client.ts"
    click SupabaseTypes "https://github.com/ahad-2004/boardly-hub/blob/main/src/integrations/supabase/types.ts"
    click NoticesLib "https://github.com/ahad-2004/boardly-hub/blob/main/src/lib/notices.ts"
    click UtilsLib "https://github.com/ahad-2004/boardly-hub/blob/main/src/lib/utils.ts"
    click Config "https://github.com/ahad-2004/boardly-hub/blob/main/supabase/config.toml"
    click Config "https://github.com/ahad-2004/boardly-hub/blob/main/supabase/migrations/*.sql"
    click ViteConfig "https://github.com/ahad-2004/boardly-hub/blob/main/vite.config.ts"
    click TailwindConfig "https://github.com/ahad-2004/boardly-hub/blob/main/tailwind.config.ts"
    click TSConfig "https://github.com/ahad-2004/boardly-hub/blob/main/tsconfig.json"
    click TSConfigApp "https://github.com/ahad-2004/boardly-hub/blob/main/tsconfig.app.json"
    click TSConfigNode "https://github.com/ahad-2004/boardly-hub/blob/main/tsconfig.node.json"
    click PostCSS "https://github.com/ahad-2004/boardly-hub/blob/main/postcss.config.js"
    click CICD "https://github.com/ahad-2004/boardly-hub/blob/main/.github/workflows/ci-cd.yml"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef backend fill:#E6FFED,stroke:#28A745,color:#28A745;
    classDef db fill:#FFF5E6,stroke:#FF8C00,color:#FF8C00;
    classDef realtime fill:#F3E8FF,stroke:#8A2BE2,color:#8A2BE2;
    classDef external fill:#F0F0F0,stroke:#666666,color:#333333;
```
