# devaratha31-hub/database architecture

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

- Interactive diagram: https://gitdiagram.com/devaratha31-hub/database
- Repository: https://github.com/devaratha31-hub/database

## Overview

This is an Express backend for attendance-related student records and academic PDF sharing. Its main workflows accept attendance logs, enrich student records from an external details API, and expose log/user administration; a separate PDF workflow uploads files to Supabase and stores searchable PDF metadata. The graph preserves the documented route and model relationships visible in the excerpts. The README is empty, and unsampled model and connection internals limit evidence for some storage links.

Main entry points: [`controllers/log.controller.js`](https://github.com/devaratha31-hub/database/blob/main/controllers/log.controller.js) (Log Controller), [`index.js`](https://github.com/devaratha31-hub/database/blob/main/index.js) (Express App), [`controllers/pdf.controller.js`](https://github.com/devaratha31-hub/database/blob/main/controllers/pdf.controller.js) (PDF Controller), [`routes/log.router.js`](https://github.com/devaratha31-hub/database/blob/main/routes/log.router.js) (Log Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["HTTP Runtime"]
  node_server["Express App<br/>[index.js]"]
  node_log_routes["Log Routes<br/>[log.router.js]"]
  node_pdf_routes["PDF Routes<br/>[pdf.router.js]"]
end

subgraph group_attendance["Attendance Records"]
  node_log_controller["Log Controller<br/>[log.controller.js]"]
  node_student_details["Student Enrichment"]
  node_log_model[("Log Records<br/>[model.js]")]
  node_unique_model[("Active User Registry<br/>[uniq_model.js]")]
  node_users_model[("Student Profiles<br/>[UsersModel.js]")]
  node_server_model[("Server Setting<br/>[Server.model.js]")]
  node_holidays["Holiday Calendar<br/>[holidays.json]"]
end

subgraph group_pdf["PDF Sharing"]
  node_upload_filter["Upload Filter<br/>[multer.js]"]
  node_pdf_controller["PDF Controller<br/>[pdf.controller.js]"]
  node_pdf_model[("PDF Metadata<br/>[Pdf.model.js]")]
  node_file_upload["File Uploader"]
end

subgraph group_integrations["External Services"]
  node_db_config["Database Connection<br/>[connectDB.js]"]
  node_supabase_config["Supabase Client<br/>[supabaseAdmin.js]"]
  node_viit_api{{"Student Details API"}}
  node_supabase_storage[("Supabase Storage")]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_server
node_server -->|"connects through"| node_db_config
node_server -->|"mounts"| node_log_routes
node_server -->|"mounts"| node_pdf_routes
node_log_routes -->|"dispatches"| node_log_controller
node_log_routes -->|"reads"| node_holidays
node_pdf_routes -->|"dispatches"| node_pdf_controller
node_pdf_routes -->|"filters uploads"| node_upload_filter
node_log_controller -->|"reads and writes"| node_log_model
node_log_controller -->|"reads and writes"| node_unique_model
node_log_controller -->|"reads and writes"| node_users_model
node_log_controller -->|"reads and writes"| node_server_model
node_log_controller -->|"fetches details"| node_student_details
node_student_details -->|"requests profile"| node_viit_api
node_pdf_controller -->|"reads and writes"| node_pdf_model
node_pdf_controller -->|"checks credentials"| node_users_model
node_pdf_controller -->|"uploads file"| node_file_upload
node_file_upload -->|"uses client"| node_supabase_config
node_supabase_config -.->|"configures access"| node_supabase_storage

click node_server "https://github.com/devaratha31-hub/database/blob/main/index.js"
click node_log_routes "https://github.com/devaratha31-hub/database/blob/main/routes/log.router.js"
click node_pdf_routes "https://github.com/devaratha31-hub/database/blob/main/routes/pdf.router.js"
click node_upload_filter "https://github.com/devaratha31-hub/database/blob/main/middleware/multer.js"
click node_log_controller "https://github.com/devaratha31-hub/database/blob/main/controllers/log.controller.js"
click node_student_details "https://github.com/devaratha31-hub/database/blob/main/services/fetchStudentDetails.js"
click node_log_model "https://github.com/devaratha31-hub/database/blob/main/models/model.js"
click node_unique_model "https://github.com/devaratha31-hub/database/blob/main/models/uniq_model.js"
click node_users_model "https://github.com/devaratha31-hub/database/blob/main/models/UsersModel.js"
click node_server_model "https://github.com/devaratha31-hub/database/blob/main/models/Server.model.js"
click node_holidays "https://github.com/devaratha31-hub/database/blob/main/data/holidays.json"
click node_pdf_controller "https://github.com/devaratha31-hub/database/blob/main/controllers/pdf.controller.js"
click node_pdf_model "https://github.com/devaratha31-hub/database/blob/main/models/Pdf.model.js"
click node_file_upload "https://github.com/devaratha31-hub/database/blob/main/services/uploadFileSupabase.js"
click node_db_config "https://github.com/devaratha31-hub/database/blob/main/config/connectDB.js"
click node_supabase_config "https://github.com/devaratha31-hub/database/blob/main/config/supabaseAdmin.js"

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_server,node_log_routes,node_pdf_routes,node_client toneBlue
class node_log_controller,node_student_details,node_log_model,node_unique_model,node_users_model,node_server_model,node_holidays toneAmber
class node_upload_filter,node_pdf_controller,node_pdf_model,node_file_upload toneMint
class node_db_config,node_supabase_config,node_viit_api,node_supabase_storage toneRose
```

## Components

### HTTP Runtime

- [Express App](https://github.com/devaratha31-hub/database/blob/main/index.js): `index.js`
- [Log Routes](https://github.com/devaratha31-hub/database/blob/main/routes/log.router.js): `routes/log.router.js`
- [PDF Routes](https://github.com/devaratha31-hub/database/blob/main/routes/pdf.router.js): `routes/pdf.router.js`

### Attendance Records

- [Log Controller](https://github.com/devaratha31-hub/database/blob/main/controllers/log.controller.js): `controllers/log.controller.js`
- [Student Enrichment](https://github.com/devaratha31-hub/database/blob/main/services/fetchStudentDetails.js): `services/fetchStudentDetails.js`
- [Log Records](https://github.com/devaratha31-hub/database/blob/main/models/model.js): `models/model.js`
- [Active User Registry](https://github.com/devaratha31-hub/database/blob/main/models/uniq_model.js): `models/uniq_model.js`
- [Student Profiles](https://github.com/devaratha31-hub/database/blob/main/models/UsersModel.js): `models/UsersModel.js`
- [Server Setting](https://github.com/devaratha31-hub/database/blob/main/models/Server.model.js): `models/Server.model.js`
- [Holiday Calendar](https://github.com/devaratha31-hub/database/blob/main/data/holidays.json): `data/holidays.json`

### PDF Sharing

- [Upload Filter](https://github.com/devaratha31-hub/database/blob/main/middleware/multer.js): `middleware/multer.js`
- [PDF Controller](https://github.com/devaratha31-hub/database/blob/main/controllers/pdf.controller.js): `controllers/pdf.controller.js`
- [PDF Metadata](https://github.com/devaratha31-hub/database/blob/main/models/Pdf.model.js): `models/Pdf.model.js`
- [File Uploader](https://github.com/devaratha31-hub/database/blob/main/services/uploadFileSupabase.js): `services/uploadFileSupabase.js`

### External Services

- [Database Connection](https://github.com/devaratha31-hub/database/blob/main/config/connectDB.js): `config/connectDB.js`
- [Supabase Client](https://github.com/devaratha31-hub/database/blob/main/config/supabaseAdmin.js): `config/supabaseAdmin.js`
- **Student Details API**
- **Supabase Storage**

### Other components

- **API Client**

## Connections

- API Client → Express App: sends requests (evidence: `index.js`)
- Express App → Database Connection: connects through (evidence: `index.js`)
- Express App → Log Routes: mounts (evidence: `index.js`)
- Express App → PDF Routes: mounts (evidence: `index.js`)
- Log Routes → Log Controller: dispatches (evidence: `routes/log.router.js`)
- Log Routes → Holiday Calendar: reads (evidence: `routes/log.router.js`)
- PDF Routes → PDF Controller: dispatches (evidence: `routes/pdf.router.js`)
- PDF Routes → Upload Filter: filters uploads (evidence: `routes/pdf.router.js`)
- Log Controller → Log Records: reads and writes (evidence: `controllers/log.controller.js`)
- Log Controller → Active User Registry: reads and writes (evidence: `controllers/log.controller.js`)
- Log Controller → Student Profiles: reads and writes (evidence: `controllers/log.controller.js`)
- Log Controller → Server Setting: reads and writes (evidence: `controllers/log.controller.js`)
- Log Controller → Student Enrichment: fetches details (evidence: `controllers/log.controller.js`)
- Student Enrichment → Student Details API: requests profile (evidence: `services/fetchStudentDetails.js`)
- PDF Controller → PDF Metadata: reads and writes (evidence: `controllers/pdf.controller.js`)
- PDF Controller → Student Profiles: checks credentials (evidence: `controllers/pdf.controller.js`)
- PDF Controller → File Uploader: uploads file (evidence: `controllers/pdf.controller.js`)
- File Uploader → Supabase Client: uses client (evidence: `services/uploadFileSupabase.js`)
- Supabase Client → Supabase Storage: configures access
