English | 中文
moke-kit is a toolkit for building microservices or monolithic applications in Go. You can develop your application as a monolithic service and deploy it as microservices. Like building with LEGO, you can assemble your services exactly how you want them.
graph TB
subgraph "Application Layer"
App[Application]
DI[Dependency Injection<br/>uber/fx]
end
subgraph "Server Layer"
GRPC[gRPC Server]
HTTP[HTTP Gateway]
TCP[TCP Server]
WS[WebSocket Server]
KCP[KCP Server]
end
subgraph "Middleware Layer"
Auth[Authentication]
Rate[Rate Limiting]
Tel[OpenTelemetry]
Log[Logging]
Rec[Recovery]
end
subgraph "Storage Layer"
subgraph "Database"
GORM[GORM]
MongoDB[MongoDB]
end
subgraph "Cache"
Redis[Redis]
Dragon[Dragonfly]
end
subgraph "Message Queue"
MQ[NATS Message Queue]
end
end
subgraph "Integration Layer"
IAP[IAP Verification]
Agones[Agones Gaming]
end
App --> DI
DI --> GRPC
DI --> HTTP
DI --> TCP
DI --> WS
DI --> KCP
GRPC --> Auth
HTTP --> Auth
TCP --> Auth
WS --> Auth
KCP --> Auth
Auth --> GORM
Auth --> MongoDB
Auth --> Redis
Auth --> Dragon
Auth --> MQ
Auth --> IAP
Auth --> Agones
classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
classDef layer fill:#e4f0f8,stroke:#333,stroke-width:2px
class App,DI default
class Server_Layer,Middleware_Layer,Storage_Layer,Integration_Layer layer
- Dependency Injection: Uses uber/fx for inversion of control
- Security:
- Built-in TLS and mTLS support for Zero Trust security
- Built-in Token-based authentication with JWT support
- Built-in Middleware: Rate limiting, OpenTelemetry, authentication, logging, panic recovery, and more
- Caching:
- Built-in Cache-Aside pattern for ORM and NoSQL
- Built-in Compare-and-swap for database consistency
- Development Tools:
- Command-line client for independent testing
- Single command generation of proto, gRPC, gateway, Swagger, and client code using buf
- Servers:
- gRPC
- HTTP with grpc-gateway
- TCP via zinx
- WebSocket via zinx
- KCP via zinx
- Message Queue:
- ORM:
- Cache:
- Redis
- Dragonfly
- Third Party Integrations:
- Install gonew:
go install golang.org/x/tools/cmd/gonew@latest
- Create a new project:
gonew github.com/gstones/moke-layout your.domain/myprog