GitHub - go-eagle/eagle: πŸ¦… A Go framework for the API or Microservice (original) (raw)

πŸ¦… eagle

GitHub Workflow Status codecov GolangCI godoc Gitter OpenTracing Badge Go Report Card gitmoji License

A Go framework suitable for rapid business development, which can quickly build API services or Web sites.
English | δΈ­ζ–‡ζ–‡ζ‘£

Features

Framework Layered Architecture

eagle-framework-diagram

Logic Layered Architecture

Eagle utilizes a classic layered structure and employs the Wire dependency injection framework to enhance modularity and reduce coupling between components.

Leagle Layout Arch

Directory Structure

eagle-layout/ β”œβ”€β”€ api/ # proto files and service interface definitions β”‚ β”œβ”€β”€ helloworld/ # example or basic service proto definitions β”‚ └── user/ # user-related proto definitions β”œβ”€β”€ bin/ # compiled binary files β”œβ”€β”€ cmd/ # service entry points, main.go and startup logic β”‚ β”œβ”€β”€ server/ # main service entry β”‚ β”œβ”€β”€ consumer/ # message consumer service entry β”‚ └── gen/ # code generation entry β”œβ”€β”€ config/ # configuration files for multiple environments β”œβ”€β”€ deploy/ # deployment files, e.g. Dockerfile, K8s configs β”œβ”€β”€ internal/ # internal implementation, not for external use β”‚ β”œβ”€β”€ dal/ # data access layer β”‚ β”‚ β”œβ”€β”€ db/ # database related code β”‚ β”‚ β”‚ β”œβ”€β”€ model/ # data model definitions β”‚ β”‚ β”‚ β”œβ”€β”€ method/ # custom query methods β”‚ β”‚ β”‚ └── query/ # gorm/gen generated query methods β”‚ β”‚ β”œβ”€β”€ cache/ # cache related code β”‚ β”‚ └── rpc/ # RPC/HTTP client code β”‚ β”œβ”€β”€ ecode # define error code β”‚ β”œβ”€β”€ handler # receive user request β”‚ β”œβ”€β”€ repository/ # repository layer, wraps data access interfaces β”‚ β”œβ”€β”€ routers/ # route and middleware registration β”‚ β”œβ”€β”€ service/ # business logic layer β”‚ └── event/subscribe/ # event subscription, e.g. MQ handlers β”œβ”€β”€ logs/ # log output directory β”œβ”€β”€ scripts/ # script files β”œβ”€β”€ third_party/ # third-party dependencies or proto files β”œβ”€β”€ .github/ # GitHub workflows β”œβ”€β”€ .gitignore # Git ignore file β”œβ”€β”€ CHANGELOG.md # changelog β”œβ”€β”€ LICENSE # license β”œβ”€β”€ Makefile # build, test, code generation commands β”œβ”€β”€ README.md # project documentation └── openapi.yaml # OpenAPI specification file

Installtion CLI

GOPROXY="https://goproxy.cn,direct"

go >= 1.16

go install github.com/go-eagle/eagle/cmd/eagle@latest

go < 1.16

go get github.com/go-eagle/eagle/cmd/eagle

Quick Start

gen a server with http and gRPC

eagle new eagle-demo

or

eagle new github.com/foo/eagle-demo

install dependence

go mod tidy

run

make run

Documentation

https://go-eagle.org/

CHANGELOG

Who is using

Discussion

Microservice Roadmap

Microservice-roadmap

Contributing

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

Stargazers over time

Stargazers over time

License

MIT. See the LICENSE file for details.