# rmkrv/leetbrofinder architecture

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

- Interactive diagram: https://gitdiagram.com/rmkrv/leetbrofinder
- Repository: https://github.com/rmkrv/leetbrofinder

## Overview

LeetBroFinder helps people find LeetCode practice partners: users verify a public profile, complete preferences, then discover partners through browsing or live search, connect, message, or start a cooperative coding session. The React app routes those activities through its API client to a Spring Boot REST API and PostgreSQL-backed services; LeetCode supplies profile verification and problem data. The README documents the major features and integrations, while source excerpts show selected service calls. Edges for unsampled controllers or pages are included only where documented; some implementation details remain unverified.

Main entry points: [`frontend/src/api.ts`](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/api.ts) (API client), [`frontend/src/App.tsx`](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/App.tsx) (App routes), [`app/src/main/java/com/rmkrv/app/service/ProfileAuthService.java`](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/ProfileAuthService.java) (Profile and auth), [`app/src/main/java/com/rmkrv/app/service/CoopSessionService.java`](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/CoopSessionService.java) (Session matchmaking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web app"]
  node_routes["App routes<br/>[App.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_verification_ui["Verification flow"]
  node_profile_ui["Profile setup"]
  node_login_ui["Login<br/>[LoginPage.tsx]"]
  node_browse_ui["Browse profiles<br/>[HomePage.tsx]"]
  node_live_ui["Live search<br/>[LiveSearchPage.tsx]"]
  node_connections_ui["Connections"]
  node_coop_ui["Coding sessions"]
  node_messages_ui["Messages<br/>[MessagesPage.tsx]"]
  node_e2ee_browser["Browser encryption<br/>[e2ee.ts]"]
end

subgraph group_identity["Identity and profiles"]
  node_profile_api["Profile endpoints"]
  node_auth_api["Auth endpoints"]
  node_verification_api["Verification endpoints"]
  node_profile_services["Profile and auth"]
end

subgraph group_discovery["Partner discovery"]
  node_discovery_api["Discovery endpoints"]
  node_live_service["Live search service"]
end

subgraph group_collaboration["Partner collaboration"]
  node_connections_api["Connection endpoints"]
  node_coop_api["Session endpoints"]
  node_coop_service["Session matchmaking"]
  node_invite_api["Session invites"]
  node_invite_service["Invite service"]
  node_problem_service["Problem catalog"]
  node_chat_api["Chat endpoints"]
  node_chat_service["Chat service<br/>[ChatService.java]"]
  node_e2ee_api["Device key endpoints"]
  node_e2ee_service["Key validation"]
  node_voice_service["Voice signaling"]
end

subgraph group_platform["API and persistence"]
  node_profile_store[("Profiles")]
  node_session_store[("Login sessions")]
  node_live_store[("Live searches")]
  node_session_store_coop[("Co-op sessions")]
end

node_user(("User"))
node_leetcode["LeetCode"]

node_user -->|"uses"| node_routes
node_routes -->|"routes to"| node_verification_ui
node_routes -->|"routes to"| node_profile_ui
node_routes -->|"routes to"| node_login_ui
node_routes -->|"routes to"| node_browse_ui
node_routes -->|"routes to"| node_live_ui
node_routes -->|"routes to"| node_connections_ui
node_routes -->|"routes to"| node_coop_ui
node_routes -->|"routes to"| node_messages_ui
node_verification_ui -.->|"requests through"| node_api_client
node_profile_ui -.->|"requests through"| node_api_client
node_login_ui -.->|"requests through"| node_api_client
node_browse_ui -.->|"requests through"| node_api_client
node_live_ui -->|"requests through"| node_api_client
node_connections_ui -.->|"requests through"| node_api_client
node_coop_ui -->|"requests through"| node_api_client
node_messages_ui -->|"requests through"| node_api_client
node_api_client -->|"calls"| node_verification_api
node_api_client -->|"calls"| node_auth_api
node_api_client -->|"calls"| node_profile_api
node_api_client -->|"calls"| node_discovery_api
node_api_client -->|"calls"| node_connections_api
node_api_client -->|"calls"| node_coop_api
node_api_client -->|"calls"| node_invite_api
node_api_client -->|"calls"| node_chat_api
node_api_client -->|"calls"| node_e2ee_api
node_verification_api -->|"checks profile"| node_leetcode
node_profile_api -->|"delegates to"| node_profile_services
node_auth_api -.->|"delegates to"| node_profile_services
node_verification_api -.->|"delegates to"| node_profile_services
node_profile_services -->|"reads and writes"| node_profile_store
node_profile_services -->|"stores sessions"| node_session_store
node_discovery_api -->|"delegates to"| node_live_service
node_live_service -->|"reads and writes"| node_live_store
node_live_service -->|"authenticates via"| node_profile_services
node_coop_api -->|"delegates to"| node_coop_service
node_coop_service -->|"reads and writes"| node_session_store_coop
node_coop_service -->|"selects problems"| node_problem_service
node_problem_service -->|"fetches catalog"| node_leetcode
node_invite_api -->|"delegates to"| node_invite_service
node_invite_service -->|"creates invited session"| node_coop_service
node_coop_api -->|"routes signaling"| node_voice_service
node_messages_ui -->|"encrypts messages"| node_e2ee_browser
node_coop_ui -->|"encrypts messages"| node_e2ee_browser
node_e2ee_browser -->|"registers keys"| node_e2ee_api
node_e2ee_api -->|"delegates to"| node_e2ee_service
node_chat_api -.->|"delegates to"| node_chat_service
node_chat_service -.->|"validates envelopes"| node_e2ee_service

click node_routes "https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/api.ts"
click node_verification_ui "https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/VerificationPage.tsx"
click node_profile_ui "https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/ProfileFormPage.tsx"
click node_login_ui "https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/LoginPage.tsx"
click node_profile_api "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/ProfileController.java"
click node_auth_api "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/AuthController.java"
click node_verification_api "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/VerificationController.java"
click node_profile_services "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/ProfileAuthService.java"
click node_profile_store "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/repository/ProfileRepository.java"
click node_session_store "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/repository/LoginSessionRepository.java"
click node_browse_ui "https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/HomePage.tsx"
click node_live_ui "https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/LiveSearchPage.tsx"
click node_discovery_api "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/LiveSearchController.java"
click node_live_service "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/LiveSearchService.java"
click node_live_store "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/repository/LiveSearchRepository.java"
click node_connections_ui "https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/ConnectionsPage.tsx"
click node_connections_api "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/ConnectionController.java"
click node_coop_ui "https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/CoopSessionPage.tsx"
click node_coop_api "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/CoopSessionController.java"
click node_coop_service "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/CoopSessionService.java"
click node_invite_api "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/SessionInviteController.java"
click node_invite_service "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/SessionInviteService.java"
click node_session_store_coop "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/repository/CoopSessionRepository.java"
click node_problem_service "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/LeetCodeClient.java"
click node_messages_ui "https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/MessagesPage.tsx"
click node_chat_api "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/ChatController.java"
click node_chat_service "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/ChatService.java"
click node_e2ee_browser "https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/e2ee.ts"
click node_e2ee_api "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/E2eeKeyController.java"
click node_e2ee_service "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/E2eeKeyService.java"
click node_voice_service "https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/VoiceChannelService.java"

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_routes,node_api_client,node_verification_ui,node_profile_ui,node_login_ui,node_browse_ui,node_live_ui,node_connections_ui,node_coop_ui,node_messages_ui,node_e2ee_browser,node_user toneBlue
class node_profile_api,node_auth_api,node_verification_api,node_profile_services toneAmber
class node_discovery_api,node_live_service toneMint
class node_connections_api,node_coop_api,node_coop_service,node_invite_api,node_invite_service,node_problem_service,node_chat_api,node_chat_service,node_e2ee_api,node_e2ee_service,node_voice_service toneRose
class node_profile_store,node_session_store,node_live_store,node_session_store_coop,node_leetcode toneIndigo
```

## Components

### Web app

- [App routes](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/api.ts): `frontend/src/api.ts`
- [Verification flow](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/VerificationPage.tsx): `frontend/src/pages/VerificationPage.tsx`
- [Profile setup](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/ProfileFormPage.tsx): `frontend/src/pages/ProfileFormPage.tsx`
- [Login](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/LoginPage.tsx): `frontend/src/pages/LoginPage.tsx`
- [Browse profiles](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/HomePage.tsx): `frontend/src/pages/HomePage.tsx`
- [Live search](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/LiveSearchPage.tsx): `frontend/src/pages/LiveSearchPage.tsx`
- [Connections](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/ConnectionsPage.tsx): `frontend/src/pages/ConnectionsPage.tsx`
- [Coding sessions](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/CoopSessionPage.tsx): `frontend/src/pages/CoopSessionPage.tsx`
- [Messages](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/pages/MessagesPage.tsx): `frontend/src/pages/MessagesPage.tsx`
- [Browser encryption](https://github.com/rmkrv/leetbrofinder/blob/main/frontend/src/e2ee.ts): `frontend/src/e2ee.ts`

### Identity and profiles

- [Profile endpoints](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/ProfileController.java): `app/src/main/java/com/rmkrv/app/api/ProfileController.java`
- [Auth endpoints](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/AuthController.java): `app/src/main/java/com/rmkrv/app/api/AuthController.java`
- [Verification endpoints](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/VerificationController.java): `app/src/main/java/com/rmkrv/app/api/VerificationController.java`
- [Profile and auth](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/ProfileAuthService.java): `app/src/main/java/com/rmkrv/app/service/ProfileAuthService.java`

### Partner discovery

- [Discovery endpoints](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/LiveSearchController.java): `app/src/main/java/com/rmkrv/app/api/LiveSearchController.java`
- [Live search service](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/LiveSearchService.java): `app/src/main/java/com/rmkrv/app/service/LiveSearchService.java`

### Partner collaboration

- [Connection endpoints](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/ConnectionController.java): `app/src/main/java/com/rmkrv/app/api/ConnectionController.java`
- [Session endpoints](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/CoopSessionController.java): `app/src/main/java/com/rmkrv/app/api/CoopSessionController.java`
- [Session matchmaking](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/CoopSessionService.java): `app/src/main/java/com/rmkrv/app/service/CoopSessionService.java`
- [Session invites](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/SessionInviteController.java): `app/src/main/java/com/rmkrv/app/api/SessionInviteController.java`
- [Invite service](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/SessionInviteService.java): `app/src/main/java/com/rmkrv/app/service/SessionInviteService.java`
- [Problem catalog](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/LeetCodeClient.java): `app/src/main/java/com/rmkrv/app/service/LeetCodeClient.java`
- [Chat endpoints](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/ChatController.java): `app/src/main/java/com/rmkrv/app/api/ChatController.java`
- [Chat service](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/ChatService.java): `app/src/main/java/com/rmkrv/app/service/ChatService.java`
- [Device key endpoints](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/api/E2eeKeyController.java): `app/src/main/java/com/rmkrv/app/api/E2eeKeyController.java`
- [Key validation](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/E2eeKeyService.java): `app/src/main/java/com/rmkrv/app/service/E2eeKeyService.java`
- [Voice signaling](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/service/VoiceChannelService.java): `app/src/main/java/com/rmkrv/app/service/VoiceChannelService.java`

### API and persistence

- [Profiles](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/repository/ProfileRepository.java): `app/src/main/java/com/rmkrv/app/repository/ProfileRepository.java`
- [Login sessions](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/repository/LoginSessionRepository.java): `app/src/main/java/com/rmkrv/app/repository/LoginSessionRepository.java`
- [Live searches](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/repository/LiveSearchRepository.java): `app/src/main/java/com/rmkrv/app/repository/LiveSearchRepository.java`
- [Co-op sessions](https://github.com/rmkrv/leetbrofinder/blob/main/app/src/main/java/com/rmkrv/app/repository/CoopSessionRepository.java): `app/src/main/java/com/rmkrv/app/repository/CoopSessionRepository.java`

### Other components

- **User**
- **LeetCode**

## Connections

- User → App routes: uses (evidence: `frontend/src/App.tsx`)
- App routes → Verification flow: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Profile setup: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Login: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Browse profiles: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Live search: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Connections: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Coding sessions: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Messages: routes to (evidence: `frontend/src/App.tsx`)
- Verification flow → API client: requests through
- Profile setup → API client: requests through
- Login → API client: requests through
- Browse profiles → API client: requests through
- Live search → API client: requests through (evidence: `frontend/src/pages/LiveSearchPage.tsx`)
- Connections → API client: requests through
- Coding sessions → API client: requests through (evidence: `frontend/src/pages/CoopSessionPage.tsx`)
- Messages → API client: requests through (evidence: `frontend/src/pages/MessagesPage.tsx`)
- API client → Verification endpoints: calls (evidence: `README.md`)
- API client → Auth endpoints: calls (evidence: `README.md`)
- API client → Profile endpoints: calls (evidence: `README.md`)
- API client → Discovery endpoints: calls (evidence: `README.md`)
- API client → Connection endpoints: calls (evidence: `README.md`)
- API client → Session endpoints: calls (evidence: `README.md`)
- API client → Session invites: calls (evidence: `README.md`)
- API client → Chat endpoints: calls (evidence: `README.md`)
- API client → Device key endpoints: calls (evidence: `README.md`)
- Verification endpoints → LeetCode: checks profile (evidence: `README.md`)
- Profile endpoints → Profile and auth: delegates to (evidence: `app/src/main/java/com/rmkrv/app/api/ProfileController.java`)
- Auth endpoints → Profile and auth: delegates to
- Verification endpoints → Profile and auth: delegates to
- Profile and auth → Profiles: reads and writes (evidence: `app/src/main/java/com/rmkrv/app/service/ProfileAuthService.java`)
- Profile and auth → Login sessions: stores sessions (evidence: `app/src/main/java/com/rmkrv/app/service/ProfileAuthService.java`)
- Discovery endpoints → Live search service: delegates to (evidence: `app/src/main/java/com/rmkrv/app/service/LiveSearchService.java`)
- Live search service → Live searches: reads and writes (evidence: `app/src/main/java/com/rmkrv/app/service/LiveSearchService.java`)
- Live search service → Profile and auth: authenticates via (evidence: `app/src/main/java/com/rmkrv/app/service/LiveSearchService.java`)
- Session endpoints → Session matchmaking: delegates to (evidence: `app/src/main/java/com/rmkrv/app/api/CoopSessionController.java`)
- Session matchmaking → Co-op sessions: reads and writes (evidence: `app/src/main/java/com/rmkrv/app/service/CoopSessionService.java`)
- Session matchmaking → Problem catalog: selects problems (evidence: `app/src/main/java/com/rmkrv/app/service/CoopSessionService.java`)
- Problem catalog → LeetCode: fetches catalog (evidence: `README.md`)
- Session invites → Invite service: delegates to (evidence: `app/src/main/java/com/rmkrv/app/api/SessionInviteController.java`)
- Invite service → Session matchmaking: creates invited session (evidence: `app/src/main/java/com/rmkrv/app/service/SessionInviteService.java`)
- Session endpoints → Voice signaling: routes signaling (evidence: `app/src/main/java/com/rmkrv/app/api/CoopSessionController.java`)
- Messages → Browser encryption: encrypts messages (evidence: `frontend/src/pages/MessagesPage.tsx`)
- Coding sessions → Browser encryption: encrypts messages (evidence: `frontend/src/pages/CoopSessionPage.tsx`)
- Browser encryption → Device key endpoints: registers keys (evidence: `README.md`)
- Device key endpoints → Key validation: delegates to (evidence: `app/src/main/java/com/rmkrv/app/api/E2eeKeyController.java`)
- Chat endpoints → Chat service: delegates to
- Chat service → Key validation: validates envelopes
