# blurzzud/pollakcord architecture

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

- Interactive diagram: https://gitdiagram.com/blurzzud/pollakcord
- Repository: https://github.com/blurzzud/pollakcord

## Overview

PollákCord is a school-only communication platform: students verify school affiliation, create private accounts, then use social, messaging, server, class-space, DÖK, forms, and voice features. The React SPA uses the FastAPI REST API and WebSocket; browser-to-browser audio uses WebRTC. The graph combines documented architecture and capabilities with sampled wiring. Several feature routers and services are unsampled, so their documented responsibilities are shown without inferring internal call chains.

Main entry points: [`backend/app/db/base.py`](https://github.com/blurzzud/pollakcord/blob/main/backend/app/db/base.py) (Application database), [`backend/app/api/v1/router.py`](https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/router.py) (API router), [`backend/app/realtime/ws.py`](https://github.com/blurzzud/pollakcord/blob/main/backend/app/realtime/ws.py) (Realtime and signaling), [`frontend/src/App.tsx`](https://github.com/blurzzud/pollakcord/blob/main/frontend/src/App.tsx) (React SPA)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser application"]
  node_spa["React SPA<br/>[App.tsx]"]
  node_api_client["REST client<br/>[client.ts]"]
  node_realtime_client["Realtime client<br/>[socket.ts]"]
  node_voice_client["Voice manager<br/>[VoiceManager.ts]"]
end

subgraph group_api["API and identity"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_api_router["API router<br/>[router.py]"]
  node_sessions["Session security<br/>[sessions.py]"]
  node_kreta_flow["Kréta verification<br/>[flows.py]"]
  node_kreta_adapter["Kréta adapter<br/>[adapter.py]"]
end

subgraph group_features["Communication features"]
  node_social["Profiles and friends<br/>[friends.py]"]
  node_servers["Servers and channels<br/>[servers.py]"]
  node_messages["DMs and messaging<br/>[messages.py]"]
  node_class_spaces["Class spaces<br/>[class_spaces.py]"]
  node_dok["DÖK messages<br/>[dok.py]"]
  node_forms["School forms<br/>[forms.py]"]
  node_moderation["Moderation<br/>[moderation.py]"]
  node_search["Search<br/>[search.py]"]
  node_notifications["Notifications<br/>[notifications.py]"]
end

subgraph group_runtime["Runtime foundations"]
  node_realtime_server["Realtime and signaling<br/>[ws.py]"]
  node_voice_server["Voice rooms<br/>[voice.py]"]
  node_encryption["Envelope encryption<br/>[envelope.py]"]
  node_database[("Application database<br/>[base.py]")]
end

node_student(("Student"))
node_kreta_service{{"E-Kréta"}}
node_peer(("Other browsers"))

node_student -->|"uses"| node_spa
node_spa -->|"requests through"| node_api_client
node_spa -.->|"connects through"| node_realtime_client
node_api_client -->|"calls REST"| node_api_router
node_api_router -->|"routes to"| node_auth_routes
node_api_router -->|"routes to"| node_social
node_api_router -->|"routes to"| node_servers
node_api_router -->|"routes to"| node_realtime_server
node_auth_routes -->|"starts verification"| node_kreta_flow
node_kreta_flow -->|"delegates to"| node_kreta_adapter
node_kreta_adapter -->|"verifies with"| node_kreta_service
node_auth_routes -->|"manages sessions"| node_sessions
node_sessions -->|"reads and writes"| node_database
node_social -.->|"persists records"| node_database
node_servers -.->|"persists records"| node_database
node_messages -->|"encrypts content"| node_encryption
node_messages -->|"stores messages"| node_database
node_class_spaces -.->|"stores conversations"| node_database
node_dok -.->|"stores messages"| node_database
node_forms -->|"encrypts answers"| node_encryption
node_forms -.->|"stores responses"| node_database
node_moderation -.->|"records actions"| node_database
node_search -->|"searches messages"| node_messages
node_realtime_client -->|"exchanges events"| node_realtime_server
node_realtime_server -.->|"dispatches signaling"| node_voice_server
node_voice_client -->|"signals through"| node_realtime_client
node_voice_client -->|"sends WebRTC audio"| node_peer
node_voice_server -->|"relays signaling"| node_peer
node_notifications -.->|"pushes events"| node_realtime_server

click node_spa "https://github.com/blurzzud/pollakcord/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/blurzzud/pollakcord/blob/main/frontend/src/api/client.ts"
click node_realtime_client "https://github.com/blurzzud/pollakcord/blob/main/frontend/src/realtime/socket.ts"
click node_voice_client "https://github.com/blurzzud/pollakcord/blob/main/frontend/src/voice/VoiceManager.ts"
click node_auth_routes "https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/auth.py"
click node_api_router "https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/router.py"
click node_sessions "https://github.com/blurzzud/pollakcord/blob/main/backend/app/security/sessions.py"
click node_kreta_flow "https://github.com/blurzzud/pollakcord/blob/main/backend/app/integrations/kreta/flows.py"
click node_kreta_adapter "https://github.com/blurzzud/pollakcord/blob/main/backend/app/integrations/kreta/adapter.py"
click node_social "https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/friends.py"
click node_servers "https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/servers.py"
click node_messages "https://github.com/blurzzud/pollakcord/blob/main/backend/app/services/messages.py"
click node_class_spaces "https://github.com/blurzzud/pollakcord/blob/main/backend/app/services/class_spaces.py"
click node_dok "https://github.com/blurzzud/pollakcord/blob/main/backend/app/services/dok.py"
click node_forms "https://github.com/blurzzud/pollakcord/blob/main/backend/app/services/forms.py"
click node_moderation "https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/moderation.py"
click node_search "https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/search.py"
click node_notifications "https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/notifications.py"
click node_realtime_server "https://github.com/blurzzud/pollakcord/blob/main/backend/app/realtime/ws.py"
click node_voice_server "https://github.com/blurzzud/pollakcord/blob/main/backend/app/realtime/voice.py"
click node_encryption "https://github.com/blurzzud/pollakcord/blob/main/backend/app/crypto/envelope.py"
click node_database "https://github.com/blurzzud/pollakcord/blob/main/backend/app/db/base.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_spa,node_api_client,node_realtime_client,node_voice_client,node_peer toneBlue
class node_auth_routes,node_api_router,node_sessions,node_kreta_flow,node_kreta_adapter toneAmber
class node_social,node_servers,node_messages,node_class_spaces,node_dok,node_forms,node_moderation,node_search,node_notifications toneMint
class node_realtime_server,node_voice_server,node_encryption,node_database toneRose
class node_student,node_kreta_service toneIndigo
```

## Components

### Browser application

- [React SPA](https://github.com/blurzzud/pollakcord/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [REST client](https://github.com/blurzzud/pollakcord/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Realtime client](https://github.com/blurzzud/pollakcord/blob/main/frontend/src/realtime/socket.ts): `frontend/src/realtime/socket.ts`
- [Voice manager](https://github.com/blurzzud/pollakcord/blob/main/frontend/src/voice/VoiceManager.ts): `frontend/src/voice/VoiceManager.ts`

### API and identity

- [Authentication routes](https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/auth.py): `backend/app/api/v1/auth.py`
- [API router](https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Session security](https://github.com/blurzzud/pollakcord/blob/main/backend/app/security/sessions.py): `backend/app/security/sessions.py`
- [Kréta verification](https://github.com/blurzzud/pollakcord/blob/main/backend/app/integrations/kreta/flows.py): `backend/app/integrations/kreta/flows.py`
- [Kréta adapter](https://github.com/blurzzud/pollakcord/blob/main/backend/app/integrations/kreta/adapter.py): `backend/app/integrations/kreta/adapter.py`

### Communication features

- [Profiles and friends](https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/friends.py): `backend/app/api/v1/friends.py`
- [Servers and channels](https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/servers.py): `backend/app/api/v1/servers.py`
- [DMs and messaging](https://github.com/blurzzud/pollakcord/blob/main/backend/app/services/messages.py): `backend/app/services/messages.py`
- [Class spaces](https://github.com/blurzzud/pollakcord/blob/main/backend/app/services/class_spaces.py): `backend/app/services/class_spaces.py`
- [DÖK messages](https://github.com/blurzzud/pollakcord/blob/main/backend/app/services/dok.py): `backend/app/services/dok.py`
- [School forms](https://github.com/blurzzud/pollakcord/blob/main/backend/app/services/forms.py): `backend/app/services/forms.py`
- [Moderation](https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/moderation.py): `backend/app/api/v1/moderation.py`
- [Search](https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/search.py): `backend/app/api/v1/search.py`
- [Notifications](https://github.com/blurzzud/pollakcord/blob/main/backend/app/api/v1/notifications.py): `backend/app/api/v1/notifications.py`

### Runtime foundations

- [Realtime and signaling](https://github.com/blurzzud/pollakcord/blob/main/backend/app/realtime/ws.py): `backend/app/realtime/ws.py`
- [Voice rooms](https://github.com/blurzzud/pollakcord/blob/main/backend/app/realtime/voice.py): `backend/app/realtime/voice.py`
- [Envelope encryption](https://github.com/blurzzud/pollakcord/blob/main/backend/app/crypto/envelope.py): `backend/app/crypto/envelope.py`
- [Application database](https://github.com/blurzzud/pollakcord/blob/main/backend/app/db/base.py): `backend/app/db/base.py`

### Other components

- **Student**
- **E-Kréta**
- **Other browsers**

## Connections

- Student → React SPA: uses
- React SPA → REST client: requests through (evidence: `frontend/src/api/client.ts`)
- React SPA → Realtime client: connects through
- REST client → API router: calls REST
- API router → Authentication routes: routes to (evidence: `backend/app/api/v1/router.py`)
- API router → Profiles and friends: routes to (evidence: `backend/app/api/v1/router.py`)
- API router → Servers and channels: routes to (evidence: `backend/app/api/v1/router.py`)
- API router → Realtime and signaling: routes to (evidence: `backend/app/api/v1/router.py`)
- Authentication routes → Kréta verification: starts verification (evidence: `backend/app/api/v1/auth.py`)
- Kréta verification → Kréta adapter: delegates to (evidence: `backend/app/integrations/kreta/flows.py`)
- Kréta adapter → E-Kréta: verifies with
- Authentication routes → Session security: manages sessions (evidence: `backend/app/api/v1/auth.py`)
- Session security → Application database: reads and writes (evidence: `backend/app/security/sessions.py`)
- Profiles and friends → Application database: persists records
- Servers and channels → Application database: persists records
- DMs and messaging → Envelope encryption: encrypts content
- DMs and messaging → Application database: stores messages
- Class spaces → Application database: stores conversations
- DÖK messages → Application database: stores messages
- School forms → Envelope encryption: encrypts answers (evidence: `backend/app/services/forms.py`)
- School forms → Application database: stores responses
- Moderation → Application database: records actions
- Search → DMs and messaging: searches messages
- Realtime client → Realtime and signaling: exchanges events
- Realtime and signaling → Voice rooms: dispatches signaling
- Voice manager → Realtime client: signals through (evidence: `frontend/src/voice/VoiceManager.ts`)
- Voice manager → Other browsers: sends WebRTC audio
- Voice rooms → Other browsers: relays signaling
- Notifications → Realtime and signaling: pushes events
