GStones/moke-kit
67.7
Adequate · 8 November 2026
5.1k
lines of production code
Go
primary language
6
measurements over time
What this system is
Moke Kit is a Go-based scaffolding framework and library designed for building modular, production-ready game services. It provides a unified infrastructure layer that abstracts and integrates core components such as gRPC/HTTP servers, MongoDB and Redis data persistence, and NATS messaging, all managed through Uber FX dependency injection. The system emphasizes security and operational robustness by enforcing strict authentication, TLS/mTLS, and rate-limiting configurations, while offering built-in support for Agones game server lifecycle management and multi-tenant isolation.
How it got here
2023 — Core infrastructure and modular architecture
27 changes.
This period focused on establishing the foundational architecture of the Moke Kit library by defining core interfaces for servers, message queues, and NoSQL storage. It introduced modular implementations for these components, including Zinx-based networking, NATS messaging, and MongoDB/Redis data persistence, all integrated via Uber FX dependency injection. The work also established essential cross-cutting concerns such as structured logging, security enforcement, and multi-tenant namespace support.
2024 — Infrastructure and integration modules
12 changes.
This period focused on building modular infrastructure components using the FX dependency injection framework, including server security, messaging, and third-party integrations. Key additions include Agones game server support, In-App Purchase clients, and various authentication and telemetry middlewares to enable secure and observable service operations.
2025–2026 — Testing infrastructure and agent scaffolding
6 changes.
This period focused on enhancing test coverage and developer tooling by introducing comprehensive integration tests, an in-memory NoSQL mock driver, and a standardized test helper utility. Concurrently, the project expanded its scaffolding capabilities with new agent skills and game templates, while improving message queue reliability through atomic subscription cancellation and automated code review rules.
Features
Add Agones SDK and Allocate Client modules
Introduces two new dependency-injection modules for the Agones game server framework: AgonesSDKModule, which provides the Agones Go client SDK, and AgonesAllocateClientModule, which provides the allocate mTLS gRPC client. These modules wire together the underlying settings and client implementations from the agonesfx package, enabling the application to interact with the Agones fleet management system.
3rd/agones/pkg/module · high confidence
Add Agones integration module with environment-aware client and SDK wiring
The agonesfx package now provides a complete integration layer for Agones, including an allocator client and an SDK wrapper. The allocator client supports mutual TLS for production connections to the Agones allocation service, while falling back to a mock client for non-production environments. Similarly, the SDK module initializes the real Agones SDK in production and a no-op mock in other environments. Configuration is handled via environment variables (e.g., AGONES\_DEPLOYMENT, ALLOCATE\_SERVICE\_URL, and TLS certificate paths) with sensible defaults for local development.
3rd/agones/pkg/agonesfx · high confidence
Add Firebase, Supabase, and AWS configuration modules
This change introduces new integration modules for third-party services. In the auth area, it adds Firebase and Supabase authentication middlewares for gRPC, allowing requests to be authenticated via Firebase ID tokens or Supabase user sessions, with settings loaded from environment variables. In the cloud area, it adds an AWS configuration module that loads AWS credentials and region from environment variables to provide an AWS SDK v2 config. These modules are exposed via fx modules for easy injection into the application.
3rd/auth · high confidence
Add In-App Purchase (IAP) client module for Apple and Google Play
This change introduces a new In-App Purchase (IAP) module that provides dependency-injected clients for verifying purchases on Apple App Store and Google Play. The module reads configuration from environment variables (such as Apple Key ID, Bundle ID, and Google Public Key paths) and initializes the respective store clients, making them available for use within the application's dependency injection container.
3rd/iap · high confidence
Add MQ module definition
A new module definition file has been added to the mq package, registering the message queue functionality via the fx framework. This module aggregates the existing MqModule and SettingsModule from the mfx package, making the MQ capabilities available as a cohesive unit within the application's dependency injection graph.
mq/pkg/module · high confidence
Add MongoDB implementation for the NoSQL interface
Introduces a new MongoDB driver within the ORM's NoSQL layer, enabling users to store, retrieve, update, and delete documents using MongoDB as the backend. The implementation supports versioned writes with optimistic concurrency control (CAS), allowing create-only, version-matched updates, or unconditional overwrites, and provides an atomic increment operation for numeric fields.
orm/nosql/mongo/internal · high confidence
Add Redis cache implementation
Users can now use Redis as a caching backend via the new RedisCache component in the ORM/NoSQL layer. This implementation provides GetCache, SetCache, and DeleteCache operations, handling JSON serialization and expiration (defaulting to a 40–60 minute range), and includes basic safety checks to prevent panics when the underlying Redis client is nil.
orm/nosql/cache · high confidence
Add local in-memory message queue adapter
Introduces a new local message queue implementation in the mq/internal/local package that wraps the Watermill gochannel pub/sub library. This adapter provides an in-memory message broker supporting publish/subscribe operations, topic namespacing, and subscription lifecycle management, accompanied by tests for basic functionality and concurrent race conditions.
mq/internal/local · high confidence
Add message queue error definitions
The file \mq/internal/qerrors/errors.go\ introduces a new package containing specific error variables for the message queue subsystem. These errors cover scenarios such as subscription failures, unsupported MQ types, topic parsing issues, missing NATS or Local queue implementations during dependency injection, invalid subscriptions, empty topics, and unsupported delayed publishing.
mq/internal/qerrors · high confidence
Add slogger package for shell interaction logging
A new \slogger\ package has been added to the \logging\ directory, providing helper functions for interacting with the \ishell\ library. This includes utilities for reading user input (\ReadLine\), printing informational messages (\Info\, \Infof\), and handling warnings or fatal errors (\Warn\, \Die\) that also terminate the application. A \Done\ function is also included to print completion messages before exiting.
logging/slogger · high confidence
Added Agones SDK wrapper and mock implementations
Introduced a new Go package in the Agones SDK integration layer that provides a wrapper around the official Agones Go SDK. This includes an \Agones\ struct implementing core lifecycle methods (Init, Ready, Health, Allocate, Shutdown, Reserve) and game server state management (SetLabel, SetAnnotation, WatchGameServer). Additionally, mock implementations (\Mock\ and \MockCounterList\) were added to facilitate testing by providing no-op or stubbed responses for the SDK interface.
3rd/agones/internal/sdk · high confidence
Added MongoDB client and provider factory
A new factory module for MongoDB has been introduced, providing functions to create a MongoDB client with a 30-second connection timeout and ping verification, as well as a document provider wrapper that integrates with the existing internal driver implementation.
orm/nosql/mongo · high confidence
Added NoSQL and Cache interface definitions
New interface contracts have been introduced in the \orm/nosql/diface\ package to standardize access to NoSQL storage and caching layers. The \IDocumentProvider\ and \ICollection\ interfaces define methods for opening database drivers and performing document operations such as Set, Get, Delete, and Increment. Additionally, the \ICache\ interface specifies a generic cache contract with Get, Set, and Delete capabilities, accompanied by a default stub implementation.
orm/nosql/diface · high confidence
Added in-memory mock driver for NoSQL testing
Developers can now use an in-memory mock implementation for the NoSQL document provider interface, enabling faster and isolated unit tests without requiring a real database. This change introduces a mock collection that supports standard document operations (Set, Get, Delete, Incr) with versioning and concurrency controls, exposed via a new factory function in the orm/nosql/mock package.
orm/nosql/mock · high confidence
Added logging and rate-limiting interceptors for Zinx connections
The server now includes two new interceptors for the Zinx framework: a logger that records incoming messages at the debug level, and a rate limiter that restricts message throughput based on a configurable limit, returning a warning and blocking the request if the limit is exceeded.
server/internal/zinx/interceptors · high confidence
Introduce DocumentBase with read-through caching and CAS updates
Added a new DocumentBase component in the nosql ORM layer that provides a base structure for NoSQL document operations. It implements read-through caching (with a default 30-minute TTL) to optimize load performance and supports Compare-And-Swap (CAS) updates with exponential backoff and jitter to handle concurrent modifications safely. The change includes the core implementation and corresponding unit tests for CRUD operations and concurrent update scenarios.
orm/nosql · high confidence
Introduce NATS-based message queue implementation
Added a new NATS message queue implementation in the mq/internal/nats package, providing a concrete adapter for the mq interface using the Watermill NATS v2 library. The implementation includes a ZapLoggerAdapter for logging, configuration for JetStream (disabled by default) and JSON marshaling, and a MessageQueue struct that manages NATS connections with retry and timeout settings. It supports subscribing to topics with context cancellation for cleanup, publishing messages, and handles empty topic validation. A lifecycle test verifies that subscriptions are properly invalidated when the context is cancelled.
mq/internal/nats · high confidence
Introduce Zinx-based TCP and WebSocket server implementation
The server now supports TCP and WebSocket connections via the Zinx framework. This change adds a factory that configures the Zinx server with settings such as ports, worker pool size, and TLS certificates, and registers interceptors for rate limiting and logging. A wrapper struct provides standard start and stop serving methods for the underlying Zinx server instance.
server/internal/zinx · high confidence
Introduce configurable options for NoSQL operations
Added a new options package for the NoSQL ORM layer that allows users to configure operation parameters such as document versioning (with conflict detection between specific versions and 'any version' modes), time-to-live (TTL) expiration, and source/destination data bindings for updates and retrievals.
orm/nosql/noptions · high confidence
Introduce default ORM module with Mongo and Redis support
A new \orm/pkg/module\ package provides a default dependency-injection module (using Uber FX) that wires together settings, a Mongo document store, and Redis. GORM is explicitly excluded from this default configuration and must be added opt-in via a separate module, ensuring the base ORM setup remains lightweight and focused on the Mongo/Redis stack.
orm/pkg/module · high confidence
Introduce fx-based local and NATS message queue modules
The \mq/pkg/mfx\ package now provides structured dependency-injection modules for message queue infrastructure. It introduces \LocalModule\ to wire a local in-memory message queue and \NatsModule\ to connect to a NATS server, both configurable via environment variables (e.g., \CHANNEL\_BUFFER\_SIZE\, \NATS\_URL\). A central \MqModule\ aggregates these optional implementations, allowing applications to select between local and NATS backends through the \fx\ framework while ensuring the application namespace is not overwritten during initialization.
mq/pkg/mfx · high confidence
Introduce fxmain entry points for modular Uber FX application composition
The fxmain package now provides two distinct entry points for initializing applications via Uber FX: Main() starts a 'batteries-included' graph including settings, logging, server, ORM, and message queue modules, while Core() starts a minimal graph with only settings and logging. This allows users to choose between a full-featured binary or a thin base for custom compositions. The module structure also introduces a shared deployment namespace mechanism that propagates the DEPLOYMENT environment variable across all modules.
fxmain · high confidence
Introduce internal gRPC server and HTTP gateway with TLS and CORS support
Added the \server/internal/srpc\ package, which provides factory functions to create and manage gRPC and HTTP gateway servers. The gRPC server includes hardened shutdown semantics that gracefully stop when idle or force-stop via context deadline when RPCs block. The HTTP gateway supports configurable TLS and mutual TLS (mTLS) for dialing the gRPC backend, as well as strict CORS allowlisting for incoming requests. Tests verify the new shutdown behavior and CORS enforcement.
server/internal/srpc · high confidence
Introduce multiplexed connection handling with TLS support
The server now includes a new connection multiplexer (cmux) that allows a single TCP port to serve HTTP, gRPC, and WebSocket traffic simultaneously. This component supports TLS encryption, including optional mutual TLS (mTLS) for client certificate verification, and features automatic reloading of TLS certificates and keys without requiring a server restart.
server/internal/cmux · high confidence
Introduce server and service interface contracts
The \server/siface\ package now defines the core abstractions for the application's server architecture. It introduces \IServer\, \IConnectionMux\, \IGrpcServer\, and \IGatewayServer\ interfaces to standardize how the server starts, stops, and exposes listeners for gRPC, HTTP, and WebSocket protocols. Additionally, it provides \IAuthMiddleware\ for request authentication logic and specific service interfaces (\IGatewayService\, \IZinxService\, \IGrpcService\) that allow services to register themselves with their respective server backends.
server/siface · high confidence
Introduce structured NoSQL key abstraction with namespace support
Added a new \orm/nosql/key\ package that provides a structured \Key\ type for managing NoSQL identifiers. This includes validation of key formats (requiring at least two sections separated by slashes), methods to extract parts, base names, and prefixes, and support for multi-tenant deployments via a process-wide namespace that automatically prefixes keys. The implementation includes both validated constructors (which may return errors or panic) and unchecked constructors for performance-critical paths, along with tests verifying namespace prefixing behavior.
orm/nosql/key · high confidence
Introduces common message queue abstractions and multi-tenant namespace support
This change adds foundational types and utilities to the \mq/common\ package to support message queue interactions. It defines \ConsumptionCode\ constants to standardize consumer acknowledgment behaviors (such as success, finality, and transient/persistent failures) and \DeliverySemantics\ to specify at-least-once or at-most-once delivery guarantees. Additionally, it introduces a \Header\ type to identify message broker backends (NATS, local, Kafka, NSQ) and provides a \Namespace\ mechanism that allows users to prefix topic names with a global tenant identifier, enabling multi-tenant usage of a single message queue deployment.
mq/common · high confidence
Introduces gRPC middleware stack with auth, rate limiting, and OpenTelemetry
The server now includes a comprehensive set of gRPC interceptors for authentication, rate limiting, logging, recovery, and distributed tracing. Authentication is enforced via a configurable client, with a fail-closed behavior in production environments that rejects requests if no auth middleware is provided. Rate limiting is applied using a token bucket algorithm, and all requests are logged with trace IDs and user IDs when available. OpenTelemetry integration is added for both server and client sides to support distributed tracing. Panic recovery is enabled in production to prevent server crashes from unhandled panics.
server/middlewares · high confidence
Introduces message queue interface and configuration options
Adds the \miface\ package which defines the core abstractions for the message queue system, including the \MessageQueue\, \Subscription\, and \Message\ interfaces. It also introduces \PubOptions\ and \SubOptions\ to allow users to configure message publishing (with support for byte or JSON payloads and delays) and subscription behaviors (specifically selecting between at-least-once and at-most-once delivery semantics).
mq/miface · high confidence
Introduces modular server infrastructure with TLS, OpenTelemetry, and Zinx support
The server/pkg/sfx package now provides a set of new FX modules that handle core server configuration and infrastructure. This includes SecuritySettingsModule for loading TLS/mTLS configurations (enabling secure gRPC/HTTP and TCP connections), SettingsModule for general server parameters (ports, timeouts, rate limits, CORS), and ConnectionMuxModule to manage multi-protocol listening on the same port with optional TLS. Additionally, OTelModule integrates OpenTelemetry for distributed tracing and metrics, while AuthMiddlewareModule, ServicesModule, and Zinx-specific settings enable modular authentication, service registration, and Zinx framework integration.
server/pkg/sfx · high confidence
Introduction of Agones SDK interface abstraction
A new interface definition (iagones.go) has been added to abstract the Agones SDK client. This interface exposes core Game Server lifecycle methods such as Init, Ready, Health, Allocate, Shutdown, and Reserve, along with methods for managing labels, annotations, and game server state. It also includes a counter list interface for managing game server metrics and counters, enabling decoupled testing and implementation flexibility for Agones integration.
3rd/agones/aiface · high confidence
Introduction of standardized ORM error definitions
The orm/nerrors package now provides a centralized set of predefined error variables for common ORM operations, including ErrNotFound, ErrVersionNotMatch, ErrMissingNosqlURL, ErrInvalidNosqlURL, ErrAnyVersionConflict, ErrDestIsNil, ErrDestMustBePointer, ErrKeyNotFound, ErrDocumentStoreIsNil, ErrSourceIsNil, ErrTooManyRetries, and ErrUpdateLogicFailed. This allows application code to consistently check for and handle these specific failure conditions.
orm/nerrors · high confidence
New FX-based ORM and cache configuration modules
Added new dependency-injection modules in orm/pkg/ofx to configure MongoDB, GORM, and Redis connections via the fx framework. The SettingsModule loads database and cache URLs and credentials from environment variables, while MongoPureModule, GormModule, and RedisModule handle the lifecycle and initialization of their respective drivers, including authentication parameters and graceful shutdown hooks.
orm/pkg/ofx · high confidence
New agent skills and game templates for moke-kit scaffolding
Added three new agent skills (add-game-rpc, compose-moke-modules, create-game) and a complete game server template under .agents/skills/create-game/assets/template/. The create-game skill scaffolds a new Go game service using moke-kit, providing two entry-point styles: an aggregate entry (fxmain.Main with AllModule and a stub dfx.AuthModule) and a thin entry (fxmain.Core with explicit modules). The template includes gRPC and HTTP gateway support, optional zinx TCP, MongoDB and Redis infrastructure via Docker Compose, interactive CLI and k6 smoke tests, and secure defaults such as stub auth that treats bearer tokens as UIDs and clear guidance for swapping to platform AuthMiddlewareModule.
.agents · high confidence
New utility package for auth, config, and deployment helpers
A new \utility\ package has been added, introducing several helper capabilities: an authentication override mechanism (\WithoutAuth\) that allows methods to be called without an access token; a configuration loader (\Load\) that reads from environment variables and optionally from HashiCorp Vault (failing closed if Vault is configured but credentials are missing); context helpers for managing bearer tokens and user IDs; deployment environment detection (\IsProd\, \IsDev\, \IsLocal\) with support for suffixed names (e.g., \prod\_gcp\); a process-wide namespace setter for ORM keys and MQ topics; and a URL redaction function (\RedactURL\) that strips or masks user credentials from connection strings. Tests are included for the config loader, deployment parsing, namespace concurrency, and URL redaction.
utility · high confidence
Structured logging with environment-aware configuration
The application now uses a structured logging library (Zap) that automatically adjusts its output format based on the deployment environment. In production, logs are generated in a standard production format with stack traces captured on panic events. In development and local environments, logs are formatted for readability with colored level indicators and stack traces captured on error events. This logger is integrated into the application's dependency injection container via the fx framework, allowing components to request a configured logger instance.
logging · high confidence
TLS certificate auto-reload for gRPC connections
The server now supports automatic reloading of TLS client certificates and CA bundles when they change on disk. New utilities in the tools package introduce a file-watching mechanism that monitors certificate paths and updates the active TLS configuration without requiring a service restart, ensuring secure gRPC connections remain valid after certificate rotations.
server/tools · high confidence
Unified message queue factory with NATS and local backends
The mq/internal package now provides a MessageQueue factory that routes publish and subscribe operations to either a NATS or an in-process local backend based on the topic scheme (e.g., nats:// or local://). This allows users to interact with a single interface while the system automatically selects the appropriate underlying queue implementation, with specific error handling for missing backends or unsupported schemes.
mq/internal · high confidence
Behavioural changes
Added Bugbot review rules and portable agent skills configuration
The .cursor directory now includes a new BUGBOT.md file that defines automated review rules for security and correctness, specifically flagging issues related to authentication middleware, binder configurations, and message queue subscription handling. Additionally, a symlink named skills has been added to point to ../.agents/skills, enabling portable agent skills for AI tools.
.cursor · high confidence
Enforced security posture for production server deployments
The server module now validates startup configuration to prevent insecure deployments: in production, enabling gRPC or HTTP gateway services requires an auth middleware, and HTTP gateways must also specify at least one CORS origin. If these conditions are not met, the server fails to start with a clear error; in non-production environments, missing auth triggers a warning instead of a failure. This change ensures that critical security controls are enforced before services are exposed.
server/pkg/module · high confidence
Introduce atomic, thread-safe subscription cancellation
The message queue now uses a new CancelSubscription implementation that manages subscription lifecycle via context cancellation rather than closing a shared subscriber. This change ensures that unsubscribing is safe to call multiple times and handles concurrent unsubscribe operations correctly, preventing race conditions where multiple goroutines might attempt to cancel the subscription simultaneously.
mq/internal/subscription · high confidence
Test coverage
Added comprehensive test suite and test utilities for moke-kit; Added integration tests for local and NATS message queues; Added mock allocation service client for testing.
Dependencies
Initial dependency manifest for Moke Kit
The project introduces a new go.mod file establishing the base dependency graph for the Moke Kit library. This manifest sets the Go toolchain to version 1.27.0 and integrates core modules for cloud infrastructure (AWS SDK v2, Agones v1.60.0, Firebase), messaging (NATS, Watermill), observability (OpenTelemetry, Jaeger), and data persistence (Redis, MongoDB, GORM). It also includes specific version pinning for security and stability, such as keeping gRPC on the 1.83.x branch to avoid known vulnerabilities and restricting GORM to the 1.25.x series to prevent field-zeroing issues.
(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 65 → 68 (+2.6)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 86 → 86 (+0.0)
- Architecture 86 → 85 (-1.6)
- Maturity 55 → 58 (+3.5)
- Readiness 67 → 67 (+0.0)
- Security 89 → 83 (-5.5)
- Performance 75 → 85 (+10.3)
New (2)
- High CVE: [GHSA redacted] (go.mod)
- Medium CVE: GO-2026-6865 (go.mod)
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
GStones/moke-kit 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 388d523a53ef49d56e15699a5568d7b6e41ec632 — 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.