# pratapajaysingh/sih-26238 architecture

> Architecture diagram of the GitHub repository pratapajaysingh/sih-26238, 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/pratapajaysingh/sih-26238
- Repository: https://github.com/pratapajaysingh/sih-26238

## Overview

TribalSetu is a scholarship and student-management API, with a Flutter frontend represented in the tree by platform runner scaffolding. The visible workflow includes user registration/login, student creation, and scholarship application creation and listing. Application creation checks that the referenced student and scholarship exist before storing a DRAFT application. The graph reflects sampled backend calls; scholarship and user API wiring, database dependency setup, and Flutter-to-API behavior could not be confirmed from the available excerpts.

Main entry points: [`backend/app/main.py`](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/main.py) (FastAPI application), [`backend/app/repositories/application_repository.py`](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/repositories/application_repository.py) (Application repository), [`backend/app/repositories/user_repository.py`](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/repositories/user_repository.py) (User repository), [`backend/app/repositories/student_repository.py`](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/repositories/student_repository.py) (Student repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API layer"]
  node_app["FastAPI application<br/>[main.py]"]
  node_user_api["User endpoints<br/>[user.py]"]
  node_student_api["Student endpoints<br/>[student.py]"]
  node_scholarship_api["Scholarship endpoints<br/>[scholarship.py]"]
  node_application_api["Application endpoints<br/>[application.py]"]
end

subgraph group_domain["Domain services"]
  node_user_service["User service<br/>[user_service.py]"]
  node_student_service["Student service<br/>[student_service.py]"]
  node_scholarship_service["Scholarship service"]
  node_application_service["Application service"]
  node_security["Password security<br/>[security.py]"]
end

subgraph group_data["Data layer"]
  node_user_schema["User schemas<br/>[user.py]"]
  node_student_schema["Student schemas<br/>[student.py]"]
  node_scholarship_schema["Scholarship schemas<br/>[scholarship.py]"]
  node_application_schema["Application schemas<br/>[application.py]"]
  node_user_model["User model<br/>[user.py]"]
  node_student_model["Student model<br/>[student.py]"]
  node_scholarship_model["Scholarship model<br/>[scholarship.py]"]
  node_application_model["Application model<br/>[application.py]"]
  node_user_repo["User repository<br/>[user_repository.py]"]
  node_student_repo["Student repository"]
  node_scholarship_repo["Scholarship repository"]
  node_application_repo["Application repository"]
  node_db_config["Database setup<br/>[database.py]"]
end

subgraph group_client["Client"]
  node_flutter["Flutter frontend"]
end

node_person(("User"))
node_postgres[("PostgreSQL")]

node_person -->|"uses API"| node_app
node_app -->|"registers routes"| node_user_api
node_app -->|"registers routes"| node_student_api
node_app -->|"registers routes"| node_scholarship_api
node_app -->|"registers routes"| node_application_api
node_application_api -->|"calls"| node_application_service
node_application_api -->|"validates and returns"| node_application_schema
node_application_service -->|"checks and stores"| node_application_repo
node_application_repo -->|"imports lookup"| node_student_repo
node_application_repo -->|"imports lookup"| node_scholarship_repo
node_application_repo -->|"queries and writes"| node_application_model
node_student_service -->|"queries and creates"| node_student_repo
node_student_service -->|"checks user"| node_user_repo
node_user_service -->|"queries and creates"| node_user_repo
node_user_service -->|"hashes and verifies"| node_security
node_user_repo -->|"queries and writes"| node_user_model
node_student_repo -->|"queries and writes"| node_student_model
node_scholarship_repo -->|"queries and writes"| node_scholarship_model
node_application_repo -->|"reads and writes"| node_postgres
node_student_repo -->|"reads and writes"| node_postgres
node_user_repo -->|"reads and writes"| node_postgres
node_scholarship_repo -->|"reads and writes"| node_postgres
node_app -->|"connects for test"| node_db_config
node_db_config -->|"creates engine"| node_postgres

click node_flutter "https://github.com/pratapajaysingh/sih-26238/tree/feature/frontend-setup/frontend"
click node_app "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/main.py"
click node_user_api "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/api/user.py"
click node_student_api "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/api/student.py"
click node_scholarship_api "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/api/scholarship.py"
click node_application_api "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/api/application.py"
click node_user_service "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/services/user_service.py"
click node_student_service "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/services/student_service.py"
click node_scholarship_service "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/services/scholarship_service.py"
click node_application_service "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/services/application_service.py"
click node_security "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/core/security.py"
click node_user_schema "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/schemas/user.py"
click node_student_schema "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/schemas/student.py"
click node_scholarship_schema "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/schemas/scholarship.py"
click node_application_schema "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/schemas/application.py"
click node_user_model "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/models/user.py"
click node_student_model "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/models/student.py"
click node_scholarship_model "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/models/scholarship.py"
click node_application_model "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/models/application.py"
click node_user_repo "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/repositories/user_repository.py"
click node_student_repo "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/repositories/student_repository.py"
click node_scholarship_repo "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/repositories/scholarship_repository.py"
click node_application_repo "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/repositories/application_repository.py"
click node_db_config "https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/core/database.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_app,node_user_api,node_student_api,node_scholarship_api,node_application_api,node_person toneBlue
class node_user_service,node_student_service,node_scholarship_service,node_application_service,node_security,node_postgres toneAmber
class node_user_schema,node_student_schema,node_scholarship_schema,node_application_schema,node_user_model,node_student_model,node_scholarship_model,node_application_model,node_user_repo,node_student_repo,node_scholarship_repo,node_application_repo,node_db_config toneMint
class node_flutter toneRose
```

## Components

### API layer

- [FastAPI application](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/main.py): `backend/app/main.py`
- [User endpoints](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/api/user.py): `backend/app/api/user.py`
- [Student endpoints](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/api/student.py): `backend/app/api/student.py`
- [Scholarship endpoints](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/api/scholarship.py): `backend/app/api/scholarship.py`
- [Application endpoints](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/api/application.py): `backend/app/api/application.py`

### Domain services

- [User service](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/services/user_service.py): `backend/app/services/user_service.py`
- [Student service](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/services/student_service.py): `backend/app/services/student_service.py`
- [Scholarship service](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/services/scholarship_service.py): `backend/app/services/scholarship_service.py`
- [Application service](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/services/application_service.py): `backend/app/services/application_service.py`
- [Password security](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/core/security.py): `backend/app/core/security.py`

### Data layer

- [User schemas](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/schemas/user.py): `backend/app/schemas/user.py`
- [Student schemas](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/schemas/student.py): `backend/app/schemas/student.py`
- [Scholarship schemas](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/schemas/scholarship.py): `backend/app/schemas/scholarship.py`
- [Application schemas](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/schemas/application.py): `backend/app/schemas/application.py`
- [User model](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/models/user.py): `backend/app/models/user.py`
- [Student model](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/models/student.py): `backend/app/models/student.py`
- [Scholarship model](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/models/scholarship.py): `backend/app/models/scholarship.py`
- [Application model](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/models/application.py): `backend/app/models/application.py`
- [User repository](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/repositories/user_repository.py): `backend/app/repositories/user_repository.py`
- [Student repository](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/repositories/student_repository.py): `backend/app/repositories/student_repository.py`
- [Scholarship repository](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/repositories/scholarship_repository.py): `backend/app/repositories/scholarship_repository.py`
- [Application repository](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/repositories/application_repository.py): `backend/app/repositories/application_repository.py`
- [Database setup](https://github.com/pratapajaysingh/sih-26238/blob/feature/frontend-setup/backend/app/core/database.py): `backend/app/core/database.py`

### Client

- [Flutter frontend](https://github.com/pratapajaysingh/sih-26238/tree/feature/frontend-setup/frontend): `frontend`

### Other components

- **User**
- **PostgreSQL**

## Connections

- User → FastAPI application: uses API
- FastAPI application → User endpoints: registers routes
- FastAPI application → Student endpoints: registers routes
- FastAPI application → Scholarship endpoints: registers routes
- FastAPI application → Application endpoints: registers routes
- Application endpoints → Application service: calls
- Application endpoints → Application schemas: validates and returns
- Application service → Application repository: checks and stores
- Application repository → Student repository: imports lookup
- Application repository → Scholarship repository: imports lookup
- Application repository → Application model: queries and writes
- Student service → Student repository: queries and creates
- Student service → User repository: checks user
- User service → User repository: queries and creates
- User service → Password security: hashes and verifies
- User repository → User model: queries and writes
- Student repository → Student model: queries and writes
- Scholarship repository → Scholarship model: queries and writes
- Application repository → PostgreSQL: reads and writes
- Student repository → PostgreSQL: reads and writes
- User repository → PostgreSQL: reads and writes
- Scholarship repository → PostgreSQL: reads and writes
- FastAPI application → Database setup: connects for test
- Database setup → PostgreSQL: creates engine
