Skip to content

GStones/moke-kit

Repository files navigation

moke-kit

Go Report Card Go Reference Release

English | 中文

What is moke-kit?

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.

Diagram

moke-kit

Layers

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
Loading

Features

  • Dependency Injection: Uses uber/fx for inversion of control
  • Security:
  • Built-in Middleware: Rate limiting, OpenTelemetry, authentication, logging, panic recovery, and more
  • Caching:
  • Development Tools:
    • Command-line client for independent testing
    • Single command generation of proto, gRPC, gateway, Swagger, and client code using buf

Built-in Kits

Getting Started

  1. Install gonew:
go install golang.org/x/tools/cmd/gonew@latest
  1. Create a new project:
gonew github.com/gstones/moke-layout your.domain/myprog