Project

Dungeon Dice Duel

A full-stack browser game featuring dice-based combat, persistent game runs, and session-based authentication, built with TypeScript, Express, and SQLite.

TypeScriptNode.jsExpressSQLitebetter-sqlite3Vitest
Dungeon Dice Duel project screenshot
01Overview

What I built

Dungeon Dice Duel is a browser-based game backed by a TypeScript and Express server. Players can authenticate, manage game runs, and engage in turn-based encounters governed by dedicated battle logic. The backend uses SQLite to persist application data and separates authentication, game services, repositories, and domain logic into focused modules. The project also addresses state consistency across game runs and battles, including rules for active battles, battle outcomes, and run resets. Automated unit and integration tests help verify authentication flows, persistence, and game lifecycle behavior.

02Features

Gameplay and application features

01

User registration and login

02

Session-based authentication and logout

03

Persistent game runs

04

Dice-based combat and damage calculation

05

Enemy encounters and battle outcomes

06

Game-run reset and abandonment handling

03Screenshots

See it in action

Dungeon Dice Duel hero selection screen displaying the available heroes.
Hero selection lets players choose their character before entering a dungeon run.
Dungeon Dice Duel active game run showing the selected hero and run progress.
The game-run screen brings together the selected hero, current progress, and available actions.
Dungeon Dice Duel battle screen showing combatants and battle controls.
The battle interface presents the combatants and the controls used to resolve encounters.
Dungeon Dice Duel battle screen displaying a victory outcome.
Battle outcomes communicate the result of an encounter and its place in the run.
Dungeon Dice Duel player statistics screen displaying battle records.
Player statistics summarize battle results across completed encounters.
Dungeon Dice Duel gameplay interface displayed in a narrow mobile layout.
The mobile layout adapts the gameplay interface to a narrow screen.
04Technical

How it was built

Frontend

React 19 and TypeScript, built with Vite and routed with React Router 7. Feature-specific components, loaders, and actions handle API requests close to the functionality that uses them.

Backend

Node.js, Express 5, and TypeScript, organized into routes, controllers, middleware, services, repositories, and domain logic.

Database

SQLite using better-sqlite3 for persistent application data and a persistent session store.

Tools & Other

Session-based authentication, email verification, account recovery, player statistics, and Vitest unit and integration testing with Supertest.

05Challenges

Challenges & solutions

01

Maintaining consistent state across game runs and individual battles, including preventing multiple simultaneous active battles within a run.

02

Enforcing lifecycle rules so that resetting a run during an active battle abandons that battle instead of leaving conflicting state behind.

03

Separating authentication, persistence, and battle logic into focused modules to make the backend easier to maintain and test.

04

Managing authentication and session transitions across registration, login, authenticated requests, and logout.

05

Testing game rules, persistence behavior, authentication flows, and interactions between backend components through unit and integration tests.