# xuej41/qhacks25 architecture

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

- Interactive diagram: https://gitdiagram.com/xuej41/qhacks25
- Repository: https://github.com/xuej41/qhacks25

## Overview

##### Main Components

Frontend Layer:
- Next.js Application (App Router)
- Client-side Components
- Server-side Components
- Authentication Pages
- Protected Routes
- Admin Interface

Backend Layer:
- Supabase Backend
- Authentication Service
- Database
- API Layer

Middleware Layer:
- Authentication Middleware
- Supabase SSR Configuration

**┌─ Next.js Frontend ─────────────────────┐**
- Public Pages                        │
- Home, Items List                 │
- Auth Pages                          │
- Sign In, Sign Up, Reset Password │
- Protected Pages                     │
- Admin, Protected Content         │
- Components                          │
- UI Components, Forms             │
- ┘

**┌─ Middleware ──────────────────────────┐**
- Auth Middleware                    │
- Supabase SSR Configuration        │
- ┘

**┌─ Supabase Backend ───────────────────┐**
- Authentication Service            │
- Database                          │
- API Endpoints                     │
- ┘

##### Key Interactions to Highlight

- Authentication flow between frontend and Supabase Auth
- API calls between frontend and backend
- Data flow through middleware
- Server-side rendering path

##### Implementation Details

Technical annotations for:
- Next.js App Router usage
- Supabase-ssr integration
- Environment variables configuration
- Middleware implementation
- API route handlers

##### Additional Elements

- Third-party integrations (Tailwind CSS, shadcn/ui)
- Deployment flow to Vercel
- Environment variable management

##### The separation of concerns between different components

This structure accurately represents the project's architecture while maintaining clarity and showing the key interactions between components.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        NextApp["Next.js Application"]:::frontend
        
        subgraph PublicPages["Public Pages"]
            Home["Home Page"]:::page
            ItemsList["Items List"]:::page
            ItemDetail["Item Detail"]:::page
        end
        
        subgraph AuthPages["Authentication Pages"]
            SignIn["Sign In"]:::auth
            SignUp["Sign Up"]:::auth
            ForgotPass["Password Reset"]:::auth
        end
        
        subgraph ProtectedPages["Protected Pages"]
            Admin["Admin Interface"]:::protected
            Protected["Protected Content"]:::protected
            ResetPass["Reset Password"]:::protected
        end
        
        subgraph Components
            UIComps["UI Components"]:::component
            SharedComps["Shared Components"]:::component
            FormComps["Form Components"]:::component
        end
    end
    
    subgraph Middleware
        AuthMiddleware["Authentication Middleware"]:::middleware
        SupabaseSSR["Supabase SSR Config"]:::middleware
    end
    
    subgraph Backend
        subgraph SupabaseBackend["Supabase Backend"]
            AuthService["Authentication Service"]:::auth
            Database[(Database)]:::database
            
            subgraph APILayer["API Layer"]
                AuthAPI["Auth API"]:::api
                ItemsAPI["Items API"]:::api
                BiddingAPI["Bidding API"]:::api
            end
        end
    end
    
    %% Connections
    NextApp --> AuthMiddleware
    AuthMiddleware --> SupabaseSSR
    SupabaseSSR --> SupabaseBackend
    APILayer --> Database
    AuthService --> Database
    
    %% Component Mappings
    click SignIn "https://github.com/xuej41/qhacks25/blob/main/app/(auth-pages)/sign-in/page.tsx"
    click SignUp "https://github.com/xuej41/qhacks25/blob/main/app/(auth-pages)/sign-up/page.tsx"
    click ForgotPass "https://github.com/xuej41/qhacks25/blob/main/app/(auth-pages)/forgot-password/page.tsx"
    click Protected "https://github.com/xuej41/qhacks25/tree/main/app/protected/"
    click Admin "https://github.com/xuej41/qhacks25/tree/main/app/admin/"
    click ResetPass "https://github.com/xuej41/qhacks25/tree/main/app/protected/reset-password/"
    click Home "https://github.com/xuej41/qhacks25/blob/main/app/page.tsx"
    click ItemsList "https://github.com/xuej41/qhacks25/blob/main/app/items/page.tsx"
    click ItemDetail "https://github.com/xuej41/qhacks25/blob/main/app/item/[id]/page.tsx"
    click AuthAPI "https://github.com/xuej41/qhacks25/blob/main/app/api/sign-in/route.ts"
    click ItemsAPI "https://github.com/xuej41/qhacks25/blob/main/app/api/auction_items/route.ts"
    click BiddingAPI "https://github.com/xuej41/qhacks25/blob/main/app/api/bid/route.ts"
    click UIComps "https://github.com/xuej41/qhacks25/tree/main/app/components/"
    click SharedComps "https://github.com/xuej41/qhacks25/tree/main/components/"
    click FormComps "https://github.com/xuej41/qhacks25/tree/main/components/ui/"
    click SupabaseSSR "https://github.com/xuej41/qhacks25/blob/main/utils/supabase/server.ts"
    click AuthMiddleware "https://github.com/xuej41/qhacks25/blob/main/middleware.ts"
    
    %% Styles
    classDef frontend fill:#2563eb,color:white
    classDef page fill:#3b82f6,color:white
    classDef auth fill:#f97316,color:white
    classDef protected fill:#9333ea,color:white
    classDef component fill:#4b5563,color:white
    classDef middleware fill:#6b7280,color:white
    classDef api fill:#22c55e,color:white
    classDef database fill:#7e22ce,color:white
    
    %% Legend
    subgraph Legend
        Frontend_["Frontend"]:::frontend
        Page["Page"]:::page
        Auth["Authentication"]:::auth
        Protected_["Protected"]:::protected
        Component["Component"]:::component
        Middleware_["Middleware"]:::middleware
        API["API"]:::api
        DB[(Database)]:::database
    end
```
