# rubenteles/ft_transcendence architecture

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

- Interactive diagram: https://gitdiagram.com/rubenteles/ft_transcendence
- Repository: https://github.com/rubenteles/ft_transcendence
- Video tour (about a minute): https://gitdiagram.com/rubenteles/ft_transcendence/video

## Overview

ft_transcendence is a Vue/NestJS multiplayer social game: users authenticate, explore a virtual city, socialize, customize profiles, and enter Pong matches whose results feed progression and leaderboards. The frontend combines SPA pages with browser game and menu components; NestJS provides REST and socket-based services backed by Prisma. The README documents 42-platform login and the RPG, shop, bot, and leaderboard capabilities. Some gateway and frontend wiring was not sampled, so uncertain internal links are omitted; documented client/server connections are shown at the system boundary.

Main entry points: [`backend/src/prisma/prisma.service.ts`](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/prisma/prisma.service.ts) (PostgreSQL), [`backend/src/game/game.service.ts`](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/game/game.service.ts) (Matchmaking), [`frontend/src/pages`](https://github.com/rubenteles/ft_transcendence/tree/dev/frontend/src/pages) (App pages), [`backend/src/auth/auth.service.ts`](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/auth/auth.service.ts) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_spa["Vue SPA<br/>[App.vue]"]
  node_pages["App pages"]
  node_menus["Profiles and menus<br/>[YourProfile.ts]"]
  node_chatui["Chat interface"]
  node_cityui["City client"]
  node_pongui["Pong client"]
end

subgraph group_identity["Identity and social"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_oauth["42 OAuth<br/>[42.strategy.ts]"]
  node_users["Profiles and economy<br/>[user.service.ts]"]
  node_friendship["Friend relations"]
  node_chat["Channels and messages<br/>[chat.service.ts]"]
  node_chatgateway["Chat sockets<br/>[chat.gateway.ts]"]
  node_blocklist["Blocklist"]
end

subgraph group_play["City and gameplay"]
  node_lobby["City lobby<br/>[lobby.service.ts]"]
  node_map["City map<br/>[GameMap.ts]"]
  node_players["Live players<br/>[Player.ts]"]
  node_matchmaking["Matchmaking<br/>[game.service.ts]"]
  node_pong["Pong engine<br/>[GamePong.ts]"]
  node_gamegateway["Game sockets<br/>[game.gateway.ts]"]
end

subgraph group_persistence["Data layer"]
  node_database[("PostgreSQL<br/>[prisma.service.ts]")]
end

node_visitor(("Player"))

node_visitor -->|"uses"| node_spa
node_spa -->|"renders"| node_pages
node_visitor -->|"authenticates"| node_oauth
node_oauth -.->|"delegates"| node_auth
node_auth -->|"reads and writes"| node_database
node_auth -->|"joins global channel"| node_chat
node_pages -->|"REST login"| node_auth
node_pages -->|"REST profiles"| node_users
node_menus -->|"REST customization"| node_users
node_users -->|"reads and writes"| node_database
node_pages -->|"REST social"| node_friendship
node_friendship -->|"reads and writes"| node_database
node_chatui -->|"REST channels"| node_chat
node_chatui -->|"socket messaging"| node_chatgateway
node_chat -->|"reads and writes"| node_database
node_chat -.->|"coordinates"| node_blocklist
node_cityui -->|"socket exploration"| node_lobby
node_lobby -->|"uses"| node_map
node_lobby -->|"manages"| node_players
node_cityui -->|"requests matches"| node_matchmaking
node_matchmaking -->|"creates games"| node_pong
node_matchmaking -->|"uses"| node_players
node_matchmaking -->|"reads and writes"| node_database
node_pongui -->|"socket play"| node_gamegateway
node_pongui -.->|"selects skins"| node_menus
node_gamegateway -.->|"dispatches game events"| node_matchmaking
node_pong -.->|"records results"| node_database

click node_spa "https://github.com/rubenteles/ft_transcendence/blob/dev/frontend/src/App.vue"
click node_pages "https://github.com/rubenteles/ft_transcendence/tree/dev/frontend/src/pages"
click node_menus "https://github.com/rubenteles/ft_transcendence/blob/dev/frontend/src/game/Menu/YourProfile.ts"
click node_chatui "https://github.com/rubenteles/ft_transcendence/tree/dev/frontend/src/components/chat"
click node_cityui "https://github.com/rubenteles/ft_transcendence/tree/dev/frontend/src/game/lobby"
click node_pongui "https://github.com/rubenteles/ft_transcendence/tree/dev/frontend/src/game/ping_pong"
click node_auth "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/auth/auth.service.ts"
click node_oauth "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/auth/strategy/42.strategy.ts"
click node_users "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/user/user.service.ts"
click node_friendship "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/friendship/friendship.service.ts"
click node_chat "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/chat/chat.service.ts"
click node_chatgateway "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/chat/gateway/chat/chat.gateway.ts"
click node_blocklist "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/blocklist/blocklist.service.ts"
click node_lobby "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/lobby/lobby.service.ts"
click node_map "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/lobby/GameMap.ts"
click node_players "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/player/Player.ts"
click node_matchmaking "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/game/game.service.ts"
click node_pong "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/game/ping_pong/GamePong.ts"
click node_gamegateway "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/game/gateway/game.gateway.ts"
click node_database "https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/prisma/prisma.service.ts"

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_pages,node_menus,node_chatui,node_cityui,node_pongui toneBlue
class node_auth,node_oauth,node_users,node_friendship,node_chat,node_chatgateway,node_blocklist toneAmber
class node_lobby,node_map,node_players,node_matchmaking,node_pong,node_gamegateway toneMint
class node_database toneRose
class node_visitor toneIndigo
```

## Components

### Web client

- [Vue SPA](https://github.com/rubenteles/ft_transcendence/blob/dev/frontend/src/App.vue): `frontend/src/App.vue`
- [App pages](https://github.com/rubenteles/ft_transcendence/tree/dev/frontend/src/pages): `frontend/src/pages`
- [Profiles and menus](https://github.com/rubenteles/ft_transcendence/blob/dev/frontend/src/game/Menu/YourProfile.ts): `frontend/src/game/Menu/YourProfile.ts`
- [Chat interface](https://github.com/rubenteles/ft_transcendence/tree/dev/frontend/src/components/chat): `frontend/src/components/chat`
- [City client](https://github.com/rubenteles/ft_transcendence/tree/dev/frontend/src/game/lobby): `frontend/src/game/lobby`
- [Pong client](https://github.com/rubenteles/ft_transcendence/tree/dev/frontend/src/game/ping_pong): `frontend/src/game/ping_pong`

### Identity and social

- [Authentication](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/auth/auth.service.ts): `backend/src/auth/auth.service.ts`
- [42 OAuth](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/auth/strategy/42.strategy.ts): `backend/src/auth/strategy/42.strategy.ts`
- [Profiles and economy](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/user/user.service.ts): `backend/src/user/user.service.ts`
- [Friend relations](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/friendship/friendship.service.ts): `backend/src/friendship/friendship.service.ts`
- [Channels and messages](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/chat/chat.service.ts): `backend/src/chat/chat.service.ts`
- [Chat sockets](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/chat/gateway/chat/chat.gateway.ts): `backend/src/chat/gateway/chat/chat.gateway.ts`
- [Blocklist](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/blocklist/blocklist.service.ts): `backend/src/blocklist/blocklist.service.ts`

### City and gameplay

- [City lobby](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/lobby/lobby.service.ts): `backend/src/lobby/lobby.service.ts`
- [City map](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/lobby/GameMap.ts): `backend/src/lobby/GameMap.ts`
- [Live players](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/player/Player.ts): `backend/src/player/Player.ts`
- [Matchmaking](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/game/game.service.ts): `backend/src/game/game.service.ts`
- [Pong engine](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/game/ping_pong/GamePong.ts): `backend/src/game/ping_pong/GamePong.ts`
- [Game sockets](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/game/gateway/game.gateway.ts): `backend/src/game/gateway/game.gateway.ts`

### Data layer

- [PostgreSQL](https://github.com/rubenteles/ft_transcendence/blob/dev/backend/src/prisma/prisma.service.ts): `backend/src/prisma/prisma.service.ts`

### Other components

- **Player**

## Connections

- Player → Vue SPA: uses
- Vue SPA → App pages: renders (evidence: `frontend/src/App.vue`)
- Player → 42 OAuth: authenticates
- 42 OAuth → Authentication: delegates
- Authentication → PostgreSQL: reads and writes (evidence: `backend/src/auth/auth.service.ts`)
- Authentication → Channels and messages: joins global channel (evidence: `backend/src/auth/auth.service.ts`)
- App pages → Authentication: REST login
- App pages → Profiles and economy: REST profiles
- Profiles and menus → Profiles and economy: REST customization
- Profiles and economy → PostgreSQL: reads and writes (evidence: `backend/src/user/user.service.ts`)
- App pages → Friend relations: REST social
- Friend relations → PostgreSQL: reads and writes (evidence: `backend/src/friendship/friendship.service.ts`)
- Chat interface → Channels and messages: REST channels
- Chat interface → Chat sockets: socket messaging
- Channels and messages → PostgreSQL: reads and writes (evidence: `backend/src/chat/chat.service.ts`)
- Channels and messages → Blocklist: coordinates
- City client → City lobby: socket exploration
- City lobby → City map: uses (evidence: `backend/src/lobby/lobby.service.ts`)
- City lobby → Live players: manages (evidence: `backend/src/lobby/lobby.service.ts`)
- City client → Matchmaking: requests matches
- Matchmaking → Pong engine: creates games (evidence: `backend/src/game/game.service.ts`)
- Matchmaking → Live players: uses (evidence: `backend/src/game/game.service.ts`)
- Matchmaking → PostgreSQL: reads and writes (evidence: `backend/src/game/game.service.ts`)
- Pong client → Game sockets: socket play
- Pong client → Profiles and menus: selects skins (evidence: `frontend/src/game/Menu/YourProfile.ts`)
- Game sockets → Matchmaking: dispatches game events
- Pong engine → PostgreSQL: records results
