# juliohor/ft_transcendence architecture

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

- Interactive diagram: https://gitdiagram.com/juliohor/ft_transcendence
- Repository: https://github.com/juliohor/ft_transcendence

## Overview

ft_transcendence is a web application combining accounts and profiles, friends and real-time chat, and multiplayer Pong. The main user journey enters through the routed frontend, authenticates, and then uses protected profile, social, or game features backed by Flask HTTP and Socket.IO handlers. The graph groups those product areas and shows selected internal layers. Edges follow shown imports, calls, or documented relationships; some frontend-to-backend wiring and unsampled implementation details are not established by the excerpts, so they are not inferred.

Main entry points: [`frontend/src/app/App.tsx`](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/app/App.tsx) (Routes and providers), [`backend/app/app.py`](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/app.py) (Flask and Socket.IO app), [`frontend/src/app/AuthProvider.tsx`](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/app/AuthProvider.tsx) (Auth provider), [`backend/app/social/routes.py`](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/social/routes.py) (Profile and friend routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Routes and providers<br/>[App.tsx]"]
  node_login["Login page<br/>[LoginPage.tsx]"]
  node_profile_page["Profile page<br/>[ProfilePage.tsx]"]
  node_friends_page["Friends page<br/>[FriendsPage.tsx]"]
  node_chat_page["Chat page<br/>[ChatPage.tsx]"]
end

subgraph group_identity["Identity and profiles"]
  node_auth_provider["Auth provider<br/>[AuthProvider.tsx]"]
  node_auth_api["Auth API client<br/>[auth.ts]"]
  node_profile_api["Profile API client<br/>[profile.ts]"]
  node_auth_routes["Auth routes<br/>[routes.py]"]
end

subgraph group_social["Friends and chat"]
  node_social_routes["Profile and friend routes<br/>[routes.py]"]
  node_social_handlers["Social event handlers<br/>[handlers.py]"]
  node_social_store["Social data store<br/>[store.py]"]
  node_chat_session["Chat session state<br/>[chat-session.ts]"]
  node_chat_api["Chat API client<br/>[chat.ts]"]
  node_friends_api["Friends API client<br/>[friends.ts]"]
  node_chat_hook["Chat session hook<br/>[useChatSession.ts]"]
  node_private_chat["Private chat rules<br/>[privateChat.ts]"]
end

subgraph group_pong["Pong game"]
  node_pong_page["Pong page<br/>[PongPage.tsx]"]
  node_pong_factory["Game factory<br/>[createPongGame.tsx]"]
  node_pong_app["Game interface<br/>[PongApp.tsx]"]
  node_paddle_input["Paddle input<br/>[usePaddleInput.ts]"]
  node_pong_transport["WebSocket transport"]
  node_matchmaker["Matchmaking queue<br/>[matchmaker.py]"]
  node_pong_handlers["Game event handlers<br/>[handlers.py]"]
  node_pong_match["Match simulation<br/>[match.py]"]
  node_pong_state["Match state<br/>[state.py]"]
end

subgraph group_platform["Backend platform"]
  node_backend_app["Flask and Socket.IO app<br/>[app.py]"]
  node_db["Database access<br/>[db.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_profile_page
node_app -->|"routes to"| node_friends_page
node_app -->|"routes to"| node_chat_page
node_app -->|"routes to"| node_pong_page
node_app -->|"provides auth"| node_auth_provider
node_auth_provider -->|"calls"| node_auth_api
node_auth_provider -->|"calls"| node_profile_api
node_profile_page -->|"calls"| node_profile_api
node_backend_app -->|"registers"| node_auth_routes
node_auth_routes -->|"queries"| node_db
node_backend_app -->|"registers"| node_social_routes
node_backend_app -->|"registers"| node_social_handlers
node_social_routes -->|"reads and writes"| node_social_store
node_social_routes -->|"broadcasts updates"| node_social_handlers
node_social_handlers -->|"reads and writes"| node_social_store
node_chat_page -->|"uses"| node_chat_hook
node_chat_hook -->|"uses"| node_chat_session
node_chat_hook -->|"uses"| node_private_chat
node_chat_session -->|"calls"| node_chat_api
node_private_chat -->|"calls"| node_chat_api
node_private_chat -->|"checks friendships"| node_friends_api
node_pong_page -.->|"creates game"| node_pong_factory
node_pong_factory -->|"renders"| node_pong_app
node_pong_app -->|"uses"| node_paddle_input
node_paddle_input -.->|"sends input"| node_pong_transport
node_backend_app -->|"registers"| node_pong_handlers
node_backend_app -->|"configures"| node_matchmaker
node_backend_app -->|"creates"| node_pong_match
node_pong_handlers -->|"dispatches queue"| node_matchmaker
node_matchmaker -->|"creates matches"| node_pong_match
node_pong_match -->|"uses state"| node_pong_state

click node_app "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/app/App.tsx"
click node_login "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/pages/LoginPage.tsx"
click node_profile_page "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/pages/ProfilePage.tsx"
click node_friends_page "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/pages/FriendsPage.tsx"
click node_chat_page "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/pages/ChatPage.tsx"
click node_auth_provider "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/app/AuthProvider.tsx"
click node_auth_api "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/api/auth.ts"
click node_profile_api "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/api/profile.ts"
click node_auth_routes "https://github.com/juliohor/ft_transcendence/blob/main/backend/app/auth/routes.py"
click node_social_routes "https://github.com/juliohor/ft_transcendence/blob/main/backend/app/social/routes.py"
click node_social_handlers "https://github.com/juliohor/ft_transcendence/blob/main/backend/app/social/handlers.py"
click node_social_store "https://github.com/juliohor/ft_transcendence/blob/main/backend/app/social/store.py"
click node_chat_session "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/app/chat-session.ts"
click node_chat_api "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/api/chat.ts"
click node_friends_api "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/api/friends.ts"
click node_chat_hook "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/chat/useChatSession.ts"
click node_private_chat "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/chat/privateChat.ts"
click node_pong_page "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/pages/PongPage.tsx"
click node_pong_factory "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/games/pong/createPongGame.tsx"
click node_pong_app "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/games/pong/view/PongApp.tsx"
click node_paddle_input "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/games/pong/view/usePaddleInput.ts"
click node_pong_transport "https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/transports/pong/WebSocketTransport.ts"
click node_backend_app "https://github.com/juliohor/ft_transcendence/blob/main/backend/app/app.py"
click node_db "https://github.com/juliohor/ft_transcendence/blob/main/backend/app/db.py"
click node_matchmaker "https://github.com/juliohor/ft_transcendence/blob/main/backend/app/ws_core/matchmaker.py"
click node_pong_handlers "https://github.com/juliohor/ft_transcendence/blob/main/backend/app/games/pong/handlers.py"
click node_pong_match "https://github.com/juliohor/ft_transcendence/blob/main/backend/app/games/pong/match.py"
click node_pong_state "https://github.com/juliohor/ft_transcendence/blob/main/backend/app/games/pong/state.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_app,node_login,node_profile_page,node_friends_page,node_chat_page,node_user toneBlue
class node_auth_provider,node_auth_api,node_profile_api,node_auth_routes toneAmber
class node_social_routes,node_social_handlers,node_social_store,node_chat_session,node_chat_api,node_friends_api,node_chat_hook,node_private_chat toneMint
class node_pong_page,node_pong_factory,node_pong_app,node_paddle_input,node_pong_transport,node_matchmaker,node_pong_handlers,node_pong_match,node_pong_state toneRose
class node_backend_app,node_db toneIndigo
```

## Components

### Web application

- [Routes and providers](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/app/App.tsx): `frontend/src/app/App.tsx`
- [Login page](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/pages/LoginPage.tsx): `frontend/src/pages/LoginPage.tsx`
- [Profile page](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/pages/ProfilePage.tsx): `frontend/src/pages/ProfilePage.tsx`
- [Friends page](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/pages/FriendsPage.tsx): `frontend/src/pages/FriendsPage.tsx`
- [Chat page](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/pages/ChatPage.tsx): `frontend/src/pages/ChatPage.tsx`

### Identity and profiles

- [Auth provider](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/app/AuthProvider.tsx): `frontend/src/app/AuthProvider.tsx`
- [Auth API client](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/api/auth.ts): `frontend/src/api/auth.ts`
- [Profile API client](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/api/profile.ts): `frontend/src/api/profile.ts`
- [Auth routes](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/auth/routes.py): `backend/app/auth/routes.py`

### Friends and chat

- [Profile and friend routes](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/social/routes.py): `backend/app/social/routes.py`
- [Social event handlers](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/social/handlers.py): `backend/app/social/handlers.py`
- [Social data store](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/social/store.py): `backend/app/social/store.py`
- [Chat session state](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/app/chat-session.ts): `frontend/src/app/chat-session.ts`
- [Chat API client](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/api/chat.ts): `frontend/src/api/chat.ts`
- [Friends API client](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/api/friends.ts): `frontend/src/api/friends.ts`
- [Chat session hook](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/chat/useChatSession.ts): `frontend/src/chat/useChatSession.ts`
- [Private chat rules](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/chat/privateChat.ts): `frontend/src/chat/privateChat.ts`

### Pong game

- [Pong page](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/pages/PongPage.tsx): `frontend/src/pages/PongPage.tsx`
- [Game factory](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/games/pong/createPongGame.tsx): `frontend/src/games/pong/createPongGame.tsx`
- [Game interface](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/games/pong/view/PongApp.tsx): `frontend/src/games/pong/view/PongApp.tsx`
- [Paddle input](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/games/pong/view/usePaddleInput.ts): `frontend/src/games/pong/view/usePaddleInput.ts`
- [WebSocket transport](https://github.com/juliohor/ft_transcendence/blob/main/frontend/src/transports/pong/WebSocketTransport.ts): `frontend/src/transports/pong/WebSocketTransport.ts`
- [Matchmaking queue](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/ws_core/matchmaker.py): `backend/app/ws_core/matchmaker.py`
- [Game event handlers](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/games/pong/handlers.py): `backend/app/games/pong/handlers.py`
- [Match simulation](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/games/pong/match.py): `backend/app/games/pong/match.py`
- [Match state](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/games/pong/state.py): `backend/app/games/pong/state.py`

### Backend platform

- [Flask and Socket.IO app](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/app.py): `backend/app/app.py`
- [Database access](https://github.com/juliohor/ft_transcendence/blob/main/backend/app/db.py): `backend/app/db.py`

### Other components

- **User**

## Connections

- User → Routes and providers: uses
- Routes and providers → Login page: routes to (evidence: `frontend/src/app/App.tsx`)
- Routes and providers → Profile page: routes to (evidence: `frontend/src/app/App.tsx`)
- Routes and providers → Friends page: routes to (evidence: `frontend/src/app/App.tsx`)
- Routes and providers → Chat page: routes to (evidence: `frontend/src/app/App.tsx`)
- Routes and providers → Pong page: routes to (evidence: `frontend/src/app/App.tsx`)
- Routes and providers → Auth provider: provides auth (evidence: `frontend/src/app/App.tsx`)
- Auth provider → Auth API client: calls (evidence: `frontend/src/app/AuthProvider.tsx`)
- Auth provider → Profile API client: calls (evidence: `frontend/src/app/AuthProvider.tsx`)
- Profile page → Profile API client: calls (evidence: `frontend/src/pages/ProfilePage.tsx`)
- Flask and Socket.IO app → Auth routes: registers (evidence: `backend/app/app.py`)
- Auth routes → Database access: queries (evidence: `backend/app/auth/routes.py`)
- Flask and Socket.IO app → Profile and friend routes: registers (evidence: `backend/app/app.py`)
- Flask and Socket.IO app → Social event handlers: registers (evidence: `backend/app/app.py`)
- Profile and friend routes → Social data store: reads and writes (evidence: `backend/app/social/routes.py`)
- Profile and friend routes → Social event handlers: broadcasts updates (evidence: `backend/app/social/routes.py`)
- Social event handlers → Social data store: reads and writes (evidence: `backend/app/social/handlers.py`)
- Chat page → Chat session hook: uses (evidence: `frontend/src/pages/ChatPage.tsx`)
- Chat session hook → Chat session state: uses (evidence: `frontend/src/chat/useChatSession.ts`)
- Chat session hook → Private chat rules: uses (evidence: `frontend/src/chat/useChatSession.ts`)
- Chat session state → Chat API client: calls (evidence: `frontend/src/app/chat-session.ts`)
- Private chat rules → Chat API client: calls (evidence: `frontend/src/chat/privateChat.ts`)
- Private chat rules → Friends API client: checks friendships (evidence: `frontend/src/chat/privateChat.ts`)
- Pong page → Game factory: creates game
- Game factory → Game interface: renders (evidence: `frontend/src/games/pong/createPongGame.tsx`)
- Game interface → Paddle input: uses (evidence: `frontend/src/games/pong/view/PongApp.tsx`)
- Paddle input → WebSocket transport: sends input
- Flask and Socket.IO app → Game event handlers: registers (evidence: `backend/app/app.py`)
- Flask and Socket.IO app → Matchmaking queue: configures (evidence: `backend/app/app.py`)
- Flask and Socket.IO app → Match simulation: creates (evidence: `backend/app/app.py`)
- Game event handlers → Matchmaking queue: dispatches queue (evidence: `backend/app/games/pong/handlers.py`)
- Matchmaking queue → Match simulation: creates matches (evidence: `backend/app/app.py`)
- Match simulation → Match state: uses state (evidence: `backend/app/games/pong/match.py`)
