# t4ko0522/connectix2 architecture

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

- Interactive diagram: https://gitdiagram.com/t4ko0522/connectix2
- Repository: https://github.com/t4ko0522/connectix2

## Overview

##### Project type and purpose
- Connectix2 is a full-stack, containerized Next.js 15 application (React 18 + TypeScript) that provides a profile-creation platform tailored for VRChat users.
- It uses SSR/SSG for performance, custom API routes for authentication and profile management, and integrates with external services (Supabase, VRChat API, email).

##### Main architectural components
A. User’s Web Browser
- Issues HTTP requests to pages & API endpoints; renders React-driven UI.
B. Next.js Application (deployed in AWS EKS / Kubernetes)
- Frontend (app/* & components/*): SSR/SSG pages, client-side React.
- Backend (app/api/*): Node.js API routes handling login, signup, password reset, VRChat OAuth, 2FA, etc.
- Shared libraries (lib/): supabaseClient.ts (DB/auth), sendMail.ts (email), utils.
C. Supabase (External Service)
- PostgreSQL database, authentication, storage (if used).
D. VRChat API (External OAuth Service)
- Handles user login, token verification, 2FA workflows.
E. Email Delivery Service (SMTP or 3rd-party API)
- Accepts requests from sendMail.ts to dispatch verification & reset emails.

##### Relationships & data flows
1. User → Next.js Frontend
- Requests a profile or dashboard page → served via SSR or SSG.
2. Frontend → Next.js API
- On signup/login/password reset → fetch() calls to `/api/auth/*` routes.
3. API → Supabase
- Reads/writes user records, session tokens, profile data.
4. API → VRChat API
- Performs OAuth login flows, 2FA verification.
5. API → Email Service
- Triggers signup verification & reset emails.
6. Supabase/Database → API → Frontend
- Returns user data, links, settings for rendering.

##### Architectural patterns & design principles
- File-based routing (Next.js “app” directory) separates page-level concerns.
- API routes co-located with frontend for single monorepo, single container.
- Contexts/hooks (contexts/, hooks/) for global state management (loading, toast notifications).
- shadcn/ui + Radix + Tailwind for design system (components/ui/*).
- SSR/SSG for SEO and performance.
- Containerized deployment on Kubernetes for scalability and resilience.

##### Technologies & frameworks to call out
- Next.js 15 (React 18), TypeScript
- Supabase (client & DB)
- Node.js API routes
- Tailwind CSS, shadcn/ui, Radix UI
- AWS EKS + Kubernetes, GitHub Actions/CodePipeline (CI/CD)
- External APIs: VRChat OAuth, Email service (SMTP/SendGrid)

##### Final checklist
- Clear labels on every component and folder cluster.
- Notes on SSR/SSG, CI/CD, and container deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Browser
    User[/"User Browser"/]:::user

    %% Kubernetes Cluster
    subgraph "AWS EKS / Kubernetes"
        direction TB
        subgraph "Next.js Container"
            direction TB

            subgraph "Frontend Layer"
                direction TB
                App["app"]:::frontend
                Home["Home Page\npage.tsx"]:::frontend
                Layout["Global Layout\nlayout.tsx"]:::frontend
                LoginPage["Login Page\nlogin/page.tsx"]:::frontend
                SignupPage["Signup Page\nsignup/page.tsx"]:::frontend
                DashboardPage["Dashboard Page\ndashboard/page.tsx"]:::frontend
                VRLogin["VRChat Login Page\nvrchat-login/page.tsx"]:::frontend
                VR2FA["VRChat 2FA Page\nvrchat-2fa/page.tsx"]:::frontend
                ResetRequest["Reset Request Page\nreset-password/page.tsx"]:::frontend
                ResetVerify["Reset Verify Page\nreset-password/verify/page.tsx"]:::frontend
                ResetNew["New Password Page\nreset-password/new-password/page.tsx"]:::frontend
            end

            subgraph "API Layer"
                direction TB
                APIAuth["app/api/auth"]:::backend
                LoginRoute["Login Route\nlogin/route.ts"]:::backend
                SignupRoute["Signup Route\nsignup/route.ts"]:::backend
                VerifyEmail["Verify Email Route\nverify/route.ts"]:::backend
                ResendVerify["Resend Verification\nresend/route.ts"]:::backend
                ResetReqRoute["Reset Request Route\nreset/request/route.ts"]:::backend
                ResetCompRoute["Reset Complete Route\nreset/complete/route.ts"]:::backend
            end

            subgraph "Shared Services & UI"
                direction TB
                Lib["lib"]:::service
                SupaClient["supabaseClient.ts"]:::service
                MailClient["sendMail.ts"]:::service
                Utils["utils.ts"]:::service
                ComponentsUI["components/ui"]:::ui
                ComponentsDash["components/dashboard"]:::ui
                Contexts["contexts/loading-context.tsx"]:::service
                HooksMobile["hooks/use-mobile.tsx"]:::service
                HooksToast["hooks/use-toast.tsx"]:::service
                Styles["styles/globals.css"]:::service
                Config["next.config.mjs"]:::service
            end
        end
    end

    %% External Services
    Supabase[(Supabase\nPostgreSQL)]:::database
    VRChatAPI["VRChat API\n(OAuth, 2FA)"]:::external
    EmailSrv["Email Service\n(SMTP/SendGrid)"]:::external

    %% Data Flows
    User -->|"HTTP/SSR or Client Routing"| App
    App -->|"fetch()/HTTPS JSON"| APIAuth
    APIAuth -->|"SQL Queries"| Supabase
    APIAuth -->|"OAuth Requests"| VRChatAPI
    APIAuth -->|"SMTP/API Calls"| EmailSrv
    APIAuth -->|"JSON Responses"| App
    Supabase -->|"Data|API Responses"| APIAuth
    App -->|"Render UI"| User

    %% Legend
    subgraph Legend
        direction TB
        U[user]:::user
        F[Frontend Layer]:::frontend
        B[Backend Layer]:::backend
        S[Shared Services]:::service
        UI[UI Components]:::ui
        D[Database]:::database
        E[External Services]:::external
    end

    %% Click Events
    click App "https://github.com/t4ko0522/connectix2/tree/main/app"
    click Home "https://github.com/t4ko0522/connectix2/blob/main/app/page.tsx"
    click Layout "https://github.com/t4ko0522/connectix2/blob/main/app/layout.tsx"
    click LoginPage "https://github.com/t4ko0522/connectix2/blob/main/app/login/page.tsx"
    click SignupPage "https://github.com/t4ko0522/connectix2/blob/main/app/signup/page.tsx"
    click DashboardPage "https://github.com/t4ko0522/connectix2/blob/main/app/dashboard/page.tsx"
    click VRLogin "https://github.com/t4ko0522/connectix2/blob/main/app/vrchat-login/page.tsx"
    click VR2FA "https://github.com/t4ko0522/connectix2/blob/main/app/vrchat-2fa/page.tsx"
    click ResetRequest "https://github.com/t4ko0522/connectix2/blob/main/app/reset-password/page.tsx"
    click ResetVerify "https://github.com/t4ko0522/connectix2/blob/main/app/reset-password/verify/page.tsx"
    click ResetNew "https://github.com/t4ko0522/connectix2/blob/main/app/reset-password/new-password/page.tsx"
    click APIAuth "https://github.com/t4ko0522/connectix2/tree/main/app/api/auth"
    click LoginRoute "https://github.com/t4ko0522/connectix2/blob/main/app/api/auth/login/route.ts"
    click SignupRoute "https://github.com/t4ko0522/connectix2/blob/main/app/api/auth/signup/route.ts"
    click VerifyEmail "https://github.com/t4ko0522/connectix2/blob/main/app/api/auth/verify/route.ts"
    click ResendVerify "https://github.com/t4ko0522/connectix2/blob/main/app/api/auth/resend/route.ts"
    click ResetReqRoute "https://github.com/t4ko0522/connectix2/blob/main/app/api/auth/reset/request/route.ts"
    click ResetCompRoute "https://github.com/t4ko0522/connectix2/blob/main/app/api/auth/reset/complete/route.ts"
    click Lib "https://github.com/t4ko0522/connectix2/tree/main/lib"
    click SupaClient "https://github.com/t4ko0522/connectix2/blob/main/lib/supabaseClient.ts"
    click MailClient "https://github.com/t4ko0522/connectix2/blob/main/lib/sendMail.ts"
    click Utils "https://github.com/t4ko0522/connectix2/blob/main/lib/utils.ts"
    click ComponentsUI "https://github.com/t4ko0522/connectix2/tree/main/components/ui"
    click ComponentsDash "https://github.com/t4ko0522/connectix2/tree/main/components/dashboard"
    click Contexts "https://github.com/t4ko0522/connectix2/blob/main/contexts/loading-context.tsx"
    click HooksMobile "https://github.com/t4ko0522/connectix2/blob/main/hooks/use-mobile.tsx"
    click HooksToast "https://github.com/t4ko0522/connectix2/blob/main/hooks/use-toast.tsx"
    click Styles "https://github.com/t4ko0522/connectix2/blob/main/styles/globals.css"
    click Config "https://github.com/t4ko0522/connectix2/blob/main/next.config.mjs"

    %% Styles
    classDef user fill:#f9f,stroke:#333,stroke-width:1px
    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef backend fill:#d4edda,stroke:#333,stroke-width:1px
    classDef service fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef ui fill:#e2e3e5,stroke:#333,stroke-width:1px
    classDef database fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef external fill:#e0bbff,stroke:#333,stroke-width:1px
```
