# harsha-code-per/rostra architecture

> Architecture diagram of the GitHub repository harsha-code-per/rostra, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harsha-code-per/rostra
- Repository: https://github.com/harsha-code-per/rostra

## Overview

Rostra is a multi-tenant HR workspace for Indian teams. Employees and HR use the web app to manage attendance, leave, employee records, and payroll; payroll calculations use attendance and approved paid leave to derive payable days and net pay. Platform owners provision or suspend company workspaces and triage inquiries. The frontend’s typed API client connects the Next.js app to FastAPI; API routes delegate business work to services and persist tenant-scoped records. Major workflows are documented, but many frontend-to-endpoint calls and service internals were not sampled, so those links rely on the README or are omitted.

Main entry points: [`backend/app/api/router.py`](https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/router.py) (API route registry), [`frontend/lib/api.ts`](https://github.com/harsha-code-per/rostra/blob/main/frontend/lib/api.ts) (Typed API client), [`backend/app/database.py`](https://github.com/harsha-code-per/rostra/blob/main/backend/app/database.py) (Database session), [`backend/app/services/email_service.py`](https://github.com/harsha-code-per/rostra/blob/main/backend/app/services/email_service.py) (Email delivery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workspace"]
  node_web["Next.js workspace<br/>[layout.tsx]"]
  node_admin_ui["HR dashboards<br/>[page.tsx]"]
  node_employee_ui["Employee dashboard<br/>[page.tsx]"]
  node_platform_ui["Platform console<br/>[page.tsx]"]
  node_login_ui["Sign-in<br/>[page.tsx]"]
  node_api_client["Typed API client<br/>[api.ts]"]
end

subgraph group_hr["HR operations"]
  node_employees["Employees and profiles<br/>[employees.py]"]
  node_attendance["Attendance<br/>[attendance.py]"]
  node_attendance_logic["Attendance rules"]
  node_leaves["Leave requests<br/>[leaves.py]"]
  node_leave_logic["Leave decisions<br/>[leave_service.py]"]
  node_payroll["Payroll and payslips<br/>[payroll.py]"]
  node_payroll_logic["Payroll calculation<br/>[payroll_service.py]"]
  node_analytics["Analytics<br/>[analytics.py]"]
  node_notifications["Notifications<br/>[notifications.py]"]
end

subgraph group_platform["Platform administration"]
  node_platform_routes["Platform controls<br/>[super_admin.py]"]
  node_platform_logic["Workspace provisioning"]
  node_inquiries["Workspace inquiries<br/>[inquiries.py]"]
end

subgraph group_backend["API and data"]
  node_auth["Authentication<br/>[auth.py]"]
  node_email["Email delivery<br/>[email_service.py]"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_api_router["API route registry<br/>[router.py]"]
  node_database["Database session<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
end

node_browser(("Employees and HR"))
node_owner(("Platform owner"))
node_smtp["SMTP provider"]

node_browser -->|"uses"| node_web
node_owner -->|"manages workspaces"| node_platform_ui
node_web -->|"uses client"| node_api_client
node_login_ui -->|"signs in through"| node_api_client
node_admin_ui -->|"requests HR data"| node_api_client
node_employee_ui -->|"requests employee data"| node_api_client
node_platform_ui -->|"requests platform data"| node_api_client
node_api_client -->|"sends REST requests"| node_api_app
node_api_app -->|"mounts routes"| node_api_router
node_api_router -->|"registers"| node_auth
node_api_router -->|"registers"| node_employees
node_api_router -->|"registers"| node_attendance
node_api_router -->|"registers"| node_leaves
node_api_router -->|"registers"| node_payroll
node_api_router -->|"registers"| node_analytics
node_api_router -->|"registers"| node_notifications
node_api_router -->|"registers"| node_platform_routes
node_api_router -->|"registers"| node_inquiries
node_attendance -->|"delegates rules"| node_attendance_logic
node_leaves -->|"delegates decisions"| node_leave_logic
node_payroll -->|"delegates calculations"| node_payroll_logic
node_platform_routes -->|"delegates operations"| node_platform_logic
node_auth -->|"sends account email"| node_email
node_platform_logic -->|"sends invitations"| node_email
node_platform_logic -->|"notifies inquiries"| node_email
node_api_app -->|"uses engine"| node_database
node_database -->|"connects to"| node_postgres
node_attendance_logic -.->|"persists records"| node_database
node_leave_logic -.->|"persists requests"| node_database
node_payroll_logic -.->|"reads and writes"| node_database
node_email -.->|"sends mail"| node_smtp

click node_employees "https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/employees.py"
click node_attendance "https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/attendance.py"
click node_attendance_logic "https://github.com/harsha-code-per/rostra/blob/main/backend/app/services/attendance_service.py"
click node_leaves "https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/leaves.py"
click node_leave_logic "https://github.com/harsha-code-per/rostra/blob/main/backend/app/services/leave_service.py"
click node_payroll "https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/payroll.py"
click node_payroll_logic "https://github.com/harsha-code-per/rostra/blob/main/backend/app/services/payroll_service.py"
click node_analytics "https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/analytics.py"
click node_notifications "https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/notifications.py"
click node_auth "https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/auth.py"
click node_email "https://github.com/harsha-code-per/rostra/blob/main/backend/app/services/email_service.py"
click node_platform_routes "https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/super_admin.py"
click node_platform_logic "https://github.com/harsha-code-per/rostra/blob/main/backend/app/services/super_admin_service.py"
click node_inquiries "https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/inquiries.py"
click node_web "https://github.com/harsha-code-per/rostra/blob/main/frontend/app/dashboard/layout.tsx"
click node_admin_ui "https://github.com/harsha-code-per/rostra/blob/main/frontend/app/dashboard/admin/page.tsx"
click node_employee_ui "https://github.com/harsha-code-per/rostra/blob/main/frontend/app/dashboard/employee/page.tsx"
click node_platform_ui "https://github.com/harsha-code-per/rostra/blob/main/frontend/app/platform-admin/page.tsx"
click node_login_ui "https://github.com/harsha-code-per/rostra/blob/main/frontend/app/login/page.tsx"
click node_api_client "https://github.com/harsha-code-per/rostra/blob/main/frontend/lib/api.ts"
click node_api_app "https://github.com/harsha-code-per/rostra/blob/main/backend/app/main.py"
click node_api_router "https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/router.py"
click node_database "https://github.com/harsha-code-per/rostra/blob/main/backend/app/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_web,node_admin_ui,node_employee_ui,node_platform_ui,node_login_ui,node_api_client toneBlue
class node_employees,node_attendance,node_attendance_logic,node_leaves,node_leave_logic,node_payroll,node_payroll_logic,node_analytics,node_notifications toneAmber
class node_platform_routes,node_platform_logic,node_inquiries toneMint
class node_auth,node_email,node_api_app,node_api_router,node_database,node_postgres toneRose
class node_browser,node_owner,node_smtp toneIndigo
```

## Components

### Web workspace

- [Next.js workspace](https://github.com/harsha-code-per/rostra/blob/main/frontend/app/dashboard/layout.tsx): `frontend/app/dashboard/layout.tsx`
- [HR dashboards](https://github.com/harsha-code-per/rostra/blob/main/frontend/app/dashboard/admin/page.tsx): `frontend/app/dashboard/admin/page.tsx`
- [Employee dashboard](https://github.com/harsha-code-per/rostra/blob/main/frontend/app/dashboard/employee/page.tsx): `frontend/app/dashboard/employee/page.tsx`
- [Platform console](https://github.com/harsha-code-per/rostra/blob/main/frontend/app/platform-admin/page.tsx): `frontend/app/platform-admin/page.tsx`
- [Sign-in](https://github.com/harsha-code-per/rostra/blob/main/frontend/app/login/page.tsx): `frontend/app/login/page.tsx`
- [Typed API client](https://github.com/harsha-code-per/rostra/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`

### HR operations

- [Employees and profiles](https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/employees.py): `backend/app/api/employees.py`
- [Attendance](https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/attendance.py): `backend/app/api/attendance.py`
- [Attendance rules](https://github.com/harsha-code-per/rostra/blob/main/backend/app/services/attendance_service.py): `backend/app/services/attendance_service.py`
- [Leave requests](https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/leaves.py): `backend/app/api/leaves.py`
- [Leave decisions](https://github.com/harsha-code-per/rostra/blob/main/backend/app/services/leave_service.py): `backend/app/services/leave_service.py`
- [Payroll and payslips](https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/payroll.py): `backend/app/api/payroll.py`
- [Payroll calculation](https://github.com/harsha-code-per/rostra/blob/main/backend/app/services/payroll_service.py): `backend/app/services/payroll_service.py`
- [Analytics](https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/analytics.py): `backend/app/api/analytics.py`
- [Notifications](https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/notifications.py): `backend/app/api/notifications.py`

### Platform administration

- [Platform controls](https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/super_admin.py): `backend/app/api/super_admin.py`
- [Workspace provisioning](https://github.com/harsha-code-per/rostra/blob/main/backend/app/services/super_admin_service.py): `backend/app/services/super_admin_service.py`
- [Workspace inquiries](https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/inquiries.py): `backend/app/api/inquiries.py`

### API and data

- [Authentication](https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Email delivery](https://github.com/harsha-code-per/rostra/blob/main/backend/app/services/email_service.py): `backend/app/services/email_service.py`
- [FastAPI application](https://github.com/harsha-code-per/rostra/blob/main/backend/app/main.py): `backend/app/main.py`
- [API route registry](https://github.com/harsha-code-per/rostra/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Database session](https://github.com/harsha-code-per/rostra/blob/main/backend/app/database.py): `backend/app/database.py`
- **PostgreSQL**

### Other components

- **Employees and HR**
- **Platform owner**
- **SMTP provider**

## Connections

- Employees and HR → Next.js workspace: uses (evidence: `README.md`)
- Platform owner → Platform console: manages workspaces (evidence: `README.md`)
- Next.js workspace → Typed API client: uses client (evidence: `README.md`)
- Sign-in → Typed API client: signs in through (evidence: `README.md`)
- HR dashboards → Typed API client: requests HR data (evidence: `README.md`)
- Employee dashboard → Typed API client: requests employee data (evidence: `README.md`)
- Platform console → Typed API client: requests platform data (evidence: `README.md`)
- Typed API client → FastAPI application: sends REST requests (evidence: `README.md`)
- FastAPI application → API route registry: mounts routes (evidence: `backend/app/main.py`)
- API route registry → Authentication: registers (evidence: `backend/app/api/router.py`)
- API route registry → Employees and profiles: registers (evidence: `backend/app/api/router.py`)
- API route registry → Attendance: registers (evidence: `backend/app/api/router.py`)
- API route registry → Leave requests: registers (evidence: `backend/app/api/router.py`)
- API route registry → Payroll and payslips: registers (evidence: `backend/app/api/router.py`)
- API route registry → Analytics: registers (evidence: `backend/app/api/router.py`)
- API route registry → Notifications: registers (evidence: `backend/app/api/router.py`)
- API route registry → Platform controls: registers (evidence: `backend/app/api/router.py`)
- API route registry → Workspace inquiries: registers (evidence: `backend/app/api/router.py`)
- Attendance → Attendance rules: delegates rules (evidence: `backend/app/api/attendance.py`)
- Leave requests → Leave decisions: delegates decisions (evidence: `backend/app/api/leaves.py`)
- Payroll and payslips → Payroll calculation: delegates calculations (evidence: `backend/app/api/payroll.py`)
- Platform controls → Workspace provisioning: delegates operations (evidence: `backend/app/api/super_admin.py`)
- Authentication → Email delivery: sends account email (evidence: `backend/app/api/auth.py`)
- Workspace provisioning → Email delivery: sends invitations (evidence: `backend/app/services/super_admin_service.py`)
- Workspace provisioning → Email delivery: notifies inquiries (evidence: `backend/app/services/super_admin_service.py`)
- FastAPI application → Database session: uses engine (evidence: `backend/app/main.py`)
- Database session → PostgreSQL: connects to (evidence: `README.md`)
- Attendance rules → Database session: persists records
- Leave decisions → Database session: persists requests
- Payroll calculation → Database session: reads and writes
- Email delivery → SMTP provider: sends mail (evidence: `README.md`)
