# neslang-05/zenith architecture

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

- Interactive diagram: https://gitdiagram.com/neslang-05/zenith
- Repository: https://github.com/neslang-05/zenith

## Overview

##### Project type and purpose
- This is a full-stack, role-based web application built with Next.js (App Router) that serves three user groups—administrators, faculty, and students—for managing and viewing academic results.
- The README confirms it’s a “Result Management System” called Zenith, using Firebase Auth, Firestore, and serverless functions for CSV import, PDF generation, and email notifications.

##### File structure
- Top-level “app” directory: Next.js v13 App Router with nested folders for “admin,” “faculty,” “student,” plus shared pages like “login,” “signup,” “privacy,” etc.
- “components” & “components/ui”: Custom React components and a UI library (buttons, tables, dialogs, etc.).
- “hooks”: Custom React hooks (use-mobile, use-toast).
- “lib”: Core business logic and integration helpers—Firebase config (`firebase.ts`), auth utilities, emailActions, CSV parsing, PDF generator, generic utils.
- Configuration files: `next.config.mjs`, `tailwind.config.js`, `tsconfig.json`, PostCSS config.
- Public assets: Static avatars under “public.”

##### README for additional insights
- Tech stack: Next.js + Tailwind CSS on the frontend; Firebase Auth, Firestore, and Firebase Functions on the backend.
- Database design: Firestore collections for Users, Results, Classes, Analytics.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend"
        direction TB
        Browser["Web Browser"]:::external
        subgraph "Next.js App Router"
            direction TB
            App["Full-Stack App Router"]:::frontend
            subgraph "Admin UI"
                direction TB
                AdmAdd["Add Results"]:::frontend
                AdmConsole["Console"]:::frontend
                AdmDash["Dashboard"]:::frontend
                AdmManage["Manage Students"]:::frontend
            end
            subgraph "Faculty UI"
                direction TB
                FacLayout["FacultyLayout"]:::frontend
                FacDash["Faculty Dashboard"]:::frontend
            end
            subgraph "Student UI"
                direction TB
                StuLayout["StudentLayout"]:::frontend
                StuDash["Student Dashboard"]:::frontend
                StuProf["Profile"]:::frontend
                StuRes["Result"]:::frontend
                StuSet["Settings"]:::frontend
            end
            subgraph "Shared Pages"
                direction TB
                Login["Login"]:::frontend
                Signup["Signup"]:::frontend
                Privacy["Privacy"]:::frontend
                Terms["Terms"]:::frontend
                HomeMain["Home"]:::frontend
                Demo["Demo"]:::frontend
            end
        end
        subgraph "UI Components"
            direction TB
            ZenLogin["ZenithLogin"]:::frontend
            ZenReg["ZenithRegistration"]:::frontend
            ThemeProv["Theme Provider"]:::frontend
            UILib["UI Component Library"]:::frontend
        end
        subgraph "Custom Hooks"
            direction TB
            MobileHook["use-mobile"]:::frontend
            ToastHook["use-toast"]:::frontend
        end
        Browser --> App
        App --> AdmAdd
        App --> AdmConsole
        App --> AdmDash
        App --> AdmManage
        App --> FacLayout
        App --> FacDash
        App --> StuLayout
        App --> StuDash
        App --> StuProf
        App --> StuRes
        App --> StuSet
        App --> Login
        App --> Signup
        App --> Privacy
        App --> Terms
        App --> HomeMain
        App --> Demo
        App --> ZenLogin
        App --> ZenReg
        App --> ThemeProv
        App --> UILib
        App --> MobileHook
        App --> ToastHook
    end

    %% Serverless/API Layer
    subgraph "Serverless/API"
        direction TB
        APIRoutes["Next.js API Routes"]:::backend
        EA["emailActions.ts"]:::backend
        EmailRoute["Email Route"]:::backend
        APIRoutes --> EA
        APIRoutes --> EmailRoute
    end
    App --> APIRoutes

    %% Library & Middleware
    subgraph "Library & Middleware"
        direction TB
        FirebaseConfig["Firebase Config"]:::backend
        AuthHelpers["Auth Helpers"]:::backend
        Utils["Utils (CSV,Pdf)"]:::backend
        EmailService["Email Service"]:::backend
    end
    APIRoutes --> FirebaseConfig
    APIRoutes --> AuthHelpers
    APIRoutes --> Utils
    APIRoutes --> EmailService

    %% Firebase Services
    subgraph "Firebase Services"
        direction TB
        Auth["Firebase Auth"]:::service
        Firestore["Firestore DB"]:::db
        Functions["Firebase Functions"]:::service
    end
    AuthHelpers --> Auth
    FirebaseConfig --> Auth
    FirebaseConfig --> Firestore
    Utils --> Functions
    EA --> Functions
    EmailService --> Functions
    APIRoutes --> Functions

    %% External Services
    subgraph "External"
        direction TB
        EmailProvider["SMTP/SendGrid"]:::external
        CDN["Static Assets CDN"]:::external
    end
    EmailService --> EmailProvider
    Browser --> CDN

    %% Click Events
    click App "https://github.com/neslang-05/zenith/tree/master/app/"
    click AdmAdd "https://github.com/neslang-05/zenith/blob/master/app/admin/add-results/page.tsx"
    click AdmConsole "https://github.com/neslang-05/zenith/blob/master/app/admin/console/page.tsx"
    click AdmDash "https://github.com/neslang-05/zenith/blob/master/app/admin/dashboard/page.tsx"
    click AdmManage "https://github.com/neslang-05/zenith/blob/master/app/admin/manage-students/page.tsx"
    click FacLayout "https://github.com/neslang-05/zenith/blob/master/app/faculty/FacultyLayout.tsx"
    click FacDash "https://github.com/neslang-05/zenith/blob/master/app/faculty/dashboard/page.tsx"
    click StuLayout "https://github.com/neslang-05/zenith/blob/master/app/student/StudentLayout.tsx"
    click StuDash "https://github.com/neslang-05/zenith/blob/master/app/student/dashboard/page.tsx"
    click StuProf "https://github.com/neslang-05/zenith/blob/master/app/student/profile/page.tsx"
    click StuRes "https://github.com/neslang-05/zenith/blob/master/app/student/result/page.tsx"
    click StuSet "https://github.com/neslang-05/zenith/blob/master/app/student/setting/page.tsx"
    click Login "https://github.com/neslang-05/zenith/blob/master/app/login/page.tsx"
    click Signup "https://github.com/neslang-05/zenith/blob/master/app/signup/page.tsx"
    click Privacy "https://github.com/neslang-05/zenith/blob/master/app/privacy/page.tsx"
    click Terms "https://github.com/neslang-05/zenith/blob/master/app/terms/page.tsx"
    click HomeMain "https://github.com/neslang-05/zenith/blob/master/app/page.tsx"
    click Demo "https://github.com/neslang-05/zenith/blob/master/app/demo/page.tsx"
    click ZenLogin "https://github.com/neslang-05/zenith/blob/master/components/ZenithLogin.tsx"
    click ZenReg "https://github.com/neslang-05/zenith/blob/master/components/ZenithRegistration.tsx"
    click ThemeProv "https://github.com/neslang-05/zenith/blob/master/components/theme-provider.tsx"
    click UILib "https://github.com/neslang-05/zenith/tree/master/components/ui/"
    click MobileHook "https://github.com/neslang-05/zenith/blob/master/hooks/use-mobile.tsx"
    click ToastHook "https://github.com/neslang-05/zenith/blob/master/hooks/use-toast.ts"
    click EA "https://github.com/neslang-05/zenith/blob/master/app/api/actions/emailActions.ts"
    click EmailRoute "https://github.com/neslang-05/zenith/blob/master/app/api/email/route.ts"
    click FirebaseConfig "https://github.com/neslang-05/zenith/blob/master/lib/firebase.ts"
    click AuthHelpers "https://github.com/neslang-05/zenith/blob/master/lib/auth.js"
    click Utils "https://github.com/neslang-05/zenith/blob/master/lib/utils.ts"
    click EmailService "https://github.com/neslang-05/zenith/blob/master/lib/emailService.ts"

    %% Styles
    classDef frontend fill:#AAF,stroke:#333,stroke-width:1px
    classDef backend fill:#FAA,stroke:#333,stroke-width:1px
    classDef service fill:#AFA,stroke:#333,stroke-width:1px
    classDef db fill:#FFA,stroke:#333,stroke-width:1px
    classDef external fill:#CCC,stroke:#333,stroke-width:1px
```
