WebTeam of 4
ft_transcendence
Real-time multiplayer 3D Pong platform
Architecture. Seven Docker services. Nginx terminates TLS and routes by path: pages go to Next.js, /api to the Django REST API, and /ws/ to Django Channels for WebSockets. PostgreSQL stores users, friendships, messages and games; Redis connects the sockets, caches live game state and feeds a Celery worker. The parts I built are marked in blue.
A full-stack social gaming platform built in a team of four: live 3D Pong between two browsers, friends and chat in real time, and secure sign-in. Next.js with Three.js on the front, Django with Channels on the back, all in Docker behind Nginx.
- Team of 4
- 6 WebSocket channels
- 3D with Three.js
Key features
- Online 1v1 matches run on the server: it moves the ball and keeps score, and both players see the same game.
- Six WebSocket channels for chat, unread counters, friends, invites and the match itself, broadcast through Redis.
- Sign-in with 42 OAuth or a password, JWT sessions and optional two-factor codes by email.
My part
- Remote play, shared with a teammate: I co-wrote the server-side match logic that keeps two players on different devices in sync, moving the ball and holding paddle positions in Redis.
- The real-time chat: the WebSocket consumer that delivers messages in each conversation, and the chat page with its friend list.
- A live unread-message counter pushed over its own channel, with messages marked as read when opened.
- Set up Celery and Redis: Redis as the Django cache and Celery broker, used to track who is online.
- The dashboard and the 1v1 game card on the front end.
How a match works
- A player invites a friend over a WebSocket; once accepted, both join the same game channel.
- Paddle positions are kept in Redis; the server moves the ball, checks hits and goals, and the first to 10 wins.
- The result is saved in both players' game history, and the winner's score and level go up for the global ranking.
- A local tournament mode lets several players enter aliases and play in turns on one machine.
Accounts and security
- Sign-in with the 42 intranet (OAuth 2.0) or a password, with JWT access and refresh tokens.
- Optional two-factor authentication: a 6-digit code sent by email, valid for 5 minutes.
- Password reset by email, blocking users, and an online status that switches to unavailable after a minute without activity.
Stack and deployment
- Next.js 14 and React, with the 3D table drawn by Three.js through React Three Fiber, and the interface in 5 languages.
- Django REST Framework for the API and Django Channels for WebSockets, with PostgreSQL and Redis.
- Seven Docker Compose services, including Nginx with TLS and a Celery worker and scheduler.
Built with
- Next.js
- React
- TypeScript
- Three.js
- Django
- Django Channels
- PostgreSQL
- Redis
- Celery
- WebSocket
- OAuth 2.0
- Docker
- Nginx