# vamsienduri/s_g_1 architecture

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

- Interactive diagram: https://gitdiagram.com/vamsienduri/s_g_1
- Repository: https://github.com/vamsienduri/s_g_1

## Overview

This is a small Streamlit/FastAPI application for student and trainer account registration and login. Users submit credentials or registration details; the Streamlit app sends them to FastAPI, which reads or writes Supabase’s users table. Successful login stores the returned identity in session state and routes to a role-specific dashboard, where session and role checks run before dashboard content is shown. The sampled code supports these flows; the trainer dashboard’s role check is hard-coded and does not actually validate the session role.

Main entry points: [`project/app.py`](https://github.com/vamsienduri/s_g_1/blob/main/project/app.py) (Login form), [`project/main.py`](https://github.com/vamsienduri/s_g_1/blob/main/project/main.py) (Login endpoint), [`project/pages/StudentDashboard.py`](https://github.com/vamsienduri/s_g_1/blob/main/project/pages/StudentDashboard.py) (Student access checks), [`project/pages/TrainerDashboard.py`](https://github.com/vamsienduri/s_g_1/blob/main/project/pages/TrainerDashboard.py) (Trainer access checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Streamlit frontend"]
  node_login["Login form<br/>[app.py]"]
  node_registration["Registration form<br/>[app.py]"]
  node_student_gate["Student access checks"]
  node_student_dashboard["Student dashboard"]
  node_trainer_gate["Trainer access checks"]
  node_trainer_dashboard["Trainer dashboard"]
end

subgraph group_backend["FastAPI backend"]
  node_login_api["Login endpoint<br/>[main.py]"]
  node_registration_api["Registration endpoint<br/>[main.py]"]
end

subgraph group_data["User persistence"]
  node_users_db[("Supabase users")]
end

node_user(("User"))

node_user -->|"enters credentials"| node_login
node_user -->|"enters details"| node_registration
node_login -->|"posts credentials"| node_login_api
node_login_api -->|"queries users"| node_users_db
node_login_api -->|"returns login result"| node_login
node_registration -->|"posts user"| node_registration_api
node_registration_api -->|"inserts user"| node_users_db
node_login -->|"routes by role"| node_student_gate
node_login -->|"routes by role"| node_trainer_gate
node_student_gate -->|"allows display"| node_student_dashboard
node_trainer_gate -->|"allows display"| node_trainer_dashboard

click node_login "https://github.com/vamsienduri/s_g_1/blob/main/project/app.py"
click node_registration "https://github.com/vamsienduri/s_g_1/blob/main/project/app.py"
click node_login_api "https://github.com/vamsienduri/s_g_1/blob/main/project/main.py"
click node_registration_api "https://github.com/vamsienduri/s_g_1/blob/main/project/main.py"
click node_student_gate "https://github.com/vamsienduri/s_g_1/blob/main/project/pages/StudentDashboard.py"
click node_student_dashboard "https://github.com/vamsienduri/s_g_1/blob/main/project/pages/StudentDashboard.py"
click node_trainer_gate "https://github.com/vamsienduri/s_g_1/blob/main/project/pages/TrainerDashboard.py"
click node_trainer_dashboard "https://github.com/vamsienduri/s_g_1/blob/main/project/pages/TrainerDashboard.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_login,node_registration,node_student_gate,node_student_dashboard,node_trainer_gate,node_trainer_dashboard,node_user toneBlue
class node_login_api,node_registration_api toneAmber
class node_users_db toneMint
```

## Components

### Streamlit frontend

- [Login form](https://github.com/vamsienduri/s_g_1/blob/main/project/app.py): `project/app.py`
- [Registration form](https://github.com/vamsienduri/s_g_1/blob/main/project/app.py): `project/app.py`
- [Student access checks](https://github.com/vamsienduri/s_g_1/blob/main/project/pages/StudentDashboard.py): `project/pages/StudentDashboard.py`
- [Student dashboard](https://github.com/vamsienduri/s_g_1/blob/main/project/pages/StudentDashboard.py): `project/pages/StudentDashboard.py`
- [Trainer access checks](https://github.com/vamsienduri/s_g_1/blob/main/project/pages/TrainerDashboard.py): `project/pages/TrainerDashboard.py`
- [Trainer dashboard](https://github.com/vamsienduri/s_g_1/blob/main/project/pages/TrainerDashboard.py): `project/pages/TrainerDashboard.py`

### FastAPI backend

- [Login endpoint](https://github.com/vamsienduri/s_g_1/blob/main/project/main.py): `project/main.py`
- [Registration endpoint](https://github.com/vamsienduri/s_g_1/blob/main/project/main.py): `project/main.py`

### User persistence

- **Supabase users**

### Other components

- **User**

## Connections

- User → Login form: enters credentials (evidence: `project/app.py`)
- User → Registration form: enters details (evidence: `project/app.py`)
- Login form → Login endpoint: posts credentials (evidence: `project/app.py`)
- Login endpoint → Supabase users: queries users (evidence: `project/main.py`)
- Login endpoint → Login form: returns login result (evidence: `project/app.py`)
- Registration form → Registration endpoint: posts user (evidence: `project/app.py`)
- Registration endpoint → Supabase users: inserts user (evidence: `project/main.py`)
- Login form → Student access checks: routes by role (evidence: `project/app.py`)
- Login form → Trainer access checks: routes by role (evidence: `project/app.py`)
- Student access checks → Student dashboard: allows display (evidence: `project/pages/StudentDashboard.py`)
- Trainer access checks → Trainer dashboard: allows display (evidence: `project/pages/TrainerDashboard.py`)
