# bsk03/live-feedback-wall architecture

> Architecture diagram of the GitHub repository bsk03/live-feedback-wall, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bsk03/live-feedback-wall
- Repository: https://github.com/bsk03/live-feedback-wall

## Overview

##### Project type and purpose
- This is a full-stack web application scaffolded with the T3 Stack (Next.js App Router, NextAuth, Drizzle ORM, Tailwind CSS, tRPC).
- From the file tree and README, we see a real-time “rooms/chat” feature, a panel for room management, authentication pages, database migrations under `drizzle/`, and Docker scripts.

##### File structure
- Top-level:
- `docker-compose.yml` + `start-database.sh`: orchestrate your database (e.g., PostgreSQL) in Docker.
- `drizzle/` folder: SQL migrations and snapshots.
- `server.js` / `server.mts`: entrypoints for socket server or custom API server.
- `next.config.js`, `tsconfig.json`, lint/format configs.
- Source directories under `src/`:
- `src/app/`: Next.js App Router—React pages, layouts, and serverless API routes at `src/app/api/`.
- `src/components/`: React UI components (landing pages, auth flows, panel, rooms, QR generator).
- `src/hooks/`: custom React hooks (infinite scroll, socket room).
- `src/lib/`: client & server utilities (socketClient, auth-client, server-only).
- `src/server/`: tRPC routers and database schema using Drizzle.
- `src/store/`: Zustand or similar for client state (authStore).
- `src/trpc/`: tRPC client/server setup.
- `public/`: static assets.

##### README for additional insights
- Confirms tech stack: Next.js, NextAuth.js, Drizzle (ORM), Tailwind, tRPC.
- Mentions deployment via Docker, Vercel, Netlify.

##### Essential details to capture
- Next.js App Router structure (pages & API routes)
- tRPC client/server boundary
- Authentication flow (NextAuth endpoints, session validation)
- Real-time channel (Socket.io pipeline)
- Database migrations & schema (Drizzle)
- Docker-based DB in local/dev vs. production

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Browser["Client Browser"]:::frontend

    subgraph "Frontend Layer"
        direction TB
        AppRouter["Next.js App Router"]:::frontend
        UIComponents["UI Components (src/components)"]:::frontend
        AuthPages["Auth Pages & Layouts"]:::frontend
        TRPCClient["tRPC Client Hooks"]:::frontend
        SocketClient["Socket Client Utility"]:::frontend
        Hooks["Custom React Hooks"]:::frontend
        Styling["Tailwind & Styles"]:::frontend
    end

    %% Backend Layer
    subgraph "API Layer"
        direction TB
        NextAuthAPI["NextAuth API Route"]:::backend
        RESTAPI["REST API (Panel)"]:::backend
        TRPCRoute["tRPC API Route"]:::backend
        TRPCServer["tRPC Server Bootstrap"]:::backend
        Routers["tRPC Routers"]:::backend
        SocketServer["Socket.io Server"]:::backend
    end

    subgraph "Data Layer"
        direction TB
        ORMConfig["Drizzle Config & Migrations"]:::data
        DBSchema["Drizzle Schema Definitions"]:::data
        Database["PostgreSQL Database"]:::data
    end

    subgraph "External Services"
        direction TB
        OAuth["OAuth Providers"]:::external
    end

    %% Styling & Utils
    subgraph "Utilities & Hooks"
        direction TB
        Utils["Utility Functions"]:::frontend
    end

    %% Docker Environment
    subgraph "Docker Environment"
        direction TB
        Compose["docker-compose.yml"]:::data
        InitScript["start-database.sh"]:::data
    end

    %% Interactions
    Browser -->|HTTP/SSR| AppRouter
    AppRouter -->|renders| UIComponents
    AppRouter -->|uses| AuthPages
    AppRouter -->|uses| Hooks
    AppRouter -->|imports| Styling

    AppRouter -->|HTTP calls| NextAuthAPI
    AppRouter -->|HTTP calls| RESTAPI
    AppRouter -->|HTTP calls| TRPCRoute
    AppRouter -->|WS connect| SocketServer

    TRPCClient -->|tRPC call| TRPCRoute
    TRPCRoute -->|invokes| TRPCServer
    TRPCServer -->|routes| Routers
    Routers -->|SQL query| DBSchema

    NextAuthAPI -->|session/read| ORMConfig
    RESTAPI -->|SQL query| ORMConfig
    SocketServer -->|pub/sub| DBSchema
    SocketServer -->|data stream| Browser

    ORMConfig -->|migrations| Database
    DBSchema -->|schema| Database
    Compose --> Database
    InitScript --> Database

    Browser -->|OAuth flow| OAuth

    Utils -->|helpers| AuthPages
    Utils -->|helpers| RESTAPI
    Hooks -->|useSocket| SocketClient
    Hooks -->|useInfiniteScroll| AppRouter

    %% Click Events
    click AppRouter "https://github.com/bsk03/live-feedback-wall/tree/main/src/app"
    click UIComponents "https://github.com/bsk03/live-feedback-wall/tree/main/src/components"
    click NextAuthAPI "https://github.com/bsk03/live-feedback-wall/blob/main/src/app/api/auth/[...all]/route.ts"
    click AuthPages "https://github.com/bsk03/live-feedback-wall/blob/main/src/app/(auth-routes)/layout.tsx"
    click AuthPages "https://github.com/bsk03/live-feedback-wall/blob/main/src/app/auth/page.tsx"
    click Utils "https://github.com/bsk03/live-feedback-wall/blob/main/src/lib/auth-client.ts"
    click Utils "https://github.com/bsk03/live-feedback-wall/blob/main/src/store/authStore.ts"
    click RESTAPI "https://github.com/bsk03/live-feedback-wall/blob/main/src/app/api/panel/route.ts"
    click TRPCRoute "https://github.com/bsk03/live-feedback-wall/blob/main/src/app/api/trpc/[trpc]/route.ts"
    click Routers "https://github.com/bsk03/live-feedback-wall/blob/main/src/server/api/routers/message.ts"
    click Routers "https://github.com/bsk03/live-feedback-wall/blob/main/src/server/api/routers/room.ts"
    click Routers "https://github.com/bsk03/live-feedback-wall/blob/main/src/server/api/routers/user.ts"
    click TRPCServer "https://github.com/bsk03/live-feedback-wall/blob/main/src/trpc/server.ts"
    click TRPCClient "https://github.com/bsk03/live-feedback-wall/blob/main/src/trpc/react.tsx"
    click TRPCClient "https://github.com/bsk03/live-feedback-wall/blob/main/src/trpc/query-client.ts"
    click SocketServer "https://github.com/bsk03/live-feedback-wall/blob/main/server.js"
    click SocketServer "https://github.com/bsk03/live-feedback-wall/blob/main/server.mts"
    click SocketClient "https://github.com/bsk03/live-feedback-wall/blob/main/src/lib/socketClient.ts"
    click Hooks "https://github.com/bsk03/live-feedback-wall/blob/main/src/hooks/useSocketRoom.ts"
    click ORMConfig "https://github.com/bsk03/live-feedback-wall/blob/main/drizzle/0000_*.sql"
    click ORMConfig "https://github.com/bsk03/live-feedback-wall/blob/main/drizzle/0001_*.sql"
    click ORMConfig "https://github.com/bsk03/live-feedback-wall/blob/main/drizzle/meta/*.json"
    click ORMConfig "https://github.com/bsk03/live-feedback-wall/blob/main/drizzle.config.ts"
    click DBSchema "https://github.com/bsk03/live-feedback-wall/blob/main/src/server/db/schema/auth-schema.ts"
    click DBSchema "https://github.com/bsk03/live-feedback-wall/blob/main/src/server/db/schema/message.ts"
    click DBSchema "https://github.com/bsk03/live-feedback-wall/blob/main/src/server/db/schema/room.ts"
    click DBSchema "https://github.com/bsk03/live-feedback-wall/blob/main/src/server/db/index.ts"
    click DBSchema "https://github.com/bsk03/live-feedback-wall/blob/main/src/server/db/schema.ts"
    click Compose "https://github.com/bsk03/live-feedback-wall/blob/main/docker-compose.yml"
    click InitScript "https://github.com/bsk03/live-feedback-wall/blob/main/start-database.sh"
    click Styling "https://github.com/bsk03/live-feedback-wall/blob/main/tailwind.config.ts"
    click Styling "https://github.com/bsk03/live-feedback-wall/blob/main/src/styles/globals.css"
    click Utils "https://github.com/bsk03/live-feedback-wall/blob/main/src/lib/utils.ts"
    click Utils "https://github.com/bsk03/live-feedback-wall/blob/main/src/utils/auth.ts"
    click Utils "https://github.com/bsk03/live-feedback-wall/blob/main/src/utils/room.ts"
    click Utils "https://github.com/bsk03/live-feedback-wall/blob/main/src/utils/codeTranslator.ts"
    click Hooks "https://github.com/bsk03/live-feedback-wall/blob/main/src/hooks/useInfiniteScroll.ts"
    click Hooks "https://github.com/bsk03/live-feedback-wall/blob/main/src/hooks/useChatScroll.ts"

    %% Styles
    classDef frontend fill:#bee3f8,stroke:#3182ce,color:#1a365d
    classDef backend fill:#b2f5ea,stroke:#2f855a,color:#22543d
    classDef data fill:#fbd38d,stroke:#d69e2e,color:#744210
    classDef external fill:#d6bcfa,stroke:#6b46c1,color:#3c366b
```
