Skip to content

GStones/moke-layout

Repository files navigation

Moke Project Template

Go Report Card Go Reference Release

Introduction

Moke is a template project for moke-kit that helps you quickly build gRPC/TCP/HTTP microservices with IoC (Inversion of Control). The template provides:

  • Interactive command-line client
  • Load testing tools
  • Protocol buffer management:
    • Proto file generation
    • Proto file publishing to buf Schema Registry
    • SDK generation for multiple languages

Quick Start

Deploy Infrastructure

# Optional: Create ./deployment/docker-compose/.env for custom configuration
docker compose -f ./deployment/docker-compose/infrastructure.yaml up -d

Run Service

go run ./cmd/demo/service/main.go

Testing

Integration Testing

  1. Build the interactive client:
go build -o client.exe ./cmd/demo/client/main.go
  1. Run the client:
# View available commands
./client.exe help

# Run specific clients
./client.exe grpc  # gRPC client
./client.exe tcp   # TCP client

Note: For HTTP testing, use Postman to connect to localhost:8081

Load Testing

  1. Install k6
  2. Run the tests:
k6 run ./tests/demo/demo.js

Protocol Buffer Management

Prerequisites

Working with Proto Files

  1. Generate proto files:
buf generate
  1. Publish to buf Schema Registry:
# Login to BSR (requires account)
# See: https://buf.build/docs/tutorials/getting-started-with-bsr#prerequisites
buf registry login username

# Push proto files
buf push

Generate SDKs

  1. Visit https://buf.build/gstones/moke-layout/sdks
  2. Select your target language
  3. Follow the provided instructions to import the SDK into your project

About

template for moke-kit

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors