From University Prototype to a Full-Stack Escape Room
How I turned a university project with Trafikverket into a secure, tested and publicly deployed full-stack escape room.
Adrian

Try the current version or explore its source code:
The demo uses free hosting, so the first request after a period of inactivity may take a little longer while the service starts. Use a nickname rather than your full name when playing.
In spring 2026, my classmates and I collaborated with Trafikverket on a digital escape room for students. The experience was intended for fairs and other events, where short challenges could introduce a younger audience to Trafikverket's work and responsibilities.
The university project gave us the concept, the first games and direct feedback through regular meetings with Trafikverket representatives. After the course, I continued developing the upper-secondary-school experience independently.
What began as a university prototype eventually became a complete full-stack application with seven game mechanics, a protected administration interface, server-controlled progression, persistent results, automated tests and a public demo.
This article covers both parts of that journey, the original collaboration and the engineering decisions behind my later redevelopment.
My role in the original project
The university team divided the experience into two tracks. One for higher-education students and another for upper-secondary-school students.
My development work focused on the upper-secondary-school experience, including its games, administration features and backend integration. Other team members contributed through development, design, planning, research, presentations and communication with the client.
We used Trello to coordinate tasks, Miro to plan game flows, GitHub for source control and regular online meetings to review progress. Trafikverket's feedback influenced both the content and the way we presented their work to students.
At the end of the course, we demonstrated the project with Trafikverket present. The prototype worked, but I could also see several areas where the architecture, usability and reliability could be improved.
Continuing the project independently
After the course, I separated the upper-secondary-school experience from the original team repository and began rebuilding it as an independently maintained portfolio project.
The goal was no longer only to make the prototype work during a presentation. I wanted to understand what would be required to turn it into a maintainable application that could reliably run on an event computer or as a public demonstration.
That meant revisiting almost every layer:
- restructuring the React application,
- moving important game rules to the server,
- redesigning the administration experience,
- replacing hard-coded content with database driven configuration,
- improving mobile and keyboard usability,
- adding authentication and production security,
- introducing automated tests,
- and creating reproducible Docker deployments.

The player experience
A player enters a nickname and progresses through the games that an administrator has activated. The application currently contains seven different game mechanics:
- Uppdraget — configurable multiple choice questions, including image based traffic sign questions.
- Risk & Safety — scenarios are matched with the locations where each risk must be handled.
- Digital Safety — a series of true or false statements.
- Pixel Hunt — an image begins heavily pixelated and can be sharpened in exchange for a time penalty.
- Sort Correctly — cards are placed into the correct Trafikverket areas.
- Build the Word — word parts are reordered to form a correct compound word.
- Signalordet — a railway themed word challenge designed as a safer alternative to traditional Hangman.
The seven games share one session rather than behaving as isolated mini games. A player starts with five lives for the complete journey. Incorrect answers consume a life, while correct answers award between 100 and 1,000 points depending on how quickly the challenge was solved.
When an answer is incorrect, the timer pauses until the player actively chooses to try again. If a challenge timer reaches zero, all remaining lives are lost and the session ends.
The leaderboard ranks completed and unsuccessful attempts by score, using total completion time as a tiebreaker.
Administration as part of the product
The administration interface is not a separate collection of developer tools. It is designed for an event operator who should be able to prepare the experience without editing source code.
After logging in, an administrator can:
- activate or deactivate games and supported questions,
- edit prompts, answers, instructions and success messages,
- configure the time limit for every game,
- reorder questions and game specific content,
- manage risk scenarios and risk zones visually,
- organise sorting cards through drag and drop interfaces,
- configure compound word parts and Signalordet answers,
- upload, replace, or remove supported images,
- review changes through an audit history,
- and inspect or remove leaderboard results.
Changes are saved automatically. This removes the need for a separate save action and makes the interface feel closer to a content management system than a traditional settings form.
The public portfolio demo disables new image uploads because its free hosting does not provide durable local file storage. Bundled images remain playable and the local Docker version retains the complete upload workflow.
Server owned game rules
One of the most important architectural changes was moving authority away from the browser.
The frontend displays the current state and sends the player's intent, but the ASP.NET Core backend owns:
- the active session,
- challenge order,
- correct answers,
- remaining lives,
- score calculations,
- time limits,
- penalties,
- progression,
- and the final result.
Correct answers are never included in the public challenge response. The server validates each submitted answer and returns only the state the player is allowed to see.
This prevents a refreshed browser, modified client timer, or manually constructed request from becoming the source of truth.
Calculating score from the authoritative timer
Each completed challenge awards a score based on its remaining time. The result is calculated on the server and rounded to a predictable ten-point interval.
var elapsed = SessionTimeCalculator.CalculateChallengeElapsed(
session,
now,
includeCurrentPenalty: true);
var timeLimit = SessionTimeCalculator.GetTimeLimitSeconds(challenge);
var remainingRatio = Math.Clamp(
1d - elapsed.TotalSeconds / timeLimit,
0d,
1d);
var rawScore = MinimumChallengeScore +
(MaximumChallengeScore - MinimumChallengeScore) * remainingRatio;
var scoreAwarded = Math.Clamp(
(int)(Math.Round(
rawScore / 10d,
MidpointRounding.AwayFromZero) * 10),
MinimumChallengeScore,
MaximumChallengeScore);
The final elapsed time is also calculated on the server. It subtracts intentional pauses and adds penalties accumulated during the session.
public static long CalculateElapsedMilliseconds(
GameSession session,
DateTimeOffset now)
{
var end = session.CompletedAtUtc ?? now;
var pausedMilliseconds = session.TotalPausedMilliseconds;
if (session.PausedAtUtc is { } pausedAt)
{
pausedMilliseconds += Math.Max(
0,
(long)(end - pausedAt).TotalMilliseconds);
}
var totalMilliseconds =
(long)(end - session.StartedAtUtc).TotalMilliseconds;
return Math.Max(
0,
totalMilliseconds
- pausedMilliseconds
+ session.TotalPenaltyMilliseconds);
}
This keeps the registered result independent of the countdown animation shown in the browser.
Making seven game types manageable
The games share progression and session state, but their data structures are different. A quiz needs answer options, Pixel Hunt needs an image and reveal state and the sorting game needs cards and categories.
The frontend represents these differences with a TypeScript discriminated union. Once the game type is known, TypeScript also knows which data is available.
export type ChallengeByType = {
Quiz: ChallengeBase<"Quiz", ChoiceChallengeProgress>;
Matching: ChallengeBase<"Matching", ChallengeProgress> & {
matching: MatchingPayload;
};
PixelHunt: ChallengeBase<"PixelHunt", PixelHuntChallengeProgress>;
Sorting: ChallengeBase<"Sorting", ChallengeProgress> & {
sorting: SortingPayload;
};
WordAssembly: ChallengeBase<"WordAssembly", ChallengeProgress> & {
wordAssembly: WordAssemblyPayload;
};
Hangman: ChallengeBase<"Hangman", ChallengeProgress> & {
hangman: HangmanState;
};
};
export type Challenge = ChallengeByType[keyof ChallengeByType];
This structure prevents a component from accidentally reading sorting data from a quiz or image state from a word challenge. It also makes each game component more independent and easier to test.
The administration interface uses a registry based structure for the same reason. The main admin page does not need to contain the internal form logic for every game type.
Architecture and deployment
The application is built as a modular monolith. The React application and API are packaged into one deployable ASP.NET Core service, while PostgreSQL stores game configuration, sessions, results, audit records and data-protection keys.
Player or administrator
|
HTTPS / Render
|
ASP.NET Core application
├── React application
├── Session and game engine
├── Administration API
└── Authentication
|
Neon PostgreSQL
The public version runs as one Render web service with a Neon PostgreSQL database. The browser communicates with the application through one HTTPS origin, the API is not exposed as a separate public service.
For local events, Docker Compose starts the application and PostgreSQL with persistent volumes. The repository also contains a separate production configuration for deployment behind Caddy, where only the HTTPS web server is publicly exposed.

