Haraj-backend/hex-monscape
44.7
Weak · 8 November 2026
2.3k
lines of production code
Go
with JavaScript
7
measurements over time
What this system is
Hex Monscape is a serverless online game application that manages turn-based monster battles through a REST API and a Vue 3 web client. The system supports persistent game state storage via configurable backends, including MySQL and DynamoDB, with local development environments provided for both. Core capabilities include game session management, partner selection, and battle logic execution, all exposed through a structured HTTP interface.
How it got here
2022 — Core game logic and multi-backend storage implementation
12 changes.
This period established the foundational domain entities for turn-based battles and game state management, implementing core logic for monster attributes and scenario progression. The backend was expanded to support persistent storage via both MySQL and DynamoDB adapters, alongside the introduction of a REST API for game and battle interaction. Infrastructure was also set up for serverless deployment on AWS Lambda, enabling a live demo of the application.
2023 — Initial client and core service implementation
12 changes.
This period focused on establishing the Hex Monscape web client and implementing core backend services for game session and battle management. It also introduced standardized local deployment configurations for both DynamoDB and MySQL storage backends, alongside the initial storage adapters and test utilities required to support these features.
Features
Add DynamoDB storage adapter for game data
The game storage layer now persists game entities to Amazon DynamoDB. This change introduces a new storage implementation that maps game data (including player name, partner monster, battle wins, and scenario) to DynamoDB items, providing methods to save and retrieve game states. A corresponding test suite validates the save and get operations using a local DynamoDB instance.
internal/driven/storage/dynamodb/gamestrg · high confidence
Add DynamoDB storage implementation for battle data
This change introduces a new DynamoDB-backed storage adapter for battle entities within the application. It includes the data model mapping (model.go) to serialize battle states, monsters, and damage records to and from DynamoDB items, the storage implementation (storage.go) providing GetBattle and SaveBattle methods, and corresponding unit tests (storage\_test.go) that verify save and retrieval operations against a local DynamoDB instance.
internal/driven/storage/dynamodb/battlestrg · high confidence
Add MySQL game storage implementation
Introduces a new MySQL-backed storage adapter for game data, providing methods to save and retrieve game records along with their associated partner (monster) details. The implementation uses the sqlx library for database interactions and includes integration tests to verify save and retrieval operations.
internal/driven/storage/mysql/gamestrg · high confidence
Add MySQL storage for battle state persistence
The MySQL-driven storage layer for battle data is now implemented in the \battlestrg\ package, providing \GetBattle\ and \SaveBattle\ capabilities. The storage uses \sqlx\ to interact with the \battle\ table, supporting both retrieval by game ID and upsert operations via \REPLACE INTO\ to persist partner and enemy monster details. This change introduces the concrete database adapter for battle entities, replacing previous in-memory or mock implementations with a persistent MySQL backend.
internal/driven/storage/mysql/battlestrg · high confidence
Add in-memory monster storage adapter
Introduces a new in-memory storage implementation for monster entities located in the monstrg package. This adapter loads monster data from a JSON configuration, separating monsters into partner and enemy collections based on the is\_partnerable flag, and provides methods to retrieve available partners, specific partners by ID, and possible enemies.
internal/driven/storage/memory/monstrg · high confidence
Added Dockerfiles for Lambda and local development builds
New Dockerfiles have been introduced to streamline the build process for the Lambda service and local development environments. The primary Dockerfile constructs a production-ready Lambda image by compiling the Go server binary and the Node.js client assets, then packages them into the official AWS Lambda provided base image. A companion Dockerfile.local is also provided, which builds the server binary and client assets into a standard Alpine Linux container, facilitating easier local testing and deployment workflows.
build/package/lambda · high confidence
Initial DynamoDB monster storage implementation
Added a new DynamoDB-backed storage implementation for monsters (renamed from 'pokestrg' to 'monstrg' to remove Pokémon-related terminology). This includes the core storage logic in \storage.go\ and data models in \model.go\, providing methods to retrieve available partners, scan for all possible enemies, and fetch specific partners by ID. Unit tests in \storage\_test.go\ verify these operations against a local DynamoDB instance.
internal/driven/storage/dynamodb/monstrg · high confidence
Initial REST API implementation for game and battle management
The \internal/driver/rest\ package introduces the HTTP server layer for the application, built on the \go-chi/chi\ framework. It exposes endpoints for managing game sessions (create, retrieve details, get scenario) and battle actions (start, get info, decide turn, attack, surrender), along with a health check and a partners listing endpoint. The API includes middleware for CORS, request logging, and recovery, and serves a static web client when enabled. It defines a structured error handling system with specific HTTP status codes and error codes (e.g., \ERR\_INVALID\_BATTLE\_STATE\, \ERR\_GAME\_NOT\_FOUND\) and validates incoming request bodies for new game creation.
internal/driver · high confidence
Initial release of the Hex Monscape web client
The \cmd/client\ directory now contains the complete Vue 3 + Vite web application for Hex Monscape. This includes the full UI for the game loop: a welcome screen, player name entry, partner selection, a lounge screen for managing ongoing games, and a battle scene with health bars and turn controls. The client features a Pinia store for state management, a custom HTTP client for API communication, and Tailwind CSS for responsive styling.
cmd/client · high confidence
Introduce Play service for game session management
Added the Play service in the core domain to handle game session lifecycle operations. This service provides capabilities to retrieve available monster partners, initiate new games by linking a player with a partner, and fetch existing game details. It enforces validation on storage dependencies and returns specific errors when a game or partner is not found, forming the backend logic for starting and managing play sessions.
internal/core/service/play · high confidence
Introduces battle service with start, turn decision, attack, and surrender capabilities
The battle service in the core domain now provides the logic for managing combat encounters. Users can initiate a new battle for a game, retrieve the current battle state, and progress through turns by deciding actions. The service supports executing attacks against enemies, which updates battle states and tracks wins, as well as surrendering to end a battle immediately. It handles validation for game and battle existence, manages enemy selection, and persists battle state changes to storage.
internal/core/service/battle · high confidence
Introduces core battle logic and MySQL persistence models
This change adds the foundational domain entities for the game—Battle, Game, and Monster—along with their corresponding MySQL storage adapters. Users can now engage in turn-based battles where damage is calculated based on attack and defense stats, and the game scenario advances as battles are won. The implementation includes the core state machine for battle turns (deciding turns based on speed, executing attacks, handling surrender) and the data structures required to persist these game states in MySQL.
github.com/Haraj-backend/hex-monscape · high confidence
New local deployment configuration for MySQL-backed services
A new local deployment setup is available in the \deploy/local/run/rest-mysql\ directory, allowing users to run the full stack (MySQL, server, and client) via Docker Compose. This configuration initializes a MySQL 8.4.11 database with a predefined set of seed data (including monsters like Yellowleg and Bluebub) and ensures the server and client services start only after the database is healthy. The server exposes its API on port 9186, while the client is accessible on port 8161, providing a ready-to-use local environment for development and testing.
deploy/local/run/rest-mysql · high confidence
New local deployment configuration for REST API with DynamoDB storage
A new local deployment strategy has been added for the REST API service using DynamoDB storage. This includes a Docker Compose setup that orchestrates a LocalStack instance for DynamoDB emulation, the application server, and the client UI. The configuration ensures the server waits for the database to be healthy before starting, and the client waits for the server. It also includes a data seeding script and a JSON file containing initial monster data to populate the local database upon startup.
deploy/local/run/rest-dynamodb · high confidence
New online game demo application deployed via AWS Lambda
The \cmd/lambda\ directory now contains the entry point and documentation for the online game demo. This application serves as the serverless backend, running on AWS Lambda and API Gateway, and utilizes AWS DynamoDB for storing game, battle, and monster state. The code initializes the core play and battle services, connects to DynamoDB (supporting both local development via LocalStack and production environments), and exposes the REST API handlers. Users can now access the live demo at https://hex-monscape.haraj.app.
cmd/lambda · high confidence
Server now supports configurable MySQL and DynamoDB storage backends
The server application has been restructured to support multiple storage backends, allowing users to configure the system to use either in-memory, MySQL, or DynamoDB storage via configuration settings. This change introduces a new configuration structure that defines connection parameters for each backend (such as SQL DSN for MySQL and table names/endpoints for DynamoDB) and updates the dependency initialization logic to instantiate the appropriate storage adapters based on the selected type. Users can now deploy the server with persistent storage options beyond the default in-memory mode, enabling integration with external databases for game state persistence.
cmd/server · high confidence
Behavioural changes
DynamoDB adapter introduces dedicated data structures for record storage
The DynamoDB storage implementation now uses its own internal data structures (MonsterRow and BattleStatsRow) to map and store records, decoupling the persistence layer from the core entity definitions. This change ensures the adapter manages its own data representation, which supports consistent behavior across different storage implementations.
internal/driven/storage/dynamodb/shared · high confidence
Memory storage for battles and games now returns nil for missing records
The in-memory storage implementations for battles and games have been updated to consistently return nil when a requested record does not exist, rather than returning an error or a zero-value object. This change ensures that callers can reliably distinguish between a successfully retrieved empty state and a missing record, aligning the memory driver's behavior with the expected interface contract for these entities.
internal/driven/storage/memory/battlestrg · high confidence
MySQL storage for monsters now supports retrieving partners and enemies
The MySQL storage implementation in the \monstrg\ package now provides specific methods to fetch monsters by their role: \GetAvailablePartners\ retrieves monsters marked as partnerable, while \GetPossibleEnemies\ retrieves all monsters available for battle. This change introduces the \monstrg\ storage layer (renamed from \pokestrg\) to handle these distinct queries against the \monster\ table, allowing the application to distinguish between companion and enemy entities when interacting with the database.
internal/driven/storage/mysql/monstrg · high confidence
Standardized local storage initialization scripts for DynamoDB and MySQL
The local deployment setup now uses dedicated, standardized scripts to initialize the database schemas for both DynamoDB and MySQL. For DynamoDB, a new shell script creates the \monster\, \game\, and \battle\ tables with specific key schemas and a global secondary index on the \monster\ table. For MySQL, a new SQL schema file defines the corresponding tables, including the \monster\ table with an index on \is\_partnerable\ and the \battle\ table storing detailed stats for both partner and enemy monsters. A shared utility script has also been added to wait for LocalStack services to become ready before proceeding with deployment.
deploy/local/shared · high confidence
Test coverage
Added shared test utilities for MySQL integration testing; Added test utility for generating Monster entities; Added unit tests for core game entities.
Dependencies
Initialize client and backend dependency manifests
The project now includes its first dependency definitions: a \package.json\ and \yarn.lock\ for the client-side application (located in \cmd/client\) and a \go.mod\ and \go.sum\ for the backend. The client depends on Vue 3, Pinia, Vite, and Tailwind CSS, while the backend relies on Go 1.26, the Chi v5 router, sqlx for database access, and the AWS SDK for Go.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 45 → 45 (-0.0)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 60 → 60 (+0.0)
- Architecture 73 → 72 (-0.3)
- Maturity 57 → 80 (+22.7)
- Readiness 31 → 32 (+1.0)
- Security 63 → 50 (-12.6)
- Accessibility 51 → 51 (+0.0)
- Performance 100 → 100 (+0.0)
Resolved (3)
- High CVE: [GHSA redacted] (cmd/client/yarn.lock)
- Medium CVE: [GHSA redacted] (go.mod)
- Off-boarding risk: anonymized user #1
New (3)
- Medium CVE: [GHSA redacted] (go.mod)
- Off-boarding risk: anonymized user #1
- redundant comment (cmd/client/src/composables/http_client.js)
Architecture
- Unchanged — 0 containers · 1 contexts · 0 edges
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
Haraj-backend/hex-monscape was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 8 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 907a3d223630d2de817e8e89a9d7dc00f2b6188b — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.3+preprod-45ab2cab63de.