# sanjeevadharshini/org_std_arch architecture

> Architecture diagram of the GitHub repository sanjeevadharshini/org_std_arch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sanjeevadharshini/org_std_arch
- Repository: https://github.com/sanjeevadharshini/org_std_arch

## Overview

Triune is a multi-tenant SaaS starter with a React client and an Express/MongoDB API. The primary workflow is user sign-in, token-backed access to the student dashboard, and tenant-scoped student operations; the client also exposes a component gallery. The graph includes the documented authentication, tenant isolation, and role-based access capabilities. Some backend domains and client features are represented at subsystem level because their implementation was not excerpted; unsupported internal links are omitted.

Main entry points: [`client/src/app/App.tsx`](https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/app/App.tsx) (App routing), [`server/src/modules/students/student.routes.ts`](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/students/student.routes.ts) (Student routes), [`server/src/modules/auth/auth.controller.ts`](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/auth/auth.controller.ts) (Auth controller), [`server/src/modules/students/student.controller.ts`](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/students/student.controller.ts) (Student controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App routing<br/>[App.tsx]"]
  node_login["Login page<br/>[LoginPage.tsx]"]
  node_studentview["Student list"]
  node_gallery["Component gallery"]
  node_authclient["Auth service<br/>[auth.service.ts]"]
  node_studentclient["Student service<br/>[student.service.ts]"]
  node_api_client["API client<br/>[apiClient.ts]"]
  node_interceptors["Token refresh<br/>[interceptors.ts]"]
  node_ui["Reusable UI"]
end

subgraph group_api["API and access"]
  node_auth_routes["Auth routes<br/>[auth.routes.ts]"]
  node_auth_controller["Auth controller<br/>[auth.controller.ts]"]
  node_auth_middleware["Authentication<br/>[auth.middleware.ts]"]
  node_student_routes["Student routes<br/>[student.routes.ts]"]
  node_server_app["Express app<br/>[app.ts]"]
  node_roles["Role authorization<br/>[role.middleware.ts]"]
end

subgraph group_domains["SaaS domains"]
  node_auth_service["Auth service<br/>[auth.service.ts]"]
  node_student_controller["Student controller"]
  node_student_service["Student service<br/>[student.service.ts]"]
  node_student_repo["Student repository"]
  node_tenant_users["Tenant and user domains"]
end

subgraph group_platform["Shared platform"]
  node_tenant_context["Tenant context<br/>[tenant-context.ts]"]
  node_tenant_repo["Tenant repository base"]
  node_mongo[("MongoDB")]
  node_response["Response contract<br/>[response.ts]"]
  node_email["Email notifications<br/>[email.service.ts]"]
  node_push["Push notifications<br/>[push.service.ts]"]
  node_jobs["Scheduled jobs<br/>[cron.service.ts]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_studentview
node_app -->|"routes to"| node_gallery
node_login -.->|"signs in"| node_authclient
node_studentview -.->|"loads student data"| node_studentclient
node_authclient -->|"sends requests"| node_api_client
node_studentclient -->|"sends requests"| node_api_client
node_api_client -->|"configures"| node_interceptors
node_app -.->|"uses"| node_ui
node_server_app -->|"mounts"| node_auth_routes
node_server_app -->|"mounts"| node_student_routes
node_auth_routes -->|"dispatches to"| node_auth_controller
node_auth_controller -->|"calls"| node_auth_service
node_auth_service -->|"checks tenant and user"| node_tenant_users
node_student_routes -->|"authenticates"| node_auth_middleware
node_student_routes -->|"checks roles"| node_roles
node_student_routes -->|"dispatches to"| node_student_controller
node_student_controller -->|"calls"| node_student_service
node_student_service -->|"uses"| node_student_repo
node_student_repo -.->|"extends tenant access"| node_tenant_repo
node_tenant_repo -->|"reads scope"| node_tenant_context
node_tenant_repo -->|"queries"| node_mongo
node_auth_controller -->|"formats responses"| node_response
node_student_controller -->|"formats responses"| node_response
node_auth_middleware -->|"sets user scope"| node_tenant_context

click node_app "https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/app/App.tsx"
click node_login "https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/modules/auth/pages/LoginPage.tsx"
click node_studentview "https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/modules/students/pages/StudentListPage.tsx"
click node_gallery "https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/modules/gallery/pages/ComponentGalleryPage.tsx"
click node_authclient "https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/services/auth.service.ts"
click node_studentclient "https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/services/student.service.ts"
click node_api_client "https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/services/api/apiClient.ts"
click node_interceptors "https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/services/api/interceptors.ts"
click node_ui "https://github.com/sanjeevadharshini/org_std_arch/tree/main/client/src/components/ui"
click node_auth_routes "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/auth/auth.routes.ts"
click node_auth_controller "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/auth/auth.controller.ts"
click node_auth_service "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/auth/auth.service.ts"
click node_auth_middleware "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/middlewares/auth.middleware.ts"
click node_student_routes "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/students/student.routes.ts"
click node_student_controller "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/students/student.controller.ts"
click node_student_service "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/students/student.service.ts"
click node_student_repo "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/students/student.repository.ts"
click node_tenant_users "https://github.com/sanjeevadharshini/org_std_arch/tree/main/server/src/modules/tenants"
click node_tenant_context "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/core/database/tenant-context.ts"
click node_tenant_repo "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/core/database/base-tenant.repository.ts"
click node_server_app "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/app.ts"
click node_response "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/utils/response.ts"
click node_roles "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/middlewares/role.middleware.ts"
click node_email "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/core/notifications/email.service.ts"
click node_push "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/core/notifications/push.service.ts"
click node_jobs "https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/core/jobs/cron.service.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_login,node_studentview,node_gallery,node_authclient,node_studentclient,node_api_client,node_interceptors,node_ui,node_user toneBlue
class node_auth_routes,node_auth_controller,node_auth_middleware,node_student_routes,node_server_app,node_roles toneAmber
class node_auth_service,node_student_controller,node_student_service,node_student_repo,node_tenant_users toneMint
class node_tenant_context,node_tenant_repo,node_mongo,node_response,node_email,node_push,node_jobs toneRose
```

## Components

### Web client

- [App routing](https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/app/App.tsx): `client/src/app/App.tsx`
- [Login page](https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/modules/auth/pages/LoginPage.tsx): `client/src/modules/auth/pages/LoginPage.tsx`
- [Student list](https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/modules/students/pages/StudentListPage.tsx): `client/src/modules/students/pages/StudentListPage.tsx`
- [Component gallery](https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/modules/gallery/pages/ComponentGalleryPage.tsx): `client/src/modules/gallery/pages/ComponentGalleryPage.tsx`
- [Auth service](https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/services/auth.service.ts): `client/src/services/auth.service.ts`
- [Student service](https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/services/student.service.ts): `client/src/services/student.service.ts`
- [API client](https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/services/api/apiClient.ts): `client/src/services/api/apiClient.ts`
- [Token refresh](https://github.com/sanjeevadharshini/org_std_arch/blob/main/client/src/services/api/interceptors.ts): `client/src/services/api/interceptors.ts`
- [Reusable UI](https://github.com/sanjeevadharshini/org_std_arch/tree/main/client/src/components/ui): `client/src/components/ui`

### API and access

- [Auth routes](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/auth/auth.routes.ts): `server/src/modules/auth/auth.routes.ts`
- [Auth controller](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/auth/auth.controller.ts): `server/src/modules/auth/auth.controller.ts`
- [Authentication](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/middlewares/auth.middleware.ts): `server/src/middlewares/auth.middleware.ts`
- [Student routes](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/students/student.routes.ts): `server/src/modules/students/student.routes.ts`
- [Express app](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/app.ts): `server/src/app.ts`
- [Role authorization](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/middlewares/role.middleware.ts): `server/src/middlewares/role.middleware.ts`

### SaaS domains

- [Auth service](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/auth/auth.service.ts): `server/src/modules/auth/auth.service.ts`
- [Student controller](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/students/student.controller.ts): `server/src/modules/students/student.controller.ts`
- [Student service](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/students/student.service.ts): `server/src/modules/students/student.service.ts`
- [Student repository](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/modules/students/student.repository.ts): `server/src/modules/students/student.repository.ts`
- [Tenant and user domains](https://github.com/sanjeevadharshini/org_std_arch/tree/main/server/src/modules/tenants): `server/src/modules/tenants`

### Shared platform

- [Tenant context](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/core/database/tenant-context.ts): `server/src/core/database/tenant-context.ts`
- [Tenant repository base](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/core/database/base-tenant.repository.ts): `server/src/core/database/base-tenant.repository.ts`
- **MongoDB**
- [Response contract](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/utils/response.ts): `server/src/utils/response.ts`
- [Email notifications](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/core/notifications/email.service.ts): `server/src/core/notifications/email.service.ts`
- [Push notifications](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/core/notifications/push.service.ts): `server/src/core/notifications/push.service.ts`
- [Scheduled jobs](https://github.com/sanjeevadharshini/org_std_arch/blob/main/server/src/core/jobs/cron.service.ts): `server/src/core/jobs/cron.service.ts`

### Other components

- **User**

## Connections

- User → App routing: uses (evidence: `client/src/app/App.tsx`)
- App routing → Login page: routes to (evidence: `client/src/app/App.tsx`)
- App routing → Student list: routes to (evidence: `client/src/app/App.tsx`)
- App routing → Component gallery: routes to (evidence: `client/src/app/App.tsx`)
- Login page → Auth service: signs in
- Student list → Student service: loads student data
- Auth service → API client: sends requests (evidence: `client/src/services/auth.service.ts`)
- Student service → API client: sends requests (evidence: `client/src/services/student.service.ts`)
- API client → Token refresh: configures (evidence: `client/src/services/api/apiClient.ts`)
- App routing → Reusable UI: uses
- Express app → Auth routes: mounts (evidence: `server/src/app.ts`)
- Express app → Student routes: mounts (evidence: `server/src/app.ts`)
- Auth routes → Auth controller: dispatches to (evidence: `server/src/modules/auth/auth.routes.ts`)
- Auth controller → Auth service: calls (evidence: `server/src/modules/auth/auth.controller.ts`)
- Auth service → Tenant and user domains: checks tenant and user (evidence: `server/src/modules/auth/auth.service.ts`)
- Student routes → Authentication: authenticates (evidence: `server/src/modules/students/student.routes.ts`)
- Student routes → Role authorization: checks roles (evidence: `server/src/modules/students/student.routes.ts`)
- Student routes → Student controller: dispatches to (evidence: `server/src/modules/students/student.routes.ts`)
- Student controller → Student service: calls (evidence: `server/src/modules/students/student.controller.ts`)
- Student service → Student repository: uses (evidence: `server/src/modules/students/student.service.ts`)
- Student repository → Tenant repository base: extends tenant access
- Tenant repository base → Tenant context: reads scope (evidence: `server/src/core/database/base-tenant.repository.ts`)
- Tenant repository base → MongoDB: queries (evidence: `server/src/core/database/base-tenant.repository.ts`)
- Auth controller → Response contract: formats responses (evidence: `server/src/modules/auth/auth.controller.ts`)
- Student controller → Response contract: formats responses (evidence: `server/src/modules/students/student.controller.ts`)
- Authentication → Tenant context: sets user scope (evidence: `server/src/middlewares/auth.middleware.ts`)
