# dev-tejasnb/student-data-collection architecture

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

- Interactive diagram: https://gitdiagram.com/dev-tejasnb/student-data-collection
- Repository: https://github.com/dev-tejasnb/student-data-collection

## Overview

The product is a FastAPI/MongoDB student-submission and administration system. Students submit records without logging in; staff and admins authenticate to manage records, view statistics, and export PDFs, while admins also manage users. The graph combines sampled backend call relationships with README-documented capabilities. Frontend-to-API wiring is not established by the sampled excerpts, so those edges are omitted.

Main entry points: [`app/main.py`](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/main.py) (FastAPI application), [`app/database.py`](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/database.py) (MongoDB connection and indexes), [`app/routers/auth.py`](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/routers/auth.py) (Login and user admin), [`app/dependencies.py`](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/dependencies.py) (Role access checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_web_ui["Web pages and scripts"]
  node_browser_assets["Browser assets"]
end

subgraph group_routing["Application routing"]
  node_application["FastAPI application<br/>[main.py]"]
  node_settings["Application settings<br/>[config.py]"]
end

subgraph group_identity["Authentication and access"]
  node_auth_routes["Login and user admin<br/>[auth.py]"]
  node_security["Token and password security<br/>[security.py]"]
  node_access_control["Role access checks<br/>[dependencies.py]"]
  node_user_model["User model<br/>[user.py]"]
  node_auth_schemas["Authentication schemas<br/>[auth.py]"]
end

subgraph group_records["Student records"]
  node_student_submission["Public student submission<br/>[public.py]"]
  node_student_admin["Student management and stats<br/>[admin_students.py]"]
  node_student_model["Student model<br/>[student.py]"]
  node_response_schemas["Response schemas<br/>[response.py]"]
  node_pdf_routes["PDF export endpoints<br/>[admin_pdf.py]"]
  node_pdf_generator["PDF generation<br/>[pdf_service.py]"]
end

subgraph group_storage["Persistence and exports"]
  node_database_layer["MongoDB connection and indexes<br/>[database.py]"]
  node_mongo[("MongoDB")]
end

node_visitor(("Student or staff"))

node_visitor -->|"uses"| node_web_ui
node_application -->|"renders pages"| node_web_ui
node_application -->|"serves static files"| node_browser_assets
node_application -->|"registers router"| node_student_submission
node_application -->|"registers router"| node_auth_routes
node_application -->|"registers router"| node_student_admin
node_application -->|"registers router"| node_pdf_routes
node_application -->|"opens and closes"| node_database_layer
node_application -->|"loads settings"| node_settings
node_database_layer -->|"reads connection settings"| node_settings
node_database_layer -->|"connects and indexes"| node_mongo
node_student_submission -->|"gets database"| node_database_layer
node_student_admin -->|"gets database"| node_database_layer
node_student_admin -->|"validates records"| node_student_model
node_student_admin -->|"returns responses"| node_response_schemas
node_student_submission -->|"uses student model"| node_student_model
node_student_submission -->|"returns responses"| node_response_schemas
node_auth_routes -->|"gets database"| node_database_layer
node_auth_routes -->|"verifies and signs"| node_security
node_auth_routes -->|"requires admin"| node_access_control
node_auth_routes -->|"uses user model"| node_user_model
node_auth_routes -->|"uses auth schemas"| node_auth_schemas
node_auth_routes -->|"returns responses"| node_response_schemas
node_access_control -->|"decodes tokens"| node_security
node_access_control -->|"loads user record"| node_database_layer
node_access_control -->|"validates user"| node_user_model
node_student_admin -->|"checks roles"| node_access_control
node_pdf_routes -->|"checks roles"| node_access_control
node_pdf_routes -->|"reads student records"| node_database_layer
node_pdf_routes -->|"generates PDF"| node_pdf_generator

click node_web_ui "https://github.com/dev-tejasnb/student-data-collection/tree/main/templates"
click node_browser_assets "https://github.com/dev-tejasnb/student-data-collection/tree/main/static"
click node_application "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/main.py"
click node_settings "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/config.py"
click node_auth_routes "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/routers/auth.py"
click node_security "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/auth/security.py"
click node_access_control "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/dependencies.py"
click node_user_model "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/models/user.py"
click node_student_submission "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/routers/public.py"
click node_student_admin "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/routers/admin_students.py"
click node_student_model "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/models/student.py"
click node_response_schemas "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/schemas/response.py"
click node_auth_schemas "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/schemas/auth.py"
click node_database_layer "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/database.py"
click node_pdf_routes "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/routers/admin_pdf.py"
click node_pdf_generator "https://github.com/dev-tejasnb/student-data-collection/blob/main/app/services/pdf_service.py"

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_ui,node_browser_assets toneBlue
class node_application,node_settings toneAmber
class node_auth_routes,node_security,node_access_control,node_user_model,node_auth_schemas toneMint
class node_student_submission,node_student_admin,node_student_model,node_response_schemas,node_pdf_routes,node_pdf_generator toneRose
class node_database_layer,node_mongo,node_visitor toneIndigo
```

## Components

### Web interface

- [Web pages and scripts](https://github.com/dev-tejasnb/student-data-collection/tree/main/templates): `templates`
- [Browser assets](https://github.com/dev-tejasnb/student-data-collection/tree/main/static): `static`

### Application routing

- [FastAPI application](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/main.py): `app/main.py`
- [Application settings](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/config.py): `app/config.py`

### Authentication and access

- [Login and user admin](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/routers/auth.py): `app/routers/auth.py`
- [Token and password security](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/auth/security.py): `app/auth/security.py`
- [Role access checks](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/dependencies.py): `app/dependencies.py`
- [User model](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/models/user.py): `app/models/user.py`
- [Authentication schemas](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/schemas/auth.py): `app/schemas/auth.py`

### Student records

- [Public student submission](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/routers/public.py): `app/routers/public.py`
- [Student management and stats](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/routers/admin_students.py): `app/routers/admin_students.py`
- [Student model](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/models/student.py): `app/models/student.py`
- [Response schemas](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/schemas/response.py): `app/schemas/response.py`
- [PDF export endpoints](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/routers/admin_pdf.py): `app/routers/admin_pdf.py`
- [PDF generation](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/services/pdf_service.py): `app/services/pdf_service.py`

### Persistence and exports

- [MongoDB connection and indexes](https://github.com/dev-tejasnb/student-data-collection/blob/main/app/database.py): `app/database.py`
- **MongoDB**

### Other components

- **Student or staff**

## Connections

- Student or staff → Web pages and scripts: uses (evidence: `README.md`)
- FastAPI application → Web pages and scripts: renders pages (evidence: `app/main.py`)
- FastAPI application → Browser assets: serves static files (evidence: `app/main.py`)
- FastAPI application → Public student submission: registers router (evidence: `app/main.py`)
- FastAPI application → Login and user admin: registers router (evidence: `app/main.py`)
- FastAPI application → Student management and stats: registers router (evidence: `app/main.py`)
- FastAPI application → PDF export endpoints: registers router (evidence: `app/main.py`)
- FastAPI application → MongoDB connection and indexes: opens and closes (evidence: `app/main.py`)
- FastAPI application → Application settings: loads settings (evidence: `app/main.py`)
- MongoDB connection and indexes → Application settings: reads connection settings (evidence: `app/database.py`)
- MongoDB connection and indexes → MongoDB: connects and indexes (evidence: `app/database.py`)
- Public student submission → MongoDB connection and indexes: gets database (evidence: `app/routers/public.py`)
- Student management and stats → MongoDB connection and indexes: gets database (evidence: `app/routers/admin_students.py`)
- Student management and stats → Student model: validates records (evidence: `app/routers/admin_students.py`)
- Student management and stats → Response schemas: returns responses (evidence: `app/routers/admin_students.py`)
- Public student submission → Student model: uses student model (evidence: `app/routers/public.py`)
- Public student submission → Response schemas: returns responses (evidence: `app/routers/public.py`)
- Login and user admin → MongoDB connection and indexes: gets database (evidence: `app/routers/auth.py`)
- Login and user admin → Token and password security: verifies and signs (evidence: `app/routers/auth.py`)
- Login and user admin → Role access checks: requires admin (evidence: `app/routers/auth.py`)
- Login and user admin → User model: uses user model (evidence: `app/routers/auth.py`)
- Login and user admin → Authentication schemas: uses auth schemas (evidence: `app/routers/auth.py`)
- Login and user admin → Response schemas: returns responses (evidence: `app/routers/auth.py`)
- Role access checks → Token and password security: decodes tokens (evidence: `app/dependencies.py`)
- Role access checks → MongoDB connection and indexes: loads user record (evidence: `app/dependencies.py`)
- Role access checks → User model: validates user (evidence: `app/dependencies.py`)
- Student management and stats → Role access checks: checks roles (evidence: `app/routers/admin_students.py`)
- PDF export endpoints → Role access checks: checks roles (evidence: `app/routers/admin_pdf.py`)
- PDF export endpoints → MongoDB connection and indexes: reads student records (evidence: `app/routers/admin_pdf.py`)
- PDF export endpoints → PDF generation: generates PDF (evidence: `app/routers/admin_pdf.py`)
