go-yogan-framework

module
v0.0.0-...-fb81f76 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2026 License: MIT

README

Yogan Framework

中文 | English

No duplicate code, no infrastructure headaches. Register components and they just work. Config auto-loads. Tracing out of the box. You write business logic, the framework handles the rest.

📖 Documentation: go-yogan-doc-portal.pages.dev

⚠️ Note: This project is under active development. APIs may change.

Installation

go get github.com/KOMKZ/go-yogan-framework

Scaffolding Tool: go-ygctl

One command, project ready:

# Install
go install github.com/KOMKZ/go-ygctl@latest

# Create HTTP project
go-ygctl new http my-api

# Create gRPC / CLI / Cron project
go-ygctl new grpc my-service
go-ygctl new cli my-tool
go-ygctl new cron my-scheduler

Generated projects are complete and runnable: config files, routes, health checks, Docker Compose included.

List available components:

go-ygctl component list

Get component integration guide:

go-ygctl component add database
go-ygctl component add redis
go-ygctl component add kafka

No need to dig through docs—the CLI tells you how to integrate.

Core Components

Component Description
application Application lifecycle management (HTTP/gRPC/CLI/Cron)
component Component interface definitions
config Configuration loading (YAML + environment variables)
logger Structured logging (Zap)
database GORM database connection pool
redis Redis client management
grpc gRPC server/client
kafka Kafka producer/consumer
auth Authentication service (password/OAuth)
jwt JWT token management
middleware HTTP middleware (CORS/TraceID/logging)
telemetry OpenTelemetry distributed tracing
health Health checks
limiter Rate limiting (token bucket/sliding window)
breaker Circuit breaker
retry Retry strategies

Quick Start

package main

import (
    "github.com/KOMKZ/go-yogan-framework/application"
    "github.com/KOMKZ/go-yogan-framework/database"
    "github.com/KOMKZ/go-yogan-framework/redis"
)

func main() {
    app := application.New("./configs", "MY_APP", nil)
    
    app.Register(
        database.NewComponent(),
        redis.NewComponent(),
    )
    
    app.Run()
}

License

MIT License

Directories

Path Synopsis
Package application provides a generic application startup framework BaseApplication is the core abstraction for all application types (HTTP/CLI/Cron)
Package application provides a generic application startup framework BaseApplication is the core abstraction for all application types (HTTP/CLI/Cron)
Package breaker provides circuit breaker functionality
Package breaker provides circuit breaker functionality
Package cache provides a caching orchestration layer implementation Supports multi-storage backend, event-driven failure, centralized configuration management
Package cache provides a caching orchestration layer implementation Supports multi-storage backend, event-driven failure, centralized configuration management
Package component provides interface definitions for components This is the lowest level package, which does not depend on any business packages to avoid circular dependencies.
Package component provides interface definitions for components This is the lowest level package, which does not depend on any business packages to avoid circular dependencies.
Provides database management and Repository infrastructure
Provides database management and Repository infrastructure
Package di provides dependency injection support based on samber/do
Package di provides dependency injection support based on samber/do
Package errcode provides the basic types and functionalities for hierarchical error codes Error code format: MMBBBB (MM = module code 2 digits, B BBBB = business code 4 digits)
Package errcode provides the basic types and functionalities for hierarchical error codes Error code format: MMBBBB (MM = module code 2 digits, B BBBB = business code 4 digits)
Provides unified health check capabilities
Provides unified health check capabilities
Package httpx provides unified handling of HTTP requests/responses
Package httpx provides unified handling of HTTP requests/responses
types
Package types 提供 HTTP 请求/响应的通用类型
Package types 提供 HTTP 请求/响应的通用类型
Package limiter provides rate limiting functionality
Package limiter provides rate limiting functionality
src/pkg/logger/config.go
src/pkg/logger/config.go
The package swagger provides capabilities for generating and displaying Swagger/OpenAPI documentation Based on swaggo/swag for documentation generation driven by comments
The package swagger provides capabilities for generating and displaying Swagger/OpenAPI documentation Based on swaggo/swag for documentation generation driven by comments
Package validator provides unified parameter validation and error conversion
Package validator provides unified parameter validation and error conversion

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL