Skip to content

Thoughts on the technology stack #2

Description

@nodeg

AI feedback on the technology stack:

Recommended Technology Stack

Primary Recommendation: Node.js + TypeScript with PostgreSQL

Backend Framework: Node.js with NestJS or Fastify
Database: PostgreSQL 16+
Frontend: Vue 3 or React with TypeScript
Real-time: WebSockets (Socket.io or native WS)
Authentication: Passport.js with bcrypt/argon2

Why This Stack?

  1. Security improvements:
  • Modern ORM (Prisma/TypeORM) prevents SQL injection by design
  • Built-in parameterized queries and input validation
  • Bcrypt/Argon2 password hashing (vs. broken MD5)
  • CSRF tokens, helmet.js security headers out-of-box
  • TypeScript catches type-based vulnerabilities at compile time
  1. Game-specific benefits:
  • Real-time gameplay: WebSockets enable live attack notifications, ranking updates without polling
  • Concurrent actions: Node.js handles multiple simultaneous attacks/upgrades efficiently
  • Queue management: Bull/BullMQ for timed upgrades and scheduled attacks
  • Caching: Redis integration for leaderboards and active session data
  1. Database advantages (PostgreSQL vs MySQL):
  • Proper foreign key constraints (currently missing)
  • JSON columns for flexible game data (PC upgrades, attack logs)
  • Better transaction support for concurrent battles
  • Native full-text search for messaging/boards
  • Row-level security for multi-tenant server support
  1. Developer experience:
  • TypeScript prevents entire classes of bugs
  • Modern tooling (ESLint, Prettier, Vitest)
  • Active ecosystem and security patches
  • Docker deployment simplicity

Alternative Option: Python + FastAPI

If you prefer Python:

  • FastAPI with SQLAlchemy ORM
  • PostgreSQL database
  • Pydantic for data validation
  • Vue/React frontend
  • Redis for caching/queues

Benefits: Excellent type safety, async support, automatic API documentation, strong security libraries (passlib, python-jose)

Migration Strategy

Phase 1: Database migration

  • Export existing MySQL data
  • Redesign schema with proper relationships (foreign keys, indexes)
  • Migrate to PostgreSQL with data transformation scripts

Phase 2: API-first backend

  • Build REST/GraphQL API in NestJS/FastAPI
  • Reimplement game logic with proper validation
  • Add authentication with modern password hashing
  • Implement WebSocket handlers for real-time features

Phase 3: Modern frontend

  • Build SPA with Vue 3/React
  • Real-time updates for attacks, mail, rankings
  • Responsive design for mobile play
  • Progressive enhancement

Phase 4: Game features

  • Port battle mechanics with proper transaction handling
  • Implement upgrade queues with background workers
  • Add rate limiting and anti-cheat measures

Critical Security Fixes Required

Regardless of technology choice, you must address:

  1. ✅ Password hashing: MD5 → Bcrypt/Argon2 with salts
  2. ✅ SQL injection: Deprecated mysql_* → Parameterized queries/ORM
  3. ✅ Session management: Cryptographically secure tokens, proper timeout
  4. ✅ Input validation: Server-side validation for all user inputs
  5. ✅ CSRF protection: Tokens on all state-changing operations
  6. ✅ XSS prevention: Output encoding, Content Security Policy
  7. ✅ Database constraints: Foreign keys, transactions for game actions

Final Verdict

Go with Node.js + TypeScript + NestJS + PostgreSQL if you want:

  • Strong typing and modern JavaScript
  • Real-time game features
  • Large ecosystem and community support
  • Easy Docker deployment

This stack gives you the best balance of security, performance, developer experience, and suitability for a real-time multiplayer browser game. The current PHP 4/5 codebase has fundamental
security flaws that can't be patched—a full rewrite is the right call.

Activity

  1. mk-pmb commented on Jun 2, 2026

    @mk-pmb

    AI feedback on the technology stack:
    [summary: make it robust and secure]

    It's dead anyway. With today's data privacy regulations you can't afford to provide the meta gameplay opportunities from the good old times.

  2. eike1337-ctrl commented on Jul 27, 2026

    @eike1337-ctrl

    AI feedback on the technology stack:
    [summary: make it robust and secure]

    It's dead anyway. With today's data privacy regulations you can't afford to provide the meta gameplay opportunities from the good old times.

    You mean the Saving of the IP ? - the only thing is that you are not allowd to Say that this User is using double IP - the IP is okay für a couple of Days (
    Server-Logfiles: Dürfen kurzzeitig (meist 7 Tage) ohne Einwilligung nach Art. 6 Abs. 1 lit. f DSGVO (berechtigtes Interesse) für IT-Sicherheit und Fehlerbehebung gespeichert werden.
    Analyse & Tracking: Tools wie Google Analytics oder Marketing-Tracker erfordern eine aktive Einwilligung (Cookie-Banner) der Nutzer.
    Löschung: IP-Adressen müssen gelöscht oder anonymisiert werden, sobald der technische Zweck entfällt)

  3. mk-pmb commented on Jul 27, 2026

    @mk-pmb

    Obtaining IP information to then extende gameplay iRL would have been one possible variation of meta gameplay, but the good teams had way more. The core problem is, nowadays if a team would inform the admins about a security vulnerability to get equivalent permissions, and admins would grant that permission, they would be liable for any "abuse" of user data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions