# ashrithsathu/pawvc architecture

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

- Interactive diagram: https://gitdiagram.com/ashrithsathu/pawvc
- Repository: https://github.com/ashrithsathu/pawvc

## Overview

##### Project Type and Purpose
- This is a full-stack, server-rendered React application built with Next.js 13 (App Router). Its primary function is to let users sign up/in, schedule and join voice/video meetings. It leverages Stream’s real-time API for calls and messaging.

##### File Structure Analysis
- **app/** – Next.js App Router directory.
- (auth) sub-group for sign-in and sign-up pages.
- (root) sub-group for the main site: home, personal room, previous/upcoming recordings, and dynamic meeting pages.
- layout.tsx files define shared UI shells.
- middleware.ts handles route guards (e.g., auth).
- **components/** – Reusable UI and meeting-related modules (MeetingCard, MeetingRoom, CallList, MeetingModal, etc.).
- **components/ui/** – Design system primitives (buttons, cards, dialogs, inputs, toasts).
- **actions/stream.actions.ts** – Next.js Server Actions to interact with Stream API (create calls, fetch call data).
- **hooks/** – Client hooks (useGetCalls, useGetCallById) that wrap data-fetch logic.
- **providers/StreamClientProvider.tsx** – React Context providing Stream client across the tree.
- **lib/utils.ts** – Shared utility functions.
- Config & tooling: ESLint, Tailwind CSS, PostCSS, TypeScript, pnpm, Vercel deployment config.

##### Additional Insights from README
- Standard create-next-app setup.
- Uses server-side rendering (SSR) and static optimization where possible.
- TailwindCSS for styling, Next.js `next/font` for Inter font optimization.
- No custom database layer—relies on external Stream service for real-time data.

a. **Main Components**
1. Browser / Client (React UI)
2. Next.js Server (App Router)
3. Stream Service (external API for calls & chat)
4. CDN / Static Assets Store (Vercel)
5. Middleware / Auth Guard
b. **Relationships & Data Flows**
- User’s browser ↔ Next.js server
- Initial page SSR / SSG via App Router
- Static assets delivered from CDN
- Browser components (wrapped by StreamClientProvider) ↔ Stream API
- Real-time WebSocket/REST calls for creating, joining, ending meetings
- Next.js Server Actions (stream.actions.ts) invoked from server components/hooks → Stream API
- Hooks (useGetCalls, useGetCallById) fetch data via client-side fetches or server actions
c. **Architectural Patterns & Principles**
- App Router + Nested Layouts for route grouping & shared UI
- Server Components vs. Client Components separation
- React Context (StreamClientProvider) for dependency injection
- Single responsibility: components focus on UI, actions on API interaction, hooks on data fetching
d. **Key Technologies**
- Next.js 13 App Router, React 18, TypeScript
- TailwindCSS, next/font
- Stream Video/Chat SDK
- Vercel for hosting & CDN

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Browser Layer
    subgraph "Browser (React UI)"
        direction TB
        UI["UI Layer"]:::ui
        Provider["StreamClientProvider"]:::client
        Hooks["Data Fetch Hooks"]:::client
        UI --> Provider
        UI --> Hooks
    end

    %% Next.js Server Layer
    subgraph "Next.js App Server" 
        direction TB
        Middleware["Middleware (Auth Guard)"]:::infra
        AppRouter["App Router"]:::server
        Actions["Stream API Server Actions"]:::server
        Utils["Utilities (lib/utils.ts)"]:::server

        Middleware --> AppRouter
        AppRouter --> Actions
        AppRouter --> Utils

        subgraph "App Router (app/)"
            direction TB
            LayoutRoot["Root layout (app/layout.tsx)"]:::server
            subgraph "Auth Routes (app/(auth)/)"
                direction TB
                SignInDir["Sign-in Dir"]:::server
                SignInPage["Sign-in Page"]:::server
                SignUpDir["Sign-up Dir"]:::server
                SignUpPage["Sign-up Page"]:::server
                SignInDir --> SignInPage
                SignUpDir --> SignUpPage
            end
            subgraph "Root Routes (app/(root)/)"
                direction TB
                LayoutRootRoot["Root layout (app/(root)/layout.tsx)"]:::server
                subgraph "Home Group (app/(root)/(home)/)"
                    direction TB
                    HomeDir["Home Dir"]:::server
                    HomePage["Home Page"]:::server
                    PersonalRoom["Personal Room Page"]:::server
                    Previous["Previous Recordings Page"]:::server
                    Upcoming["Upcoming Page"]:::server
                    Recordings["Recordings Page"]:::server
                    HomeDir --> HomePage
                    HomeDir --> PersonalRoom
                    HomeDir --> Previous
                    HomeDir --> Upcoming
                    HomeDir --> Recordings
                end
                subgraph "Meeting (app/(root)/meeting/[id]/)"
                    direction TB
                    MeetingDir["Meeting Dir"]:::server
                    MeetingPage["Meeting Page"]:::server
                    MeetingDir --> MeetingPage
                end
                LayoutRootRoot --> HomeDir
                LayoutRootRoot --> MeetingDir
            end
            LayoutRoot --> LayoutRootRoot
            LayoutRoot --> LayoutRoot
        end
    end

    %% Infrastructure & External Services
    subgraph Infrastructure
        direction TB
        CDN["Vercel CDN / Static Assets"]:::infra
    end

    subgraph "External Service"
        direction TB
        StreamAPI["Stream API (calls & chat)"]:::external
    end

    %% Data Flows
    UI -->|HTTP| AppRouter
    AppRouter -->|REST/WebSocket| StreamAPI
    UI -->|RTC/WebSocket| StreamAPI
    AppRouter -->|Deploys static| CDN
    UI -->|Fetch via Hooks| Actions

    %% Click Events
    click AppRouter "https://github.com/ashrithsathu/pawvc/tree/main/app/"
    click SignInDir "https://github.com/ashrithsathu/pawvc/tree/main/app/(auth)/sign-in"
    click SignInPage "https://github.com/ashrithsathu/pawvc/blob/main/app/(auth)/sign-in/[[...sign-in]]/page.tsx"
    click SignUpDir "https://github.com/ashrithsathu/pawvc/tree/main/app/(auth)/sign-up"
    click SignUpPage "https://github.com/ashrithsathu/pawvc/blob/main/app/(auth)/sign-up/[[...sign-up]]/page.tsx"
    click HomeDir "https://github.com/ashrithsathu/pawvc/tree/main/app/(root)/(home)"
    click HomePage "https://github.com/ashrithsathu/pawvc/blob/main/app/(root)/(home)/page.tsx"
    click PersonalRoom "https://github.com/ashrithsathu/pawvc/blob/main/app/(root)/(home)/personal-room/page.tsx"
    click Previous "https://github.com/ashrithsathu/pawvc/blob/main/app/(root)/(home)/previous/page.tsx"
    click Upcoming "https://github.com/ashrithsathu/pawvc/blob/main/app/(root)/(home)/upcoming/page.tsx"
    click Recordings "https://github.com/ashrithsathu/pawvc/blob/main/app/(root)/(home)/recordings/page.tsx"
    click MeetingDir "https://github.com/ashrithsathu/pawvc/tree/main/app/(root)/meeting/[id]"
    click MeetingPage "https://github.com/ashrithsathu/pawvc/blob/main/app/(root)/meeting/[id]/page.tsx"
    click LayoutRoot "https://github.com/ashrithsathu/pawvc/blob/main/app/layout.tsx"
    click LayoutRootRoot "https://github.com/ashrithsathu/pawvc/blob/main/app/(root)/layout.tsx"
    click Actions "https://github.com/ashrithsathu/pawvc/blob/main/actions/stream.actions.ts"
    click Utils "https://github.com/ashrithsathu/pawvc/blob/main/lib/utils.ts"
    click Middleware "https://github.com/ashrithsathu/pawvc/blob/main/middleware.ts"

    %% Styles
    classDef ui fill:#f9f,stroke:#333,stroke-width:1px,shape:roundrect
    classDef client fill:#bbf,stroke:#333,stroke-width:1px,shape:roundrect
    classDef server fill:#9cf,stroke:#333,stroke-width:1px
    classDef infra fill:#ccc,stroke:#333,stroke-width:1px
    classDef external fill:#bfb,stroke:#333,stroke-width:1px
    class Middleware,CDN infra
    class StreamAPI external
    class UI client
    class Provider client
    class Hooks client
```
