# aarison560/ft_transcendence architecture

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

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

## Overview

Tic-Tac-Toe Online is a browser-based multiplayer game and social platform. Players use the React SPA to authenticate, connect with friends, find or start matches, and play through a real-time game interface; profiles, statistics, leaderboards, and gamification surface progress. The Express backend also provides messaging, user administration, and a documented API with API-key support. The tree and README establish these product areas, while sampled controllers and services confirm selected call paths; wiring among unsampled modules is left implicit.

Main entry points: [`srcs/requirements/backend/tools/express/src/app.js`](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/app.js) (Express application), [`srcs/requirements/backend/tools/express/src/core/realtimeHub.js`](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/core/realtimeHub.js) (Realtime hub), [`srcs/requirements/backend/tools/express/src/modules/auth/authService.js`](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/modules/auth/authService.js) (Authentication), [`srcs/requirements/backend/tools/express/src/modules/OAuth/oauthService.js`](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/modules/OAuth/oauthService.js) (OAuth sign-in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_spa["React application<br/>[App.tsx]"]
  node_gameui["Game interface<br/>[GameView.tsx]"]
  node_clientgame["Game socket client<br/>[gameSocket.ts]"]
  node_clientapi["API client<br/>[api.ts]"]
end

subgraph group_identity["Identity and users"]
  node_auth["Authentication<br/>[authService.js]"]
  node_oauth["OAuth sign-in<br/>[oauthService.js]"]
  node_users["User profiles"]
  node_admin["User administration"]
end

subgraph group_play["Play and social"]
  node_friends["Friend requests"]
  node_messaging["Direct messaging"]
  node_gameplay["Game services"]
  node_status["Online presence"]
end

subgraph group_progress["Progress and API"]
  node_stats["Game statistics"]
  node_leaderboard["Leaderboards"]
  node_gamification["Gamification"]
  node_publicapi["Public API keys"]
end

subgraph group_platform["Backend platform"]
  node_realtime["Realtime hub<br/>[realtimeHub.js]"]
  node_express["Express application<br/>[app.js]"]
  node_database[("Prisma database<br/>[prisma.js]")]
  node_redis[("Redis services")]
end

node_player(("Player"))

node_player -->|"uses"| node_spa
node_spa -->|"calls"| node_clientapi
node_clientapi -->|"sends requests"| node_express
node_express -->|"dispatches"| node_auth
node_express -->|"dispatches"| node_oauth
node_express -->|"dispatches"| node_users
node_express -->|"dispatches"| node_friends
node_express -->|"dispatches"| node_messaging
node_express -->|"dispatches"| node_gameplay
node_express -->|"dispatches"| node_stats
node_express -->|"dispatches"| node_leaderboard
node_express -->|"dispatches"| node_gamification
node_express -->|"dispatches"| node_publicapi
node_express -->|"dispatches"| node_admin
node_gameui -->|"uses"| node_clientgame
node_clientgame -->|"exchanges events"| node_gameplay
node_gameplay -->|"dispatches events"| node_realtime
node_friends -->|"emits events"| node_realtime
node_status -->|"emits events"| node_realtime
node_auth -->|"reads and writes"| node_database
node_oauth -->|"reads and writes"| node_database
node_auth -->|"requests snapshot"| node_leaderboard
node_oauth -->|"requests snapshot"| node_leaderboard
node_oauth -->|"broadcasts update"| node_realtime
node_auth -->|"broadcasts update"| node_realtime
node_gameplay -->|"uses"| node_redis

click node_spa "https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/frontend/tools/react/src/App.tsx"
click node_gameui "https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/frontend/tools/react/src/gameplay/GameView.tsx"
click node_clientgame "https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/frontend/tools/react/src/gameplay/gameSocket.ts"
click node_clientapi "https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/frontend/tools/react/src/services/api.ts"
click node_auth "https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/modules/auth/authService.js"
click node_oauth "https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/modules/OAuth/oauthService.js"
click node_users "https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/user"
click node_admin "https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/admin"
click node_friends "https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/friend"
click node_messaging "https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/message"
click node_gameplay "https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/games"
click node_realtime "https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/core/realtimeHub.js"
click node_status "https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/userStatus"
click node_stats "https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/userStats"
click node_leaderboard "https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/leaderboard"
click node_gamification "https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/gamification"
click node_publicapi "https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/apiKey"
click node_express "https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/app.js"
click node_database "https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/infra/prisma.js"
click node_redis "https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/infra/redisClientConfig.js"

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_gameui,node_clientgame,node_clientapi toneBlue
class node_auth,node_oauth,node_users,node_admin toneAmber
class node_friends,node_messaging,node_gameplay,node_status toneMint
class node_stats,node_leaderboard,node_gamification,node_publicapi toneRose
class node_realtime,node_express,node_database,node_redis,node_player toneIndigo
```

## Components

### Web client

- [React application](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/frontend/tools/react/src/App.tsx): `srcs/requirements/frontend/tools/react/src/App.tsx`
- [Game interface](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/frontend/tools/react/src/gameplay/GameView.tsx): `srcs/requirements/frontend/tools/react/src/gameplay/GameView.tsx`
- [Game socket client](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/frontend/tools/react/src/gameplay/gameSocket.ts): `srcs/requirements/frontend/tools/react/src/gameplay/gameSocket.ts`
- [API client](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/frontend/tools/react/src/services/api.ts): `srcs/requirements/frontend/tools/react/src/services/api.ts`

### Identity and users

- [Authentication](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/modules/auth/authService.js): `srcs/requirements/backend/tools/express/src/modules/auth/authService.js`
- [OAuth sign-in](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/modules/OAuth/oauthService.js): `srcs/requirements/backend/tools/express/src/modules/OAuth/oauthService.js`
- [User profiles](https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/user): `srcs/requirements/backend/tools/express/src/modules/user`
- [User administration](https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/admin): `srcs/requirements/backend/tools/express/src/modules/admin`

### Play and social

- [Friend requests](https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/friend): `srcs/requirements/backend/tools/express/src/modules/friend`
- [Direct messaging](https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/message): `srcs/requirements/backend/tools/express/src/modules/message`
- [Game services](https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/games): `srcs/requirements/backend/tools/express/src/modules/games`
- [Online presence](https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/userStatus): `srcs/requirements/backend/tools/express/src/modules/userStatus`

### Progress and API

- [Game statistics](https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/userStats): `srcs/requirements/backend/tools/express/src/modules/userStats`
- [Leaderboards](https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/leaderboard): `srcs/requirements/backend/tools/express/src/modules/leaderboard`
- [Gamification](https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/gamification): `srcs/requirements/backend/tools/express/src/modules/gamification`
- [Public API keys](https://github.com/aarison560/ft_transcendence/tree/main/srcs/requirements/backend/tools/express/src/modules/apiKey): `srcs/requirements/backend/tools/express/src/modules/apiKey`

### Backend platform

- [Realtime hub](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/core/realtimeHub.js): `srcs/requirements/backend/tools/express/src/core/realtimeHub.js`
- [Express application](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/app.js): `srcs/requirements/backend/tools/express/src/app.js`
- [Prisma database](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/infra/prisma.js): `srcs/requirements/backend/tools/express/src/infra/prisma.js`
- [Redis services](https://github.com/aarison560/ft_transcendence/blob/main/srcs/requirements/backend/tools/express/src/infra/redisClientConfig.js): `srcs/requirements/backend/tools/express/src/infra/redisClientConfig.js`

### Other components

- **Player**

## Connections

- Player → React application: uses
- React application → API client: calls
- API client → Express application: sends requests
- Express application → Authentication: dispatches
- Express application → OAuth sign-in: dispatches
- Express application → User profiles: dispatches
- Express application → Friend requests: dispatches
- Express application → Direct messaging: dispatches
- Express application → Game services: dispatches
- Express application → Game statistics: dispatches
- Express application → Leaderboards: dispatches
- Express application → Gamification: dispatches
- Express application → Public API keys: dispatches
- Express application → User administration: dispatches
- Game interface → Game socket client: uses
- Game socket client → Game services: exchanges events
- Game services → Realtime hub: dispatches events
- Friend requests → Realtime hub: emits events
- Online presence → Realtime hub: emits events
- Authentication → Prisma database: reads and writes
- OAuth sign-in → Prisma database: reads and writes
- Authentication → Leaderboards: requests snapshot
- OAuth sign-in → Leaderboards: requests snapshot
- OAuth sign-in → Realtime hub: broadcasts update
- Authentication → Realtime hub: broadcasts update
- Game services → Redis services: uses
