How ayumu203/nisekue works
1. This repo is a full-stack game system split into a React client and a .NET backend, with Supabase providing database and authentication. The codebase is organized around game domains rather than around UI screens.
2. The frontend lives in client/ and uses React + Vite + TypeScript + MUI. It is a single-page app that renders game pages such as home, players, items, quest, training, ranking, chat, and treasure map. The client also owns localization under client/locale/ and static art/assets under client/public/.
3. The frontend’s data access layer is explicit: client/src/api/ contains HTTP clients per feature, client/src/schema/ contains validation/contract models, and client/src/lib/ holds shared client utilities such as auth, Supabase integration, quest-run hub helpers, and player-related formatting. UI components are grouped by feature under client/src/components/.
4. The backend is a .NET Minimal API app in server/. It is layered into domain/, application/, infrastructure/, and endpoints/. This is the main architectural boundary: endpoints are thin adapters, application services orchestrate use cases, domain contains the game model and rules, and infrastructure implements persistence and resource loading.
5. The server/domain/ folder is the core of the system. It contains separate bounded contexts for battle, chat, move, player, quest, training, and treasure map. Each domain defines entities/value objects, enums, repository interfaces, and pure business rules such as damage calculation, status ranking, quest room/run state, and treasure-map reward logic.
6. The server/application/ layer implements use cases and workflows. This is where domain objects are assembled into player actions like job change, rebirth, move-set sanitization, item stat boosts, quest room lifecycle, quest run execution, training battles, ranking aggregation, thread handling, and cleanup jobs. Several application services act as coordinators over multiple repositories and domain services.
7. Real-time quest execution is a notable subsystem. server/application/quest/QuestRunHub.cs and the client’s quest hub hook indicate SignalR-backed live updates for quest runs, alongside persistent quest run state in the database. This suggests a mixed model: authoritative turn resolution on the server, with streaming UI updates to clients.
8. Persistence is handled in server/infrastructure/. EF Core AppDbContext and migrations manage relational state such as players, items, market listings, quest rooms/runs, chat threads, rankings, and treasure-map expeditions. Infrastructure also maps domain repositories to database tables and contains CSV-backed repositories for master data.
9. Master/reference data is split from transactional data. CSV files in server/resources/ define move, player, quest, training, and treasure-map masters; corresponding CSV repositories load them. This means many game rules and content tables are data-driven rather than hardcoded, which is important for diagramming the content pipeline.
10. The backend exposes feature-specific HTTP surfaces in server/endpoints/ for chat, items, players, quests, ranking, threads, training, and treasure maps. These endpoints are likely the only public API boundary the client talks to, with shared endpoint contract helpers keeping request/response shapes aligned.
11. There are background and maintenance workflows in the backend, not just request/response handlers. Examples include ranking rebuilds, quest run timeout processing, development data cleanup, and market listing cleanup. These are also mirrored in GitHub Actions workflows, so operational jobs are part of the architecture, not separate scripts.
12. Deployment and environment boundaries are clear: frontend is deployed to GitHub Pages, backend to Azure App Service, and Supabase hosts the DB/auth layer. The .github/workflows/ directory includes separate dev/prod deployment, migration, ranking rebuild, and cleanup pipelines, showing that infrastructure automation is a first-class part of the system.
13. Testing is concentrated in tests/server.tests/ with xUnit coverage for domain and application services. The tests reinforce the architecture by validating pure domain logic and orchestration services independently of the UI and deployment layers.
14. Supporting material in docs/ is substantial and domain-oriented. The MMD/MD documents capture domain models and design notes for battle, chat, player, quest, ranking, training, treasure map, and maintenance, which suggests the repository is designed with explicit domain modeling and long-lived feature specs.
Main entry points: domain Domain · application Application · App.tsx React app · pages Pages
Components 30
Frontend
React client and feature UI
- React app · Vite entry and route shell for the game client
client/src/App.tsx - Pages · Feature pages such as home, players, items, quest, training, ranking, chat, and treasure map
client/src/pages - UI features · Feature-scoped React components and page layouts
client/src/components - API layer · Feature HTTP clients and shared endpoint helpers
client/src/api - Contracts · Client-side request/response schemas and domain contracts
client/src/schema - Client lib · Auth, Supabase, quest hub, and player formatting helpers
client/src/lib - Locales · Translation bundles for app features and dialogs
client/locale
Backend
.NET API, domain, and persistence
- API host · ASP.NET entrypoint and service wiring
server/Program.cs - Endpoints · Thin feature-specific HTTP adapters for chat, items, players, quests, ranking, threads, training, and treasure maps
server/endpoints - Application · Orchestrates game workflows and background services
server/application - Domain · Core bounded contexts, entities, value objects, and business rules
server/domain - Infrastructure · EF Core, repositories, migrations, and data mapping
server/infrastructure - Master data · Data-driven game content and balance tables loaded by repositories
server/resources - Shared constants · Cross-cutting constants used by backend layers
server/shared/constants - Quest runs · SignalR-backed live quest execution with persistent run state
server/application/quest/QuestRunHub.cs - Player workflows · Job change, rebirth, move-set cleanup, item boosts, and market maintenance
server/application/player - Quest system · Room lifecycle, stage policies, NPC assignment, battle factory, and run resolution
server/application/quest - Training · Enemy selection, battle resolution, exp, mastery, and cooldown logic
server/application/training - Ranking · Ranking reads, rebuilds, and period aggregation
server/application/ranking - Chat · Chat rooms, messages, and thread views
server/application/chat - Treasure maps · Map expeditions, reward pools, and claim history
server/domain/treasuremap - Battle rules · Turn resolution, targeting, damage, and action state
server/domain/battle - Player model · Players, items, equipment, moves, status, and market rules
server/domain/player - Quest model · Rooms, runs, stages, enemies, traps, and rewards
server/domain/quest - AppDbContext · Relational persistence for transactional game state
server/infrastructure/AppDbContext.cs - CSV repositories · Repositories that load reference content from CSV files
server/infrastructure
Ops
Deployment, workflows, and external services
Quality
Tests and documentation
- Server tests · Domain and application tests for core game logic
tests/server.tests - Domain docs · MMD and markdown notes for battle, player, quest, chat, ranking, training, and treasure map
docs
Connections 33
- React app → Pages: renders · App shell routes to game pages
- Pages → UI features: composes · Pages assemble feature UI components
- Pages → API layer: loads data · Pages call feature HTTP clients
- API layer → Contracts: validates · API payloads are shaped by client contracts
- React app → Client lib: uses · Client shell relies on shared auth and runtime helpers
- React app → Locales: localizes · UI text is sourced from locale bundles
- Client lib → Supabase: auth/db · Client integrates with Supabase auth
- API layer → Endpoints: calls · Client talks to feature HTTP surfaces
- API host → Endpoints: hosts · Program wires the public API surface
- Endpoints → Application: dispatches · Endpoints forward requests into use cases
- Application → Domain: orchestrates · Use cases coordinate domain objects and rules
- Application → Infrastructure: persists via · Application services use repositories and storage adapters
- Application → Shared constants: shares constants · Use cases consume shared backend constants
- Domain → Battle rules: contains · Battle is a major bounded context
- Domain → Player model: contains · Player progression and economy rules
- Domain → Quest model: contains · Quest rooms, runs, and rewards
- Application → Quest runs: streams · Quest execution publishes live updates
- Quest runs → Quest model: state · Live run logic is built on quest run domain state
- Quest system → Battle rules: simulates · Quest battles use battle resolution primitives
- Training → Battle rules: simulates · Training battles reuse combat rules
- Player workflows → Player model: modifies · Player workflows act on progression and economy model
- Ranking → Player model: aggregates · Ranking is derived from player state and history
- Chat → Domain: uses · Chat services use chat domain repositories and models
- Treasure maps → Domain: uses · Treasure map workflows use treasure-map domain rules
- Infrastructure → AppDbContext: implements · Relational persistence is centered on EF Core context
- Infrastructure → CSV repositories: implements · CSV repositories load master/reference data
- CSV repositories → Master data: loads · Reference content is read from CSV files
- AppDbContext → Supabase: targets · Production persistence sits behind Supabase-managed data services
- Workflows → AppDbContext: migrates · CI/CD includes database migration pipelines
- Workflows → Application: runs jobs · Workflows rebuild ranking and clean up expired data
- Server tests → Domain: verifies · Tests cover pure domain behavior
- Server tests → Application: verifies · Tests cover orchestration services and workflows
- Domain docs → Domain: describes · Documentation captures the modeled game domains