# arjun010011/main-project architecture

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

- Interactive diagram: https://gitdiagram.com/arjun010011/main-project
- Repository: https://github.com/arjun010011/main-project

## Overview

##### Project type and purpose
- This is a full-stack Next.js 13 web application for an educational testing platform.
- It provides:
- Student and teacher authentication (email/password + Google OAuth)
- Teacher-led test creation, live test orchestration, analytics
- Student-focused test participation and result tracking

##### File structure
- app/
- (auth)/private/{studentDashboard,teacherDashboard}/… – Authenticated UI routes and layout
- (auth)/signin & (auth)/signup – Public auth pages
- api/auth/* – Serverless routes for signup, signin, logout, Google OAuth
- api/classRoom/* – Classroom and test management REST endpoints (create, fetch, live test, analytics, etc.)
- Pages for About, Contact, Features, Pricing
- Shared UI components under app/components
- components/ui/ – Low-level design system (buttons, cards, dropdowns)
- lib/
- prisma.js – ORM client for primary database
- firebase.js – Firebase init (e.g., for push notifications or auth hooks)
- store/userStore.js – Client-side state management
- prisma/schema.prisma – Data model for PostgreSQL or compatible SQL database
- utils/supabaseClient.js – Supabase real-time client for live test events
- next.config.mjs, tsconfig/jsconfig, ESLint, PostCSS – Configuration for build/deploy

##### README insights
- Bootstrapped with create-next-app, deployed on Vercel
- Uses next/font for optimized font loading

##### Elements
- Blue rectangles for UI components/pages
- Green for serverless functions/API routes
- Gray clouds for external services (Google OAuth, Vercel hosting)
- Annotations for data flow: e.g., “JWT token”, “session cookie”, “Prisma query”

##### Essential architectural elements without over-splitting
- Client-side state store (userStore.js) as part of the Presentation Layer
- Supabase client in both Application and Presentation layers for real-time subscription/publish

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        subgraph "Authentication UI" 
            direction TB
            SS["Student Sign-In"]:::frontend
            TS["Teacher Sign-In"]:::frontend
            SU["Student Sign-Up"]:::frontend
            TU["Teacher Sign-Up"]:::frontend
        end
        subgraph "Authenticated Layout & Dashboards"
            direction TB
            AL["Auth Layout"]:::frontend
            SD["Student Dashboard"]:::frontend
            TD["Teacher Dashboard"]:::frontend
        end
        subgraph "Public Pages"
            direction TB
            About["About"]:::frontend
            Contact["Contact"]:::frontend
            Features["Features"]:::frontend
            Pricing["Pricing"]:::frontend
            Faq["FAQ"]:::frontend
        end
        subgraph "Shared UI Components"
            direction TB
            Header["Header"]:::frontend
            Footer["Footer"]:::frontend
            GAuthBtn["GoogleAuthButton"]:::frontend
            SHeader["StudentHeader"]:::frontend
            THeader["TeacherHeader"]:::frontend
            UIButton["Button UI"]:::frontend
            UICard["Card UI"]:::frontend
            UIDropdown["Dropdown UI"]:::frontend
        end
        US["UserStore"]:::frontend
    end

    %% Application Layer
    subgraph "Application Layer (Next.js Serverless)"
        direction TB
        subgraph "Auth Service" 
            direction TB
            AS1["signupStudent"]:::api
            AS2["signinStudent"]:::api
            AS3["signupTeacher"]:::api
            AS4["signinTeacher"]:::api
            AS5["logout"]:::api
            AS6["googleAuthRoute"]:::api
            AS7["verify"]:::api
        end
        subgraph "Classroom Service"
            direction TB
            CS1["createClassroom"]:::api
            CS2["joinClassroom"]:::api
            CS3["submitTest"]:::api
            CS4["goLive"]:::api
            CS5["endLiveTest"]:::api
            CS6["getClassAnalytics"]:::api
            CS7["getStudentAnalytics"]:::api
        end
        Prisma["Prisma ORM"]:::api
        FirebaseSDK["Firebase SDK"]:::api
        SupabaseClientApp["Supabase Client"]:::realtime
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        SQLDB["PostgreSQL DB"]:::db
        SupabaseRT["Supabase Realtime"]:::realtime
        FirebaseSvc["Firebase Service"]:::ext
        GoogleOAuth["Google OAuth"]:::ext
        Vercel["Vercel Hosting"]:::ext
    end

    %% Connections
    SS -->|HTTP| AS2
    TS -->|HTTP| AS4
    SU -->|HTTP| AS1
    TU -->|HTTP| AS3
    AL --> AS5
    AL --> AS7
    SD -->|HTTP| CS3
    SD -->|WS| SupabaseRT
    SD -->|state| US
    TD -->|HTTP| CS1
    TD -->|HTTP| CS4
    TD -->|HTTP| CS6
    TD -->|WS| SupabaseRT
    GAuthBtn -->|redirect| GoogleOAuth
    GAuthBtn --> AS6
    AS6 -->|token| AS7
    AS1 --> Prisma
    AS2 --> Prisma
    AS3 --> Prisma
    AS4 --> Prisma
    AS5 --> FirebaseSDK
    AS7 --> Prisma
    CS1 --> Prisma
    CS2 --> Prisma
    CS3 --> Prisma
    CS4 --> Prisma
    CS5 --> Prisma
    CS6 --> Prisma
    CS7 --> Prisma
    CS4 -->|publish| SupabaseRT
    CS5 -->|publish| SupabaseRT
    SD --> SupabaseClientApp
    TD --> SupabaseClientApp
    US -->|hydrate| FirebaseSDK

    Prisma --> SQLDB
    FirebaseSDK --> FirebaseSvc
    SupabaseClientApp --> SupabaseRT
    Vercel --> AS1
    Vercel --> CS1

    %% Click Events
    click SS "https://github.com/arjun010011/main-project/blob/main/app/(auth)/(signin)/studentSignin/page.jsx"
    click TS "https://github.com/arjun010011/main-project/blob/main/app/(auth)/(signin)/teacherSignin/page.jsx"
    click SU "https://github.com/arjun010011/main-project/blob/main/app/(auth)/(signup)/studentSignup/page.jsx"
    click TU "https://github.com/arjun010011/main-project/blob/main/app/(auth)/(signup)/teacherSignup/page.jsx"
    click AL "https://github.com/arjun010011/main-project/blob/main/app/(auth)/(private)/layout.jsx"
    click SD "https://github.com/arjun010011/main-project/blob/main/app/(auth)/(private)/studentDashboard/page.jsx"
    click TD "https://github.com/arjun010011/main-project/blob/main/app/(auth)/(private)/teacherDashboard/page.jsx"
    click About "https://github.com/arjun010011/main-project/blob/main/app/About/page.jsx"
    click Contact "https://github.com/arjun010011/main-project/blob/main/app/Contact/page.jsx"
    click Features "https://github.com/arjun010011/main-project/blob/main/app/Features/page.jsx"
    click Pricing "https://github.com/arjun010011/main-project/blob/main/app/Pricing/page.jsx"
    click Faq "https://github.com/arjun010011/main-project/blob/main/app/Faq/page.jsx"
    click Header "https://github.com/arjun010011/main-project/blob/main/app/components/Header.jsx"
    click Footer "https://github.com/arjun010011/main-project/blob/main/app/components/Footer.jsx"
    click GAuthBtn "https://github.com/arjun010011/main-project/blob/main/app/components/GoogleAuthButton.jsx"
    click SHeader "https://github.com/arjun010011/main-project/blob/main/app/components/StudentHeader.jsx"
    click THeader "https://github.com/arjun010011/main-project/blob/main/app/components/TeacherHeader.jsx"
    click UIButton "https://github.com/arjun010011/main-project/blob/main/components/ui/button.jsx"
    click UICard "https://github.com/arjun010011/main-project/blob/main/components/ui/card.jsx"
    click UIDropdown "https://github.com/arjun010011/main-project/blob/main/components/ui/dropdown-menu.jsx"
    click AS1 "https://github.com/arjun010011/main-project/blob/main/app/api/auth/signupStudent/route.js"
    click AS2 "https://github.com/arjun010011/main-project/blob/main/app/api/auth/signinStudent/route.js"
    click AS3 "https://github.com/arjun010011/main-project/blob/main/app/api/auth/signupTeacher/route.js"
    click AS4 "https://github.com/arjun010011/main-project/blob/main/app/api/auth/signinTeacher/route.js"
    click AS5 "https://github.com/arjun010011/main-project/blob/main/app/api/auth/logout/route.js"
    click AS6 "https://github.com/arjun010011/main-project/blob/main/app/api/auth/googleAuthRoute/route.js"
    click AS7 "https://github.com/arjun010011/main-project/blob/main/app/api/auth/verify/route.js"
    click CS1 "https://github.com/arjun010011/main-project/blob/main/app/api/classRoom/createClassroom/route.js"
    click CS2 "https://github.com/arjun010011/main-project/blob/main/app/api/classRoom/joinClassroom/route.js"
    click CS3 "https://github.com/arjun010011/main-project/blob/main/app/api/classRoom/submitTest/route.js"
    click CS4 "https://github.com/arjun010011/main-project/blob/main/app/api/classRoom/goLive/route.js"
    click CS5 "https://github.com/arjun010011/main-project/blob/main/app/api/classRoom/endLiveTest/route.js"
    click CS6 "https://github.com/arjun010011/main-project/blob/main/app/api/classRoom/getClassAnalytics/route.js"
    click CS7 "https://github.com/arjun010011/main-project/blob/main/app/api/classRoom/getStudentAnalytics/route.js"
    click Prisma "https://github.com/arjun010011/main-project/blob/main/lib/prisma.js"
    click FirebaseSDK "https://github.com/arjun010011/main-project/blob/main/lib/firebase.js"
    click SupabaseClientApp "https://github.com/arjun010011/main-project/blob/main/utils/supabaseClient.js"
    click US "https://github.com/arjun010011/main-project/blob/main/lib/store/userStore.js"
    click SQLDB "https://github.com/arjun010011/main-project/blob/main/prisma/schema.prisma"
    click Vercel "https://github.com/arjun010011/main-project/blob/main/next.config.mjs"

    %% Styles
    classDef frontend fill:#D6E9FE,stroke:#3B82F6
    classDef api fill:#D1FAE5,stroke:#10B981
    classDef db fill:#FED7AA,stroke:#F59E0B
    classDef ext fill:#E5E7EB,stroke:#6B7280
    classDef realtime fill:#F5E1FE,stroke:#A855F7
```
