Skip to content

ArcGo Documentation

ArcGo

ArcGo is a modular Go backend infrastructure toolkit. It is package-oriented, supports incremental adoption, and allows inter-package composition.

Quick Start

go get github.com/DaiYuANg/arcgo/{package}

Core Features

  • Modular Organization - Split by package, adopt incrementally, and compose with inter-package dependencies (for example collectionx, observabilityx)
  • Type Safety - Strongly typed APIs built with Go generics and explicit interfaces
  • Experimental Stage - The project is under active iteration; APIs and behavior may still change
  • Dependency-Transparent - Not locked to one framework, but introduces required dependencies per feature
  • Observability Extensions - Optional OpenTelemetry and Prometheus integration via observabilityx

Package Overview

Typical Combinations

API Service Baseline

httpx + configx + logx

Modular App Baseline

dix + configx + logx

Event-Driven Architecture

eventx + logx

Data-Intensive Tools

collectionx + configx

Code Examples

Configuration Management

type AppConfig struct {
    Name string `validate:"required"`
    Port int    `validate:"required,min=1,max=65535"`
}

cfg, err := configx.LoadTErr[AppConfig](
    configx.WithDotenv(),
    configx.WithFiles("config.yaml"),
    configx.WithEnvPrefix("APP"),
)

Event Bus

type UserCreated struct { ID int }
func (e UserCreated) Name() string { return "user.created" }

bus := eventx.New()
eventx.Subscribe(bus, func(ctx context.Context, evt UserCreated) error {
    fmt.Println("User created:", evt.ID)
    return nil
})
bus.Publish(context.Background(), UserCreated{ID: 42})

HTTP Service

s := httpx.NewServer(
    httpx.WithAdapter(std.New()),
    httpx.WithBasePath("/api"),
)

httpx.Get(s, "/health", func(ctx context.Context, input *struct{}) (*HealthOutput, error) {
    return &HealthOutput{Body: struct{ Status string }{Status: "ok"}}, nil
})

Why Choose ArcGo?

Design Philosophy

ArcGo is not a heavy framework, but a set of carefully designed utility libraries. Each package follows these principles:

  • Single Responsibility - Each package focuses on solving one type of problem
  • Interface Abstraction - Based on interfaces rather than implementations, easy to test and replace
  • Composition First - Components are composable and may rely on shared base packages (for example collectionx/observabilityx)
  • Documentation First - Complete documentation and example code

Getting Started

Choose the package you need:

  • Need container/data utilities: Start with collectionx
  • Need authentication/authorization: Start with authx
  • Need configuration management: Start with configx
  • Need modular app composition and typed lifecycle management: Start with dix
  • Need event bus: Start with eventx
  • Need HTTP routing: Start with httpx
  • Need logging: Start with logx
  • Need observability: Start with observabilityx

Links