# titujesh/acedra architecture

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

- Interactive diagram: https://gitdiagram.com/titujesh/acedra
- Repository: https://github.com/titujesh/acedra

## Overview

Acedra is a FastAPI student-information and cloud-document API. Clients call the application gateway, which dispatches authentication, student, department, and document requests; the route handlers enforce access rules and operate on relational records, while document operations also use S3. Schemas define API data contracts, and shared dependencies and security utilities support request handling. The README documents Secrets Manager-based production configuration, but the sampled configuration source does not show that integration; it is therefore not connected here.

Main entry points: [`app/routers/documents.py`](https://github.com/titujesh/acedra/blob/main/app/routers/documents.py) (Document routes), [`app/database.py`](https://github.com/titujesh/acedra/blob/main/app/database.py) (Database sessions), [`app/main.py`](https://github.com/titujesh/acedra/blob/main/app/main.py) (FastAPI gateway), [`app/routers/auth.py`](https://github.com/titujesh/acedra/blob/main/app/routers/auth.py) (Authentication routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["API gateway"]
  node_api["FastAPI gateway<br/>[main.py]"]
end

subgraph group_identity["Identity and access"]
  node_auth["Authentication routes<br/>[auth.py]"]
  node_access["Request authorization<br/>[dependencies.py]"]
  node_passwords["Password security<br/>[security.py]"]
  node_tokens["JWT utilities<br/>[jwt.py]"]
  node_users["User records<br/>[user.py]"]
  node_authcontract["Auth contracts<br/>[auth.py]"]
end

subgraph group_academics["Academic records"]
  node_students["Student routes<br/>[students.py]"]
  node_studentmodel["Student records<br/>[student.py]"]
  node_studentcontract["Student contracts<br/>[student.py]"]
  node_departments["Department routes<br/>[departments.py]"]
  node_departmentmodel["Department records<br/>[department.py]"]
  node_departmentcontract["Department contracts<br/>[department.py]"]
end

subgraph group_documents["Document vault"]
  node_documents["Document routes<br/>[documents.py]"]
  node_documentmodel["Document records<br/>[document.py]"]
  node_documentcontract["Document contracts<br/>[document.py]"]
  node_s3service["S3 operations<br/>[s3_service.py]"]
end

subgraph group_foundation["Persistence and contracts"]
  node_dbdependency["Database sessions<br/>[database.py]"]
  node_commoncontract["Common contracts<br/>[common.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_logger["Application logging<br/>[logger.py]"]
end

node_clients(("API clients"))
node_s3[("Amazon S3")]
node_postgres[("PostgreSQL")]

node_clients -->|"sends requests"| node_api
node_api -->|"routes to"| node_auth
node_api -->|"routes to"| node_students
node_api -->|"routes to"| node_departments
node_api -->|"routes to"| node_documents
node_api -->|"health-checks"| node_dbdependency
node_api -->|"logs requests"| node_logger
node_auth -->|"uses dependencies"| node_access
node_auth -->|"hashes passwords"| node_passwords
node_auth -->|"creates tokens"| node_tokens
node_auth -->|"queries users"| node_users
node_auth -->|"uses contracts"| node_authcontract
node_auth -->|"uses responses"| node_commoncontract
node_access -->|"opens sessions"| node_dbdependency
node_access -->|"loads user"| node_users
node_access -->|"validates JWT"| node_tokens
node_students -->|"uses dependencies"| node_access
node_students -->|"queries records"| node_studentmodel
node_students -->|"checks departments"| node_departmentmodel
node_students -->|"checks accounts"| node_users
node_students -->|"uses contracts"| node_studentcontract
node_students -->|"uses responses"| node_commoncontract
node_departments -->|"uses dependencies"| node_access
node_departments -->|"queries records"| node_departmentmodel
node_departments -->|"uses contracts"| node_departmentcontract
node_departments -->|"uses responses"| node_commoncontract
node_documents -->|"uses dependencies"| node_access
node_documents -->|"queries records"| node_documentmodel
node_documents -->|"checks ownership"| node_studentmodel
node_documents -->|"checks roles"| node_users
node_documents -->|"uses contracts"| node_documentcontract
node_documents -->|"uses responses"| node_commoncontract
node_documents -->|"uploads, deletes, signs"| node_s3service
node_s3service -->|"stores objects"| node_s3
node_s3service -->|"reads bucket settings"| node_config
node_dbdependency -->|"reads database URL"| node_config
node_dbdependency -->|"persists records"| node_postgres
node_studentmodel -->|"uses ORM base"| node_dbdependency
node_users -->|"uses ORM base"| node_dbdependency
node_departmentmodel -->|"uses ORM base"| node_dbdependency
node_documentmodel -->|"uses ORM base"| node_dbdependency

click node_api "https://github.com/titujesh/acedra/blob/main/app/main.py"
click node_auth "https://github.com/titujesh/acedra/blob/main/app/routers/auth.py"
click node_access "https://github.com/titujesh/acedra/blob/main/app/dependencies.py"
click node_passwords "https://github.com/titujesh/acedra/blob/main/app/utils/security.py"
click node_tokens "https://github.com/titujesh/acedra/blob/main/app/utils/jwt.py"
click node_users "https://github.com/titujesh/acedra/blob/main/app/models/user.py"
click node_authcontract "https://github.com/titujesh/acedra/blob/main/app/schemas/auth.py"
click node_students "https://github.com/titujesh/acedra/blob/main/app/routers/students.py"
click node_studentmodel "https://github.com/titujesh/acedra/blob/main/app/models/student.py"
click node_studentcontract "https://github.com/titujesh/acedra/blob/main/app/schemas/student.py"
click node_departments "https://github.com/titujesh/acedra/blob/main/app/routers/departments.py"
click node_departmentmodel "https://github.com/titujesh/acedra/blob/main/app/models/department.py"
click node_departmentcontract "https://github.com/titujesh/acedra/blob/main/app/schemas/department.py"
click node_documents "https://github.com/titujesh/acedra/blob/main/app/routers/documents.py"
click node_documentmodel "https://github.com/titujesh/acedra/blob/main/app/models/document.py"
click node_documentcontract "https://github.com/titujesh/acedra/blob/main/app/schemas/document.py"
click node_s3service "https://github.com/titujesh/acedra/blob/main/app/services/s3_service.py"
click node_dbdependency "https://github.com/titujesh/acedra/blob/main/app/database.py"
click node_commoncontract "https://github.com/titujesh/acedra/blob/main/app/schemas/common.py"
click node_config "https://github.com/titujesh/acedra/blob/main/app/config.py"
click node_logger "https://github.com/titujesh/acedra/blob/main/app/utils/logger.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_api,node_clients toneBlue
class node_auth,node_access,node_passwords,node_tokens,node_users,node_authcontract,node_s3,node_postgres toneAmber
class node_students,node_studentmodel,node_studentcontract,node_departments,node_departmentmodel,node_departmentcontract toneMint
class node_documents,node_documentmodel,node_documentcontract,node_s3service toneRose
class node_dbdependency,node_commoncontract,node_config,node_logger toneIndigo
```

## Components

### API gateway

- [FastAPI gateway](https://github.com/titujesh/acedra/blob/main/app/main.py): `app/main.py`

### Identity and access

- [Authentication routes](https://github.com/titujesh/acedra/blob/main/app/routers/auth.py): `app/routers/auth.py`
- [Request authorization](https://github.com/titujesh/acedra/blob/main/app/dependencies.py): `app/dependencies.py`
- [Password security](https://github.com/titujesh/acedra/blob/main/app/utils/security.py): `app/utils/security.py`
- [JWT utilities](https://github.com/titujesh/acedra/blob/main/app/utils/jwt.py): `app/utils/jwt.py`
- [User records](https://github.com/titujesh/acedra/blob/main/app/models/user.py): `app/models/user.py`
- [Auth contracts](https://github.com/titujesh/acedra/blob/main/app/schemas/auth.py): `app/schemas/auth.py`

### Academic records

- [Student routes](https://github.com/titujesh/acedra/blob/main/app/routers/students.py): `app/routers/students.py`
- [Student records](https://github.com/titujesh/acedra/blob/main/app/models/student.py): `app/models/student.py`
- [Student contracts](https://github.com/titujesh/acedra/blob/main/app/schemas/student.py): `app/schemas/student.py`
- [Department routes](https://github.com/titujesh/acedra/blob/main/app/routers/departments.py): `app/routers/departments.py`
- [Department records](https://github.com/titujesh/acedra/blob/main/app/models/department.py): `app/models/department.py`
- [Department contracts](https://github.com/titujesh/acedra/blob/main/app/schemas/department.py): `app/schemas/department.py`

### Document vault

- [Document routes](https://github.com/titujesh/acedra/blob/main/app/routers/documents.py): `app/routers/documents.py`
- [Document records](https://github.com/titujesh/acedra/blob/main/app/models/document.py): `app/models/document.py`
- [Document contracts](https://github.com/titujesh/acedra/blob/main/app/schemas/document.py): `app/schemas/document.py`
- [S3 operations](https://github.com/titujesh/acedra/blob/main/app/services/s3_service.py): `app/services/s3_service.py`

### Persistence and contracts

- [Database sessions](https://github.com/titujesh/acedra/blob/main/app/database.py): `app/database.py`
- [Common contracts](https://github.com/titujesh/acedra/blob/main/app/schemas/common.py): `app/schemas/common.py`
- [Runtime configuration](https://github.com/titujesh/acedra/blob/main/app/config.py): `app/config.py`
- [Application logging](https://github.com/titujesh/acedra/blob/main/app/utils/logger.py): `app/utils/logger.py`

### Other components

- **API clients**
- **Amazon S3**
- **PostgreSQL**

## Connections

- API clients → FastAPI gateway: sends requests (evidence: `app/main.py`)
- FastAPI gateway → Authentication routes: routes to (evidence: `app/main.py`)
- FastAPI gateway → Student routes: routes to (evidence: `app/main.py`)
- FastAPI gateway → Department routes: routes to (evidence: `app/main.py`)
- FastAPI gateway → Document routes: routes to (evidence: `app/main.py`)
- FastAPI gateway → Database sessions: health-checks (evidence: `app/main.py`)
- FastAPI gateway → Application logging: logs requests (evidence: `app/main.py`)
- Authentication routes → Request authorization: uses dependencies (evidence: `app/routers/auth.py`)
- Authentication routes → Password security: hashes passwords (evidence: `app/routers/auth.py`)
- Authentication routes → JWT utilities: creates tokens (evidence: `app/routers/auth.py`)
- Authentication routes → User records: queries users (evidence: `app/routers/auth.py`)
- Authentication routes → Auth contracts: uses contracts (evidence: `app/routers/auth.py`)
- Authentication routes → Common contracts: uses responses (evidence: `app/routers/auth.py`)
- Request authorization → Database sessions: opens sessions (evidence: `app/dependencies.py`)
- Request authorization → User records: loads user (evidence: `app/dependencies.py`)
- Request authorization → JWT utilities: validates JWT (evidence: `app/dependencies.py`)
- Student routes → Request authorization: uses dependencies (evidence: `app/routers/students.py`)
- Student routes → Student records: queries records (evidence: `app/routers/students.py`)
- Student routes → Department records: checks departments (evidence: `app/routers/students.py`)
- Student routes → User records: checks accounts (evidence: `app/routers/students.py`)
- Student routes → Student contracts: uses contracts (evidence: `app/routers/students.py`)
- Student routes → Common contracts: uses responses (evidence: `app/routers/students.py`)
- Department routes → Request authorization: uses dependencies (evidence: `app/routers/departments.py`)
- Department routes → Department records: queries records (evidence: `app/routers/departments.py`)
- Department routes → Department contracts: uses contracts (evidence: `app/routers/departments.py`)
- Department routes → Common contracts: uses responses (evidence: `app/routers/departments.py`)
- Document routes → Request authorization: uses dependencies (evidence: `app/routers/documents.py`)
- Document routes → Document records: queries records (evidence: `app/routers/documents.py`)
- Document routes → Student records: checks ownership (evidence: `app/routers/documents.py`)
- Document routes → User records: checks roles (evidence: `app/routers/documents.py`)
- Document routes → Document contracts: uses contracts (evidence: `app/routers/documents.py`)
- Document routes → Common contracts: uses responses (evidence: `app/routers/documents.py`)
- Document routes → S3 operations: uploads, deletes, signs (evidence: `app/routers/documents.py`)
- S3 operations → Amazon S3: stores objects (evidence: `app/services/s3_service.py`)
- S3 operations → Runtime configuration: reads bucket settings (evidence: `app/services/s3_service.py`)
- Database sessions → Runtime configuration: reads database URL (evidence: `app/database.py`)
- Database sessions → PostgreSQL: persists records (evidence: `README.md`)
- Student records → Database sessions: uses ORM base (evidence: `app/models/student.py`)
- User records → Database sessions: uses ORM base (evidence: `app/models/user.py`)
- Department records → Database sessions: uses ORM base (evidence: `app/models/department.py`)
- Document records → Database sessions: uses ORM base (evidence: `app/models/document.py`)
