# gaurang-5/mathlogs architecture

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

- Interactive diagram: https://gitdiagram.com/gaurang-5/mathlogs
- Repository: https://github.com/gaurang-5/mathlogs

## Overview

MathLogs is a tuition-center management platform with React web and Expo mobile clients backed by an Express API and PostgreSQL. The main workflow is institute staff using either client to manage onboarding, batches and student registration, collect and report fees, and run tests or quizzes; students and parents also use portal and quiz workflows. The README documents additional billing, marketplace, communication, OCR, and super-admin capabilities. Some subsystem paths are directories because their individual wiring was not sampled.

Main entry points: [`server/src/controllers`](https://github.com/gaurang-5/mathlogs/tree/main/server/src/controllers) (Domain controllers), [`server/src/controllers/monthCoverageController.ts`](https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/monthCoverageController.ts) (Fee collection), [`server/src/prisma.ts`](https://github.com/gaurang-5/mathlogs/blob/main/server/src/prisma.ts) (PostgreSQL data), [`server/src/routes`](https://github.com/gaurang-5/mathlogs/tree/main/server/src/routes) (API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User applications"]
  node_web["Web application"]
  node_mobile["Mobile application"]
end

subgraph group_api["API and domain"]
  node_api_entry["API entry<br/>[index.ts]"]
  node_api_routes["API routes"]
  node_controllers["Domain controllers"]
  node_database[("PostgreSQL data<br/>[prisma.ts]")]
end

subgraph group_operations["Institute operations"]
  node_admissions["Admissions and students"]
  node_batches["Batch workflows<br/>[batchController.ts]"]
  node_fees["Fee collection"]
  node_fee_profiles["Coverage profiles"]
  node_fee_payments["Coverage payments"]
  node_fee_summary["Fee summaries"]
  node_tests_quizzes["Tests and quizzes<br/>[testController.ts]"]
  node_student_portal["Student portal"]
end

subgraph group_platform["Platform services"]
  node_billing["Plans and billing"]
  node_marketplace["Institute marketplace"]
  node_superadmin["Super-admin tools"]
  node_communications["Parent communications<br/>[whatsapp.ts]"]
  node_reports_files["Reports and files<br/>[paymentStorage.ts]"]
  node_ai_ocr["AI and OCR"]
end

subgraph group_integrations["External systems"]
  node_payment_storage["Object storage<br/>[r2ObjectStorage.ts]"]
  node_external_services["Messaging and AI providers"]
end

node_staff(("Institute staff"))
node_families(("Students and parents"))

node_staff -->|"uses"| node_web
node_staff -->|"uses"| node_mobile
node_families -->|"uses portal"| node_web
node_web -->|"sends API requests"| node_api_entry
node_mobile -->|"sends API requests"| node_api_entry
node_api_entry -->|"registers routes"| node_api_routes
node_api_routes -->|"dispatches requests"| node_controllers
node_controllers -->|"handles student workflows"| node_admissions
node_controllers -->|"handles batch workflows"| node_batches
node_controllers -->|"handles fee workflows"| node_fees
node_controllers -->|"handles assessments"| node_tests_quizzes
node_controllers -->|"serves portal workflows"| node_student_portal
node_controllers -->|"handles billing"| node_billing
node_controllers -->|"handles marketplace"| node_marketplace
node_api_routes -->|"dispatches admin routes"| node_superadmin
node_controllers -->|"reads and writes"| node_database
node_fees -->|"manages profiles"| node_fee_profiles
node_fees -->|"previews and records"| node_fee_payments
node_fees -->|"requests summaries"| node_fee_summary
node_fee_profiles -->|"reads and writes"| node_database
node_fee_payments -->|"reads and writes"| node_database
node_fee_summary -->|"reads fee data"| node_database
node_tests_quizzes -.->|"generates assessments"| node_ai_ocr
node_controllers -.->|"processes scans"| node_ai_ocr
node_controllers -.->|"sends notifications"| node_communications
node_communications -.->|"delivers messages"| node_external_services
node_reports_files -.->|"stores receipt objects"| node_payment_storage
node_payment_storage -.->|"uses R2 storage"| node_external_services

click node_web "https://github.com/gaurang-5/mathlogs/tree/main/client/src"
click node_mobile "https://github.com/gaurang-5/mathlogs/tree/main/mobile/app"
click node_api_entry "https://github.com/gaurang-5/mathlogs/blob/main/server/src/index.ts"
click node_api_routes "https://github.com/gaurang-5/mathlogs/tree/main/server/src/routes"
click node_controllers "https://github.com/gaurang-5/mathlogs/tree/main/server/src/controllers"
click node_database "https://github.com/gaurang-5/mathlogs/blob/main/server/src/prisma.ts"
click node_admissions "https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/studentController.ts"
click node_batches "https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/batchController.ts"
click node_fees "https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/monthCoverageController.ts"
click node_fee_profiles "https://github.com/gaurang-5/mathlogs/blob/main/server/src/services/studentMonthCoverageService.ts"
click node_fee_payments "https://github.com/gaurang-5/mathlogs/blob/main/server/src/services/monthCoveragePaymentService.ts"
click node_fee_summary "https://github.com/gaurang-5/mathlogs/blob/main/server/src/services/monthCoverageSummaryService.ts"
click node_tests_quizzes "https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/testController.ts"
click node_student_portal "https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/studentPortalController.ts"
click node_billing "https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/billingController.ts"
click node_marketplace "https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/marketplaceController.ts"
click node_superadmin "https://github.com/gaurang-5/mathlogs/blob/main/server/src/routes/superAdminRoutes.ts"
click node_communications "https://github.com/gaurang-5/mathlogs/blob/main/server/src/utils/whatsapp.ts"
click node_reports_files "https://github.com/gaurang-5/mathlogs/blob/main/server/src/utils/paymentStorage.ts"
click node_ai_ocr "https://github.com/gaurang-5/mathlogs/tree/main/server/src/utils/ai"
click node_payment_storage "https://github.com/gaurang-5/mathlogs/blob/main/server/src/utils/r2ObjectStorage.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_web,node_mobile toneBlue
class node_api_entry,node_api_routes,node_controllers,node_database toneAmber
class node_admissions,node_batches,node_fees,node_fee_profiles,node_fee_payments,node_fee_summary,node_tests_quizzes,node_student_portal toneMint
class node_billing,node_marketplace,node_superadmin,node_communications,node_reports_files,node_ai_ocr toneRose
class node_payment_storage,node_external_services,node_staff,node_families toneIndigo
```

## Components

### User applications

- [Web application](https://github.com/gaurang-5/mathlogs/tree/main/client/src): `client/src`
- [Mobile application](https://github.com/gaurang-5/mathlogs/tree/main/mobile/app): `mobile/app`

### API and domain

- [API entry](https://github.com/gaurang-5/mathlogs/blob/main/server/src/index.ts): `server/src/index.ts`
- [API routes](https://github.com/gaurang-5/mathlogs/tree/main/server/src/routes): `server/src/routes`
- [Domain controllers](https://github.com/gaurang-5/mathlogs/tree/main/server/src/controllers): `server/src/controllers`
- [PostgreSQL data](https://github.com/gaurang-5/mathlogs/blob/main/server/src/prisma.ts): `server/src/prisma.ts`

### Institute operations

- [Admissions and students](https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/studentController.ts): `server/src/controllers/studentController.ts`
- [Batch workflows](https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/batchController.ts): `server/src/controllers/batchController.ts`
- [Fee collection](https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/monthCoverageController.ts): `server/src/controllers/monthCoverageController.ts`
- [Coverage profiles](https://github.com/gaurang-5/mathlogs/blob/main/server/src/services/studentMonthCoverageService.ts): `server/src/services/studentMonthCoverageService.ts`
- [Coverage payments](https://github.com/gaurang-5/mathlogs/blob/main/server/src/services/monthCoveragePaymentService.ts): `server/src/services/monthCoveragePaymentService.ts`
- [Fee summaries](https://github.com/gaurang-5/mathlogs/blob/main/server/src/services/monthCoverageSummaryService.ts): `server/src/services/monthCoverageSummaryService.ts`
- [Tests and quizzes](https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/testController.ts): `server/src/controllers/testController.ts`
- [Student portal](https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/studentPortalController.ts): `server/src/controllers/studentPortalController.ts`

### Platform services

- [Plans and billing](https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/billingController.ts): `server/src/controllers/billingController.ts`
- [Institute marketplace](https://github.com/gaurang-5/mathlogs/blob/main/server/src/controllers/marketplaceController.ts): `server/src/controllers/marketplaceController.ts`
- [Super-admin tools](https://github.com/gaurang-5/mathlogs/blob/main/server/src/routes/superAdminRoutes.ts): `server/src/routes/superAdminRoutes.ts`
- [Parent communications](https://github.com/gaurang-5/mathlogs/blob/main/server/src/utils/whatsapp.ts): `server/src/utils/whatsapp.ts`
- [Reports and files](https://github.com/gaurang-5/mathlogs/blob/main/server/src/utils/paymentStorage.ts): `server/src/utils/paymentStorage.ts`
- [AI and OCR](https://github.com/gaurang-5/mathlogs/tree/main/server/src/utils/ai): `server/src/utils/ai`

### External systems

- [Object storage](https://github.com/gaurang-5/mathlogs/blob/main/server/src/utils/r2ObjectStorage.ts): `server/src/utils/r2ObjectStorage.ts`
- **Messaging and AI providers**

### Other components

- **Institute staff**
- **Students and parents**

## Connections

- Institute staff → Web application: uses
- Institute staff → Mobile application: uses
- Students and parents → Web application: uses portal
- Web application → API entry: sends API requests
- Mobile application → API entry: sends API requests
- API entry → API routes: registers routes
- API routes → Domain controllers: dispatches requests
- Domain controllers → Admissions and students: handles student workflows
- Domain controllers → Batch workflows: handles batch workflows
- Domain controllers → Fee collection: handles fee workflows
- Domain controllers → Tests and quizzes: handles assessments
- Domain controllers → Student portal: serves portal workflows
- Domain controllers → Plans and billing: handles billing
- Domain controllers → Institute marketplace: handles marketplace
- API routes → Super-admin tools: dispatches admin routes
- Domain controllers → PostgreSQL data: reads and writes
- Fee collection → Coverage profiles: manages profiles
- Fee collection → Coverage payments: previews and records
- Fee collection → Fee summaries: requests summaries
- Coverage profiles → PostgreSQL data: reads and writes
- Coverage payments → PostgreSQL data: reads and writes
- Fee summaries → PostgreSQL data: reads fee data
- Tests and quizzes → AI and OCR: generates assessments
- Domain controllers → AI and OCR: processes scans
- Domain controllers → Parent communications: sends notifications
- Parent communications → Messaging and AI providers: delivers messages
- Reports and files → Object storage: stores receipt objects
- Object storage → Messaging and AI providers: uses R2 storage