Security and privacy
Publishing the project required more than moving the local application to a hosting provider.
The production configuration includes:
- HTTPS and secure authentication cookies,
- anti-forgery protection for administrative changes,
- rate limiting for login and session creation,
- Content Security Policy and other security headers,
- host and reverse proxy validation,
- persistent authentication keys,
- server-side answer validation,
- and environment based secret configuration.
No production passwords or database credentials are stored in the repository.
Players are also encouraged to use nicknames instead of full names. The public leaderboard displays the nickname, score, completion status and elapsed time. Demo sessions and their related answers are automatically removed after 30 days by default.
Demo results and event results are labelled separately so they can be reviewed and cleared independently.
Testing the complete experience
With seven games, administration tools, timing, scoring and session progression, manual testing alone became too unreliable.
The project now contains several layers of automated verification:
- unit tests for isolated calculations and utilities,
- React component tests for game behaviour,
- API integration tests for sessions and administration,
- Playwright tests for player flows and responsive layouts,
- and a complete full-stack journey using a temporary Docker environment and a real PostgreSQL database.
The full-stack test logs in as an administrator, edits a question, reloads the page to verify persistence, starts a session, completes all seven games, checks the leaderboard result and restores the changed data even if the test fails.
GitHub Actions runs the automated checks for repository changes. Before a public release, I also use a manual rehearsal checklist covering real mobile devices, keyboard navigation, large event screens, reduced motion and interrupted network connections.
What I learned
The original project taught me how important communication is when several people are building connected parts of the same product. Regular client feedback helped us make the experience more relevant, but coordinating two development tracks also showed the cost of unclear boundaries and undocumented decisions.
The independent redevelopment taught me a different lesson: making an application work is only the beginning.
A project becomes much more demanding when it must also be configurable, responsive, secure, recoverable, testable, deployable and understandable to someone who did not write the code.
Some of my most valuable improvements were not visible new features. They were moving business rules out of large components, separating game specific logic, introducing strict TypeScript models, making the server authoritative, testing the complete journey and documenting how the system should be operated.
If I started the university project again, I would establish shared contracts between the frontend and backend earlier, document ownership more clearly and introduce automated tests before the different game experiences were combined.
Current status
The independently maintained upper-secondary-school experience is now publicly available as a portfolio demonstration.
It is not presented as an official Trafikverket service and I am not claiming that the current version is actively used by Trafikverket. It is a continuation of the work I contributed during the university collaboration and a demonstration of how I approached redesigning, testing, securing and deploying the concept as a complete full-stack application.