# tekdi/all-saas-admin architecture

> Architecture diagram of the GitHub repository tekdi/all-saas-admin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tekdi/all-saas-admin
- Repository: https://github.com/tekdi/all-saas-admin

## Overview

##### Project Type and Purpose
- From the README (“Shiksha is a next-generation scalable open-source learning solution for teachers”) and the file tree (Next.js app, pages/, pages/api/, React components, services), this is a full-stack (mainly front-end with a thin Next.js API layer) Admin application.
- It is built with Next.js (React + Node) and TypeScript, serving server-side‐rendered and client‐side pages and exposing serverless API routes for authentication, file uploads, and proxying requests to backend services.

##### File Structure
- Top-level config: `.env`, `next.config.mjs`, `next-i18next.config.js`, `app.config.ts` – environment, i18n, build targets.
- `/src/pages` – Next.js pages for UI (SSR/SSG) plus `/api` subfolder for serverless functions.
- `/src/components` – Presentation/UI layer (modals, tables, forms, layout).
- `/src/services` – Client abstractions (RestClient + interceptors) and hooks/ methods calling external backend microservices (CohortService, UserService, MasterDataService).
- `/src/store` – Client state via Zustand/React context (AuthContext, stores for user, course planner, taxonomy).
- `/public` – Static assets and locale JSON for i18n.
- `/__tests__` + `jest.config.ts` – Unit tests for components and helpers.
- CI/CD: GitHub workflows in `.github/workflows` for dev, staging, prod deployments.

##### README for Additional Insights
- Confirms Next.js boilerplate, Node v18+, npm v10+.

##### Elements
- From Browser to Next.js Pages & API routes.
- From API routes to External Backends.
- From Services to Stores & Components.
- Blue for UI components
- Green for server‐side functions/API
- Orange for external services/datastores
- Purple for CI/CD pipeline

##### Final Advice
- Be exhaustive: include i18n, theming, testing, and CI/CD workflows as separate side‐bars or callouts.
- Review with the team to ensure each external microservice is represented and that environment variables (`.env`) point to the right endpoints.

## Diagram (Mermaid)

```mermaid
flowchart TD

    subgraph "Client (Browser)"
        Browser["Browser"]:::external
    end

    subgraph "Next.js App Server"
        subgraph "UI Layer"
            Pages["Next.js Pages"]:::ui
        end
        subgraph "API Routes"
            APIRoutes["Server-side API Routes"]:::api
        end
    end

    subgraph "Client State Management"
        AuthContext["AuthContext"]:::store
        CoursePlannerStore["Course Planner Store"]:::store
        ManageUserStore["User Management Store"]:::store
        TaxonomyStore["Taxonomy Store"]:::store
        GlobalStore["Global Store & Hooks"]:::store
    end

    subgraph "Service Infrastructure"
        RestClient["RestClient"]:::service
        Interceptor["HTTP Interceptor"]:::service
    end

    subgraph "Domain Services"
        LoginService["Authentication Service"]:::service
        UserList["User List Service"]:::service
        CreateUser["Create User Service"]:::service
        DeleteUser["Delete User Service"]:::service
        CohortServiceNode["Cohort Service"]:::service
        CoursePlannerService["Course Planner Service"]:::service
        MasterDataService["Master Data Service"]:::service
        NotificationService["Notification Service"]:::service
    end

    subgraph "Utilities & Config"
        Helper["Helper & Interfaces"]:::util
        Analytics["Analytics & Telemetry"]:::util
        Constants["Constants & Shared State"]:::util
        i18nConfig["i18n Config"]:::config
        LocaleFiles["Locale Files"]:::config
        Env["Environment Variables"]:::config
        NextConfig["Next.js Config"]:::config
        AppConfig["App Config"]:::config
        Styles["Styling & Theme"]:::util
    end

    subgraph "Testing"
        Tests["Unit Tests & Jest Config"]:::util
    end

    subgraph "CI/CD Pipeline"
        CICD["GitHub Actions"]:::ci
        DevEnv["Dev/Staging/Prod Deployments"]:::ci
    end

    subgraph "External Backend Microservices"
        AuthBackend["Auth Service API"]:::external
        UserMgmtAPI["User Management API"]:::external
        CohortAPI["Cohort/Course Planner API"]:::external
        MasterDataAPI["Master Data API"]:::external
        NotificationAPI["Notification API"]:::external
        FileStorage["File Upload Storage (S3)"]:::data
        ExternalDB["External Databases"]:::data
    end

    Browser -->|"HTTP/HTTPS"| Pages
    Browser -->|"AJAX|fetch"| APIRoutes
    Pages -->|"SSR/CSR"| Browser

    APIRoutes -->|"REST call via RestClient"| RestClient
    RestClient --> Interceptor
    Interceptor --> LoginService
    Interceptor --> UserList
    Interceptor --> CreateUser
    Interceptor --> DeleteUser
    Interceptor --> CohortServiceNode
    Interceptor --> CoursePlannerService
    Interceptor --> MasterDataService
    Interceptor --> NotificationService

    LoginService --> AuthBackend
    UserList --> UserMgmtAPI
    CreateUser --> UserMgmtAPI
    DeleteUser --> UserMgmtAPI
    CohortServiceNode --> CohortAPI
    CoursePlannerService --> CohortAPI
    MasterDataService --> MasterDataAPI
    NotificationService --> NotificationAPI
    AuthBackend --> ExternalDB
    UserMgmtAPI --> ExternalDB
    CohortAPI --> ExternalDB
    MasterDataAPI --> ExternalDB
    NotificationAPI --> ExternalDB
    FileStorage --> FileStorage

    Pages -->|"uses"| AuthContext
    Pages -->|"uses"| CoursePlannerStore
    Pages -->|"uses"| ManageUserStore
    Pages -->|"uses"| TaxonomyStore
    Pages -->|"uses"| GlobalStore

    CohortServiceNode -->|"updates"| CoursePlannerStore
    LoginService -->|"updates"| AuthContext
    UserList -->|"updates"| ManageUserStore

    CICD -->|"on push"| DevEnv
    DevEnv --> Pages
    DevEnv --> APIRoutes

    click Pages "https://github.com/tekdi/all-saas-admin/tree/main/src/pages/"
    click APIRoutes "https://github.com/tekdi/all-saas-admin/tree/main/src/pages/api/"
    click AuthContext "https://github.com/tekdi/all-saas-admin/blob/main/src/context/AuthContext.js"
    click CoursePlannerStore "https://github.com/tekdi/all-saas-admin/blob/main/src/store/coursePlannerStore.js"
    click ManageUserStore "https://github.com/tekdi/all-saas-admin/blob/main/src/store/manageUserStore.js"
    click TaxonomyStore "https://github.com/tekdi/all-saas-admin/blob/main/src/store/tanonomyStore.js"
    click GlobalStore "https://github.com/tekdi/all-saas-admin/blob/main/src/store/store.js"
    click GlobalStore "https://github.com/tekdi/all-saas-admin/blob/main/src/store/useUserIdStore.ts"
    click RestClient "https://github.com/tekdi/all-saas-admin/blob/main/src/services/RestClient.ts"
    click Interceptor "https://github.com/tekdi/all-saas-admin/blob/main/src/services/Interceptor.ts"
    click LoginService "https://github.com/tekdi/all-saas-admin/blob/main/src/services/LoginService.ts"
    click UserList "https://github.com/tekdi/all-saas-admin/blob/main/src/services/UserList.ts"
    click CreateUser "https://github.com/tekdi/all-saas-admin/blob/main/src/services/CreateUserService.ts"
    click DeleteUser "https://github.com/tekdi/all-saas-admin/blob/main/src/services/DeleteUser.ts"
    click CohortServiceNode "https://github.com/tekdi/all-saas-admin/blob/main/src/services/CohortService/cohortService.ts"
    click CoursePlannerService "https://github.com/tekdi/all-saas-admin/blob/main/src/services/coursePlanner.ts"
    click MasterDataService "https://github.com/tekdi/all-saas-admin/blob/main/src/services/MasterDataService.ts"
    click NotificationService "https://github.com/tekdi/all-saas-admin/blob/main/src/services/NotificationService.ts"
    click Helper "https://github.com/tekdi/all-saas-admin/blob/main/src/utils/Helper.ts"
    click Analytics "https://github.com/tekdi/all-saas-admin/blob/main/src/utils/googleAnalytics.ts"
    click Constants "https://github.com/tekdi/all-saas-admin/blob/main/src/utils/app.constant.ts"
    click i18nConfig "https://github.com/tekdi/all-saas-admin/blob/main/next-i18next.config.js"
    click LocaleFiles "https://github.com/tekdi/all-saas-admin/blob/main/public/locales/en/common.json"
    click Env "https://github.com/tekdi/all-saas-admin/blob/main/.env"
    click NextConfig "https://github.com/tekdi/all-saas-admin/blob/main/next.config.mjs"
    click AppConfig "https://github.com/tekdi/all-saas-admin/blob/main/app.config.ts"
    click Styles "https://github.com/tekdi/all-saas-admin/blob/main/src/styles/globals.css"
    click Tests "https://github.com/tekdi/all-saas-admin/tree/main/__tests__"
    click CICD "https://github.com/tekdi/all-saas-admin/blob/main/.github/workflows/dev-all-saas-deployment.yaml"

    classDef ui fill:#CEF,stroke:#036;
    classDef api fill:#CFC,stroke:#036;
    classDef service fill:#FCF,stroke:#036;
    classDef external fill:#EEF,stroke:#036;
    classDef data fill:#FCE,stroke:#036;
    classDef store fill:#CCF,stroke:#036;
    classDef util fill:#EEE,stroke:#036;
    classDef config fill:#FFB,stroke:#036;
    classDef ci fill:#DFA,stroke:#036;
```
