Skip to content

About

A high-stakes, real-time multiplayer logic engine reimagining the classic Mastermind (Cows & Bulls) mechanic with a modern, tactical military-grade interface. Built with Next.js 15, FastAPI, Socket.io, and Redis.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

CODEBREAKER

Precision Logic. Tactical Superiority.

Primary Interface Preview

Next.js FastAPI Socket.io Production

🎯 Executive Overview

Codebreaker is a tactical logic-warfare platform engineered for high-performance, real-time competition. By reimagining the classic 'Cows & Bulls' (Mastermind) mechanic through a "military-intelligence" lens, it transforms a simple puzzle into a high-pressure strategic operation.

The engine utilizes an asynchronous FastAPI backend and a low-latency Socket.IO bridge to synchronize global multiplayer states with millisecond precision. Every guess is more than a move—it's a calculated maneuver executed within a high-fidelity, responsive UI designed for the modern logical operative. Whether engaging in classified single-player missions or escalating to global multiplayer operations, Codebreaker delivers a premium, immersive experience where every byte counts.


🛠️ Technical Infrastructure

Layer Technologies Role
Frontend Next.js 15 (React 19, TypeScript) Core application logic and responsive UI
Styling Tailwind CSS 4, Framer Motion Design system and micro-animations
Backend FastAPI, Python 3.11+ Asynchronous service architecture
Real-time Socket.IO, WebSockets Bi-directional game state synchronization
State/Storage Redis, Zustand, TanStack Query Persistence and local state management
Security Slowapi, Pydantic v2 Rate limiting and robust data validation

🚀 Key Features

🎮

Classified Missions

  • Progressive single-player campaign with adaptive difficulty.
  • Dynamic code lengths and limited survival attempts.
  • Strategic level constraints designed to test analytical edge.
⚔️

Live Operations

  • Real-time head-to-head combat via global matchmaking.
  • Low-latency Socket.IO bridge for instantaneous synchronization.
  • Live opponent tracking to monitor competitive maneuvers.
📊

Tactical Analytics

  • Instantaneous hit/miss calculations and visual guidance.
  • Persistent mission history via an interactive grid system.
  • Real-time clue distribution for rapid strategic pivots.
✨

Premium UI Engine

  • High-fidelity "Commando" theme with dark-mode optimization.
  • Fluid Framer Motion transitions and micro-animations.
  • Immersive tactical interface built for precision interaction.

🖼️ System Gallery

💻 Desktop Operations

System Initialization

Secure authentication and logic system decryption protocol.

Intelligence Briefing

Comprehensive operational guide for tactical logic specialists.

Global Operative Rankings

Top-tier operative performance metrics and strategic superiority.

Tactical Communications

Real-time head-to-head communication with mission-critical status updates.

Live Operations Theater

Regional matchmaking for active high-stakes logic engagements.

Classified Mission Ops

Single-player campaign operations with adaptive logical constraints.

Operational Success

Verification of objective completion and logic system mastery.

Critical System Failure

Post-operational review of compromised logic states.

📱 Mobile Reconnaissance

Mobile Tactical Interface

High-fidelity field operations for logic agents on mobile devices.

Overdrive Protocol Selection

Selection of high-intensity mission profiles in maximum stress mode.

Operational Degradation

Real-time alert for compromised multiplayer mission parameters.

Strategic Withdrawal

Formal termination of an active field operation.


⚙️ Deployment Protocol

1. Intelligence Service (Backend)

cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python main.py

2. Field Interface (Frontend)

cd frontend
pnpm install
pnpm dev

3. Requirements

  • Redis: Mandatory for multiplayer session handling.
  • Node.js Runtime: Version 20+ required for the field interface.
  • Python Engine: Version 3.11+ required for intelligence services.

Local account testing without Neon

The frontend can be tested without a running backend or Neon database:

cd frontend
pnpm install
pnpm dev -- -p 13000

Create an account from the entry page. On localhost, Codebreaker uses the browser-local account path for testing and assigns a unique four-digit discriminator, shown as CALLSIGN#1234; the full handle is used for login when display names overlap and for friend requests. Local sessions, local friend requests, local notifications, offline missions, and the local leaderboard remain until the site's storage is cleared. NEXT_PUBLIC_ENABLE_LOCAL_FALLBACK=false can disable it locally. Hosted builds disable this browser-local account/social fallback; hosted friend requests require an online account service. Multiplayer still requires the backend and its realtime service.

To reset local accounts, use the browser's site-data controls for localhost:13000, or run this in DevTools:

localStorage.removeItem("codebreaker_local_accounts_v1");
localStorage.removeItem("codebreaker_local_session_v1");
localStorage.removeItem("codebreaker_local_friendships_v1");
localStorage.removeItem("codebreaker_local_notifications_v1");

Render storage behavior

Neon is the production source of truth when DATABASE_URL and SESSION_SECRET are configured. The optional server fallback file stores only account records (id, callsign, scrypt password hash, creation time) and hashed session records (token_hash, user id, expiry); it does not store friends, notifications, push subscriptions, or game data.

For the free-tier-compatible setup, do not attach a Render persistent disk. Leave FALLBACK_ACCOUNT_STORE unset or empty and keep Neon configured. Neon-backed account, friendship, notification, and push data then survives Render restarts. During a Neon outage, server-side fallback data is memory-only and can disappear if the instance restarts, while browser-local accounts remain on the user's device.

If a server-side outage fallback must survive restarts, attach a Render persistent disk mounted at /var/data and set:

FALLBACK_ACCOUNT_STORE=/var/data/accounts.json

Without that disk, only data created in the temporary server fallback during an outage can be lost; data already stored in Neon is not lost.


© 2026 Kalash Pratap Gaur. All Rights Reserved.
Released under the MIT License.

About

A high-stakes, real-time multiplayer logic engine reimagining the classic Mastermind (Cows & Bulls) mechanic with a modern, tactical military-grade interface. Built with Next.js 15, FastAPI, Socket.io, and Redis.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages