# muaraai/mira architecture

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

- Interactive diagram: https://gitdiagram.com/muaraai/mira
- Repository: https://github.com/muaraai/mira

## Overview

Mira is a student-facing UBSI campus-services dashboard and API, with an MCP interface for AI agents. The main student workflow is dashboard login, session-backed requests to academic services, and results presented in the PWA; campus data is fetched from UBSI portals. Distinct capabilities include SIAKAD, MyBest coursework and attendance, library, news, repository, community, and push notifications. The graph combines sampled backend structure with README-documented capabilities; unsampled frontend and service internals are represented at their supported directory or module paths, and their detailed call relationships are omitted.

Main entry points: [`app/main.py`](https://github.com/muaraai/mira/blob/main/app/main.py) (FastAPI entry), [`app/modules/auth.py`](https://github.com/muaraai/mira/blob/main/app/modules/auth.py) (Login and auth), [`app/router_helper.py`](https://github.com/muaraai/mira/blob/main/app/router_helper.py) (Cache orchestration), [`app/upstream_session.py`](https://github.com/muaraai/mira/blob/main/app/upstream_session.py) (Campus sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Student dashboard"]
  node_dashboard["Dashboard PWA"]
  node_webapi["Web API client<br/>[api.ts]"]
end

subgraph group_api["API and access"]
  node_entry["FastAPI entry<br/>[main.py]"]
  node_auth["Login and auth<br/>[auth.py]"]
  node_deps["Request dependencies<br/>[deps.py]"]
  node_keys[("Personal API keys<br/>[api_keys_db.py]")]
  node_mcp["MCP tools<br/>[mcp_server.py]"]
end

subgraph group_academic["Campus services"]
  node_elearning["MyBest learning<br/>[elearning.py]"]
  node_siakad["SIAKAD academics<br/>[studentv2.py]"]
  node_library["Library and journals<br/>[elibrary.py]"]
  node_news["Campus news<br/>[news.py]"]
  node_repository["Research repository<br/>[repository.py]"]
  node_community["Student community<br/>[social.py]"]
  node_push["Push notifications<br/>[pwa_push.py]"]
end

subgraph group_state["State and integrations"]
  node_cacheflow["Cache orchestration<br/>[router_helper.py]"]
  node_cache[("Redis cache<br/>[cache.py]")]
  node_session["Campus sessions"]
  node_sessionstore[("Dashboard sessions<br/>[session_store.py]")]
  node_accountlinks[("Linked accounts<br/>[account_links.py]")]
  node_ratelimit["Login protection<br/>[login_guard.py]"]
end

node_student(("Student"))
node_campus["UBSI portals"]
node_redis[("Redis service")]
node_sqlite[("SQLite store")]
node_supabase[("Supabase")]

node_student -->|"uses"| node_dashboard
node_dashboard -.->|"requests"| node_webapi
node_webapi -.->|"calls REST"| node_entry
node_entry -->|"routes login"| node_auth
node_entry -->|"routes requests"| node_elearning
node_entry -->|"routes requests"| node_siakad
node_entry -->|"routes requests"| node_library
node_entry -->|"routes requests"| node_news
node_entry -->|"routes requests"| node_repository
node_entry -.->|"routes requests"| node_community
node_entry -.->|"routes requests"| node_push
node_entry -.->|"serves tools"| node_mcp
node_entry -->|"authenticates requests"| node_deps
node_entry -->|"resolves API keys"| node_keys
node_auth -->|"checks attempts"| node_ratelimit
node_auth -->|"stores sessions"| node_sessionstore
node_auth -->|"logs into portals"| node_session
node_elearning -->|"uses sessions"| node_session
node_siakad -->|"uses sessions"| node_session
node_elearning -->|"serves cached data"| node_cacheflow
node_siakad -->|"serves cached data"| node_cacheflow
node_repository -->|"serves cached data"| node_cacheflow
node_cacheflow -->|"reads and writes"| node_cache
node_cache -->|"uses"| node_redis
node_session -->|"requests data"| node_campus
node_accountlinks -->|"stores links"| node_sqlite
node_accountlinks -->|"caches links"| node_cache
node_community -->|"stores social data"| node_supabase
node_student -.->|"connects agent"| node_mcp

click node_dashboard "https://github.com/muaraai/mira/tree/main/landing-page/src/app/dashboard"
click node_webapi "https://github.com/muaraai/mira/blob/main/landing-page/src/lib/api.ts"
click node_entry "https://github.com/muaraai/mira/blob/main/app/main.py"
click node_auth "https://github.com/muaraai/mira/blob/main/app/modules/auth.py"
click node_deps "https://github.com/muaraai/mira/blob/main/app/deps.py"
click node_keys "https://github.com/muaraai/mira/blob/main/app/api_keys_db.py"
click node_mcp "https://github.com/muaraai/mira/blob/main/app/mcp_server.py"
click node_elearning "https://github.com/muaraai/mira/blob/main/app/modules/elearning.py"
click node_siakad "https://github.com/muaraai/mira/blob/main/app/modules/studentv2.py"
click node_library "https://github.com/muaraai/mira/blob/main/app/modules/elibrary.py"
click node_news "https://github.com/muaraai/mira/blob/main/app/modules/news.py"
click node_repository "https://github.com/muaraai/mira/blob/main/app/modules/repository.py"
click node_community "https://github.com/muaraai/mira/blob/main/app/modules/social.py"
click node_push "https://github.com/muaraai/mira/blob/main/app/modules/pwa_push.py"
click node_cacheflow "https://github.com/muaraai/mira/blob/main/app/router_helper.py"
click node_cache "https://github.com/muaraai/mira/blob/main/app/cache.py"
click node_session "https://github.com/muaraai/mira/blob/main/app/upstream_session.py"
click node_sessionstore "https://github.com/muaraai/mira/blob/main/app/session_store.py"
click node_accountlinks "https://github.com/muaraai/mira/blob/main/app/account_links.py"
click node_ratelimit "https://github.com/muaraai/mira/blob/main/app/login_guard.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_dashboard,node_webapi toneBlue
class node_entry,node_auth,node_deps,node_keys,node_mcp,node_redis,node_sqlite,node_supabase toneAmber
class node_elearning,node_siakad,node_library,node_news,node_repository,node_community,node_push toneMint
class node_cacheflow,node_cache,node_session,node_sessionstore,node_accountlinks,node_ratelimit toneRose
class node_student,node_campus toneIndigo
```

## Components

### Student dashboard

- [Dashboard PWA](https://github.com/muaraai/mira/tree/main/landing-page/src/app/dashboard): `landing-page/src/app/dashboard`
- [Web API client](https://github.com/muaraai/mira/blob/main/landing-page/src/lib/api.ts): `landing-page/src/lib/api.ts`

### API and access

- [FastAPI entry](https://github.com/muaraai/mira/blob/main/app/main.py): `app/main.py`
- [Login and auth](https://github.com/muaraai/mira/blob/main/app/modules/auth.py): `app/modules/auth.py`
- [Request dependencies](https://github.com/muaraai/mira/blob/main/app/deps.py): `app/deps.py`
- [Personal API keys](https://github.com/muaraai/mira/blob/main/app/api_keys_db.py): `app/api_keys_db.py`
- [MCP tools](https://github.com/muaraai/mira/blob/main/app/mcp_server.py): `app/mcp_server.py`

### Campus services

- [MyBest learning](https://github.com/muaraai/mira/blob/main/app/modules/elearning.py): `app/modules/elearning.py`
- [SIAKAD academics](https://github.com/muaraai/mira/blob/main/app/modules/studentv2.py): `app/modules/studentv2.py`
- [Library and journals](https://github.com/muaraai/mira/blob/main/app/modules/elibrary.py): `app/modules/elibrary.py`
- [Campus news](https://github.com/muaraai/mira/blob/main/app/modules/news.py): `app/modules/news.py`
- [Research repository](https://github.com/muaraai/mira/blob/main/app/modules/repository.py): `app/modules/repository.py`
- [Student community](https://github.com/muaraai/mira/blob/main/app/modules/social.py): `app/modules/social.py`
- [Push notifications](https://github.com/muaraai/mira/blob/main/app/modules/pwa_push.py): `app/modules/pwa_push.py`

### State and integrations

- [Cache orchestration](https://github.com/muaraai/mira/blob/main/app/router_helper.py): `app/router_helper.py`
- [Redis cache](https://github.com/muaraai/mira/blob/main/app/cache.py): `app/cache.py`
- [Campus sessions](https://github.com/muaraai/mira/blob/main/app/upstream_session.py): `app/upstream_session.py`
- [Dashboard sessions](https://github.com/muaraai/mira/blob/main/app/session_store.py): `app/session_store.py`
- [Linked accounts](https://github.com/muaraai/mira/blob/main/app/account_links.py): `app/account_links.py`
- [Login protection](https://github.com/muaraai/mira/blob/main/app/login_guard.py): `app/login_guard.py`

### Other components

- **Student**
- **UBSI portals**
- **Redis service**
- **SQLite store**
- **Supabase**

## Connections

- Student → Dashboard PWA: uses (evidence: `README.md`)
- Dashboard PWA → Web API client: requests
- Web API client → FastAPI entry: calls REST
- FastAPI entry → Login and auth: routes login (evidence: `app/main.py`)
- FastAPI entry → MyBest learning: routes requests (evidence: `app/main.py`)
- FastAPI entry → SIAKAD academics: routes requests (evidence: `app/main.py`)
- FastAPI entry → Library and journals: routes requests (evidence: `app/main.py`)
- FastAPI entry → Campus news: routes requests (evidence: `app/main.py`)
- FastAPI entry → Research repository: routes requests (evidence: `app/main.py`)
- FastAPI entry → Student community: routes requests (evidence: `app/main.py`)
- FastAPI entry → Push notifications: routes requests (evidence: `app/main.py`)
- FastAPI entry → MCP tools: serves tools
- FastAPI entry → Request dependencies: authenticates requests (evidence: `app/main.py`)
- FastAPI entry → Personal API keys: resolves API keys (evidence: `app/main.py`)
- Login and auth → Login protection: checks attempts (evidence: `app/modules/auth.py`)
- Login and auth → Dashboard sessions: stores sessions (evidence: `README.md`)
- Login and auth → Campus sessions: logs into portals (evidence: `app/modules/auth.py`)
- MyBest learning → Campus sessions: uses sessions (evidence: `app/modules/elearning.py`)
- SIAKAD academics → Campus sessions: uses sessions (evidence: `app/modules/studentv2.py`)
- MyBest learning → Cache orchestration: serves cached data (evidence: `app/modules/elearning.py`)
- SIAKAD academics → Cache orchestration: serves cached data (evidence: `app/modules/studentv2.py`)
- Research repository → Cache orchestration: serves cached data (evidence: `app/modules/repository.py`)
- Cache orchestration → Redis cache: reads and writes (evidence: `app/router_helper.py`)
- Redis cache → Redis service: uses (evidence: `app/cache.py`)
- Campus sessions → UBSI portals: requests data (evidence: `README.md`)
- Linked accounts → SQLite store: stores links (evidence: `app/account_links.py`)
- Linked accounts → Redis cache: caches links (evidence: `app/account_links.py`)
- Student community → Supabase: stores social data (evidence: `README.md`)
- Student → MCP tools: connects agent (evidence: `README.md`)
