feat: implement The Last of Guss — fullstack clicker game with race-condition-safe tap processing#1
Open
Alimjanov-Ibragim wants to merge 4 commits into
Open
Conversation
…ssing - Fix contract types: computed RoundStatus, proper response shapes, roundUuid field - Fix auth: add role mapping (admin/nikita/user), validateOrCreate flow - Fix games: transaction + SELECT FOR UPDATE for tap processing, computed round status - Fix Nikita rule: tap accepted but counter not incremented - Fix client: remove debug text, match mockups, proper countdown and score display - Remove dead code, unused imports, strict TypeScript compliance - Translate all comments to English
- Add docker-compose.yml for PostgreSQL 16 on port 6543 - Add server/.env.example as environment template - Add root .gitignore (node_modules, dist, .env)
- Complete rewrite: tech stack, architecture decisions, quick start guide - Document all environment variables with defaults - Add test credentials table (admin, player, nikita roles) - List API endpoints with auth requirements
Restore original assignment text at the top of README. Add detailed answers to all four questions based on real project experience.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Full implementation of the clicker game assignment. The existing skeleton had
architectural gaps and bugs that were fixed alongside the feature work.
What was implemented
Shared contract (
contract/)computeRoundStatus(start, end, now)— single source of truth forround status, shared between server and client. Status is never stored in DB,
always derived from timestamps
computeScoreFromTaps(taps)— score formula encapsulated in one place:1 tap = 1 point, every 11th tap = 10 points
Backend (
server/)validateOrCreateflow — registers new users on first login,validates existing ones via bcrypt. Role assigned by username at registration
(
admin→ admin,Никита→ nikita, others → user)AuthGuard('jwt')applied at class level onGamesControllerREAD_COMMITTEDtransaction withSELECT FOR UPDATEon the score row — prevents lost updates underconcurrent requests from the same user
tapscounter is not incremented,so score stays 0
start_datetime/end_datetimeon everyread — no background jobs, no status desync
totalScoreandbestPlayercomputed from all scoreson demand when round is finished
Frontend (
client/)cooldown countdown, active tapping, finished results
guss_ready,guss_tapped,guss_stopbased on round state and tap animation
Infrastructure
docker-compose.ymlfor PostgreSQL 16server/.env.examplewith all required variables documentedKey design decisions
How to run