GameHub is an enterprise-grade web game distribution platform for HTML5/WebGL titles. It provides a public game catalog, an iframe-based player with a gameplay bridge, a developer portal for build submission, and an administration module for moderation and publishing.
Goal: build a proprietary platform without copying brands, layouts, content, games, assets, or proprietary experiences from third parties.
- Project Description
- Repository Structure
- Technology Stack
- Architecture
- System Flow
- How to Run
- Tests and Coverage
- Business Vision
- Technical Vision
- Contributors
- License
- Project Status
- Links
GameHub is a modular monolith built on top of the EAF/ABP template for .NET. It connects players, developers, moderators, and administrators around a single catalog of web games.
| Persona | Capabilities |
|---|---|
| Anonymous Player | Browse, search, play, vote, and report games. |
| Authenticated Player | Profile, favorites, recent games, cloud saves, leaderboards, recommendations, and short game tokens. |
| Developer | Create and submit games, upload builds, and view metrics. |
| Moderator | Review, approve/reject builds, and handle user reports. |
| Administrator | Manage users, roles, feature flags, metrics, and audit logs. |
- Home page with sections: highlights, new releases, most played, trending, recommendations, web exclusives, and categories.
- Game detail page with execution in a sandboxed iframe, like/dislike, report, favorite toggle, and fullscreen support.
- Search and catalog filters by category, tag, device, orientation, exclusivity, and minimum rating.
- Optional player account with favorites and recent games; anonymous data stays in
localStorageand merges on login. - Leaderboards backed by Redis Sorted Sets.
- Ad breaks (commercial/rewarded) with provider abstraction, automatic audio muting, and ad-block handling.
- Cloud save/load with anonymous
localStoragefallback andgamehub_ignore_local-only keys. - SDK login,
getUser, andgetTokenfor games requiring player identity. - Adaptive controls (keyboard/touch hints) and ESC/Space pause/resume.
- Skippable cutscenes when
cutscenesSkippableis enabled. - In-game language selector and player language preference (
getLanguage/setLanguage). - Privacy policy display and consent on game detail pages with
localStoragefallback for anonymous users. - Animated thumbnails with moderation status on home/catalog cards; static fallback when not approved.
- Game aspect ratio metadata (
16:9,4:3orAny). - Public preview URLs for unpublished game builds (
/preview/:slug/:version?token=...) with short-lived JWT tokens. - Mobile Poki Pill overlay with
movePill(topPercent, topPx)SDK message and persisted position. - Mystery Tile on the home page for playtest discovery, with recording-consent prompt.
- Image-optimization warnings in build validation when uploaded assets exceed 100 KB.
- Multiplayer / Netlib base:
Game.SupportsMultiplayer,MaxPlayersPerMatch,MatchState,MatchParticipant, SignalRGameHubMatchHub(/signalr-match), room code matchmaking, real-time match state, and HTTP bridge endpoints. - Arbitrary User Data Store (AUDS): per-game key/value JSON storage with JSON validation, 100-key quota, 64 KB/value limit, reserved
gamehub_ignore_*prefix, and optional TTL. - SignalR multiplayer hardening (Poki 28): game-scoped token validation, 30-second reconnect grace periods, spectators (up to 10 per room), payload/rate limits,
/signalr-networkWebRTC signaling, Hangfire cleanup, and multiplayer/AUDS metrics. - Ranked multiplayer foundation (Poki 29): public match browsing by game/mode/region/latency, ranked seasons and MMR snapshots, queue cancellation/matching, server-owned match history and replay metadata, security audit events, matchmaking metrics, and admin match moderation endpoints.
The iframe-hosted game communicates with the platform through the following events and actions:
| Event | Description |
|---|---|
GameLoadingStarted |
Loading begins. |
GameLoadingFinished |
Loading completes. |
GameplayStarted |
Player starts the session. |
GameplayStopped |
Player pauses or leaves. |
CommercialBreakRequested |
Commercial break requested. |
CommercialBreakCompleted |
Commercial break finished. |
RewardedBreakRequested |
Rewarded ad requested. |
RewardedBreakCompleted |
Rewarded ad finished. |
AdBreakMute / AdBreakUnmute |
Audio muting around ad breaks. |
rewardedBreak |
Rewarded ad UI with green default and non-green rewarded buttons; single reward. |
GameErrorCaptured |
Error captured. |
GameMeasuredEvent |
Measurement or timing event. |
FpsMeasured |
FPS telemetry for performance monitoring. |
save / load |
Cloud/local player data persistence. |
getUser / getToken |
Authenticated player profile and short JWT. |
getPrivacyPolicy |
Hosted privacy policy for the game. |
controlScheme |
Primary input scheme sent to the game. |
pauseRequested / resumeRequested |
ESC/Space keyboard events. |
getLanguage / setLanguage |
Player language preference and game language change. |
getPrivacyConsent / setPrivacyConsent |
Privacy consent state with anonymous localStorage fallback. |
movePill |
Reposition the mobile Poki Pill overlay. |
createMatch / joinMatch / joinMatchByRoomCode |
SignalR-based multiplayer matchmaking with room code. |
sendMatchState / onMatchStateChanged |
Real-time match state broadcast to joined players. |
leaveMatch |
Disconnect from the current match. |
saveArbitrary / loadArbitrary / deleteArbitrary |
Arbitrary user data store (AUDS) with quota and TTL; save returns { saved, quota }. |
reconnect / spectateMatch / signal / broadcast |
Resilient multiplayer, spectator mode, and WebRTC signaling helpers. |
- Five-step submission wizard.
- HTML5/WebGL build upload (zip/tar) with mandatory validation.
- Validations:
index.htmlrequired, maximum size (100 MB), SHA-256 hash, and no executables (.exe,.dll,.bat,.cmd,.ps1). - Immutable versioning (semver) and CDN publication after approval.
- Per-build "Open in Inspector" and "Preview on Game Hub" actions in the versions list.
gamehub.jsonCLI contract andPOST /api/services/app/GameBuild/UploadFromClifor CI/CD uploads (API-key auth).
DeveloperTeamandDeveloperTeamMemberentities withDeveloper,Support, andBillingroles.IDeveloperTeamAppServicefor create, update, invite, remove, accept members, and general settings (/developer/team).DeveloperBillingProfilelinked to a team with pending-approval workflow.PlaytestSessionentity andIPlaytestAppServicefor requesting playtests, listing by game, and uploading recordings.PlaytestRecordingentity with video URL, duration, device, country, console output and notes; admin page/app/main/gamehub/playtestswith player and annotations.
- Review queue with approve/reject actions.
- Submission workflow:
SubmitForReviewAsync,StartReviewAsync,ApproveForPublishingAsync, andRequestChangesAsync. - Game publish/suspend workflow.
- Report queue and auditable moderation history.
- Build validation warnings for external requests, large files, and outgoing links.
- Quality Guidelines Gates: image-optimization warnings, IAP/ads keyword checks, profanity filter on titles/descriptions/filenames, thumbnail guide enforcement (dimensions, aspect ratio, size, format), and outgoing link detection.
- External Resources & Analytics Exemptions: developer-requested domain allowlist with moderator approval and privacy-statement tracking.
- Inspector de QA v2: SDK event timeline, warnings, and scaling tests per session.
- Error Scanner: aggregate
GameErrorLogentries by message/severity with health alerts when > 10 errors/hour. - Conversion Funnel: PageView → Loading → Gameplay start conversion from
GameMetricSnapshot. - Player Feedback Analytics: average rating, distribution, sentiment, and low-rating alerts.
- Player Fit / Retention: 1d/7d/30d retention, stickiness, and category benchmarks.
- Playtest Difficulty Balancing: per-level death/restart/complete analytics from
PlaytestRecording.LevelEvents. - FPS-based performance alerts and daily metric snapshots; health alerts when < 85% of users per device do not reach 30 FPS.
- Onboarding and Engagement guides: drop-off rate, session duration, median duration, benchmark by category, and suggestions.
- Suggested categories & SEO validation for game publishing.
- Revenue-share deal types (
WebExclusive,NonExclusive) with split rules and flat-fee support. - Ad Reports:
AdImpressionrecords andDeveloperEarningsAppService.GetAdReportAsyncgrouped by type, provider, country, and device. - UGC moderation with profanity filtering.
gamehub/
├── Api/ # .NET backend
│ ├── src/
│ │ ├── GameHub.Core/ # Domain layer (entities, value objects, enums)
│ │ ├── GameHub.Application/ # Application services and DTOs
│ │ ├── GameHub.EntityFrameworkCore/ # DbContext, migrations, EF Fluent API
│ │ ├── GameHub.Web.Host/ # Host, Startup, middleware, controllers
│ │ └── GameHub.Migrator/ # Migration runner
│ ├── test/
│ │ ├── GameHub.Tests/ # xUnit domain and application tests
│ │ └── GameHub.Web.Tests/ # Web/integration tests
│ ├── GameHub.sln # Solution file
│ └── Dockerfile # API container image
├── angular/ # Public Game Hub (Angular 20+)
├── angular-admin/GameHub.UI/ # Administration UI (Angular 20+)
├── docker-compose.infra.yml # Local infrastructure (PostgreSQL, Redis, MinIO)
├── docker-compose.yml # API + Angular Hub + Angular Admin (requires external infra)
├── docker-compose.all.yml # Full stack (infra + API + Angular Hub + Angular Admin)
├── .env.example # Example environment variables
├── scripts/ # Local build, test, and run scripts
├── docs/ # Execution log and known issues
├── .github/workflows/ # CI/CD pipelines
├── .specs/ # Detailed platform specifications
├── README.md # This file (en-US)
├── README.pt-BR.md # Portuguese version
└── CHANGELOG.md # Version history
| Layer | Technologies |
|---|---|
| Backend API | .NET 10 LTS, ASP.NET Core, EAF/ABP 10.4, EF Core, AutoMapper, Hangfire |
| Game Hub Frontend | Angular 20+, TypeScript strict, RxJS, custom design system |
| Admin Frontend | Angular 20+, TypeScript strict, RxJS, PrimeNG, Bootstrap |
| Database | PostgreSQL 16+ (preferred) or SQL Server 2022+ |
| Cache | Redis 7+ (catalog, rate limiting, leaderboards, distributed locks) |
| Storage | S3/MinIO/Azure Blob (builds, thumbnails, screenshots) |
| Observability | Serilog (JSON logs), OpenTelemetry (traces + metrics), CorrelationId |
| Containers | Docker, Docker Compose |
| Security | JWT/OIDC, RBAC (ABP), CSP, iframe sandbox, CORS, LGPD |
| Tests | xUnit, Shouldly |
Not used: FluentValidation (ABP native validation), MediatR (ABP native CQRS).
Modular Monolith with Clean Architecture + DDD on the EAF/ABP template.
Api/src/
GameHub.Core → Domain (entities, value objects, repositories)
GameHub.Application → Use cases (application services)
GameHub.Application.Shared → DTOs, permissions, feature flags
GameHub.EntityFrameworkCore → DbContext, migrations, configurations
GameHub.Web.Core → Middleware, filters, security
GameHub.Web.Host → Controllers, startup
GameHub.Migrator → Migration runner
Core ← Application ← Infrastructure
Web ← Application
- Never: Core → Infrastructure, Core → Web, Application → Web.
- Catalog —
Game,Category,Tag,GamePlacement - Build Management —
GameBuild, build validation - Gameplay Analytics —
PlaySession,GameplayEvent,GameMetricSnapshot - Developer Portal —
DeveloperProfile, game submission - Moderation —
ModerationReview,UserReport,UserContent - Monetization —
IAdProvider,AdBreakResult,AdImpression, revenue share, andWebExclusivediscovery - Analytics —
GameMetricSnapshot,GameplayEvent,GameErrorLog, retention/funnel/feedback reports - Quality Gates —
GameBuildPackageValidator,BuildValidationReport,InspectorSession
graph LR
A[Player / Developer] -->|Browser| B[Angular Hub]
C[Moderator / Admin] -->|Browser| D[Angular Admin]
B -->|HTTP| E[GameHub API]
D -->|HTTP| E
E --> F[PostgreSQL]
E --> G[Redis]
E --> H[MinIO / S3]
B -->|iframe| I[Game Build CDN]
I -->|Gameplay Events| E
- .NET 10 SDK
- Node.js 20+
- Docker and Docker Compose
git
# Build
dotnet build Api/GameHub.sln
# Run tests
dotnet test Api/GameHub.sln
# Run API (requires PostgreSQL and Redis)
dotnet run --project Api/src/GameHub.Web.HostUse o script install.sh para subir apenas a aplicação (API, Hub e Admin) sem a infraestrutura. Requisito: PostgreSQL, Redis e (opcionalmente) MinIO devem estar rodando previamente, por exemplo via docker compose -f docker-compose.infra.yml up -d.
./install.shComportamento:
- Se o arquivo
.envnão existir, o script cria um.envcom todas as variáveis preenchidas comA PREENCHER, executadocker compose pulledocker compose build, e não sobe os containers. Edite o.enve execute o script novamente. - Se o arquivo
.envjá existir, o script executapull,buildeup -d. - Para forçar o rebuild das imagens sem cache e recriar os containers, use a flag
-r:
./install.sh -rPara subir manualmente a infraestrutura antes do script:
# Start infrastructure (PostgreSQL, Redis, MinIO)
docker compose -f docker-compose.infra.yml up -d
# Then run the install script
./install.sh# Copy example environment variables
cp .env.example .env
# Start infrastructure (PostgreSQL, Redis, MinIO)
docker compose -f docker-compose.infra.yml up -d
# Option 1: start application using external/host infrastructure
docker compose -f docker-compose.yml up --build -d
# Option 2: start the full stack (infrastructure + application)
# docker compose -f docker-compose.all.yml up --build -d| Service | URL |
|---|---|
| API | http://localhost:4601 |
| Game Hub | http://localhost:4600 |
| Admin | http://localhost:4602 |
| MinIO Console | http://localhost:9001 |
| Serviço | DNS |
|---|---|
| Game Hub | gamehub.afonsoft.dev |
| API | gamehub-api.afonsoft.dev |
| Admin | gamehub-admin.afonsoft.dev |
| Sandbox dos jogos | games.afonsoft.dev |
Para testar localmente com esses domínios, aponte-os para 127.0.0.1 no /etc/hosts:
127.0.0.1 gamehub.afonsoft.dev
127.0.0.1 gamehub-api.afonsoft.dev
127.0.0.1 gamehub-admin.afonsoft.dev
127.0.0.1 games.afonsoft.dev
O nginx já configurado deve fazer proxy para os upstreams locais:
gamehub.afonsoft.dev→http://127.0.0.1:4600gamehub-api.afonsoft.dev→http://127.0.0.1:4601gamehub-admin.afonsoft.dev→http://127.0.0.1:4602
As variáveis GAMEHUB_API_URL, GAMEHUB_HUB_URL, GAMEHUB_ADMIN_URL e GAMEHUB_CORS_ORIGINS no .env permitem sobrescrever as URLs públicas (útil para http/local ou outro domínio).
# .NET tests
dotnet test Api/GameHub.sln
# Backend coverage (XPlat Code Coverage)
dotnet test Api/GameHub.sln --collect:"XPlat Code Coverage" --results-directory ./TestResults
# Angular builds
cd angular && npm ci && npm run build
cd angular-admin/GameHub.UI && npm ci && npm run build| Suite | Status | Count |
|---|---|---|
| GameHub.Tests | Pass | 310 passed, 2 skipped |
| GameHub.Web.Tests | Pass | 0 passed, 1 skipped |
| Angular Hub Build | Pass | production build OK |
| Angular Admin Build | Pass | production build OK |
Measured with dotnet test --collect:"XPlat Code Coverage" and GameHub.* assembly filter:
| Assembly | Line Rate | Branch Rate |
|---|---|---|
| GameHub.Core | 77.7% | 50.3% |
| GameHub.Application | 79.6% | 50.3% |
| GameHub.EntityFrameworkCore | 1.0% | 42.3% |
| GameHub.Web.Host | 49.1% | 41.9% |
| Overall | 6.3% | 50.3% |
The overall rate is low because the platform is in early development. The coverage target is 90% line/branch; new domain and application tests should be added incrementally.
GameHub aims to become an independent, scalable web game distribution platform where developers can publish HTML5/WebGL titles and players can discover and play them directly in the browser. The platform prioritizes:
- Self-ownership of catalog, ads, and revenue distribution.
- Developer empowerment with transparent submission and moderation workflows.
- Player trust through sandboxed gameplay, content moderation, and privacy compliance.
- Operational readiness with multi-tenancy, auditing, and observability built-in.
- Clean Architecture + DDD keeps domain logic independent of frameworks and UI.
- EAF/ABP provides multi-tenancy, RBAC, localization, and audit logging out of the box.
- PostgreSQL + Redis support relational data and high-throughput cache/ranking workloads.
- Docker Compose enables consistent local development and future cloud deployment.
- OpenTelemetry + Serilog enable structured observability from day one.
- Modular frontends separate the public catalog from the administration interface while sharing the same API contracts.
- Afonso Dutra Nogueira Filho — afonsoft
GPL-3.0-or-later. See LICENSE for details.
In active development. Specs 27–29 provide the multiplayer/AUDS foundation, authenticated SignalR match handling, reconnect resilience, spectators, signaling, ranked queues, match history, cleanup jobs, and observability.
This repository includes an agent harness (.claude/ + .devin/) and is linked to the central afonsoft/agents-skills catalog.
- AGENTS.md — agent mission, rules, and workflow.
- CLAUDE.md — Claude Code / Devin CLI configuration.
- .claude/MEMORY.md — cross-session decisions and available tools.
- .specs/ — detailed platform specifications.
Available agent tools include Devin native tools, MCP servers (deepwiki, firecrawl, microsoft-learn, monday, notion, sonarqube, tavily), and reusable skills for .NET/ABP/Angular/PostgreSQL.