GitHub - go-eagle/eagle: π¦ A Go framework for the API or Microservice (original) (raw)
π¦ eagle
A Go framework suitable for rapid business development, which can quickly build API services or Web sites.
English | δΈζζζ‘£
Features
- API framework gin
- RPC framework gRPC
- Configuration viper
- Logging component zap
- Database ORM component gorm | MongoDB
- Search component Elasticsearch
- Cache component go-redis, ristretto
- Message Queue Rabbitmq | redis
- Authentication JWT
- Parameter Validator validator
- Scheduled tasks cron
- Metrics monitoring prometheus, grafana
- Distributed Tracing opentelemetry
- Service registration and discovery etcd | consul | nacos
- Unit Test GoConvey
- Lint GolangCI-lint
- CI/CD GitHub Actions, docker, kubernetes
Framework Layered Architecture
Logic Layered Architecture
Eagle utilizes a classic layered structure and employs the Wire dependency injection framework to enhance modularity and reduce coupling between components.
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
CHANGELOG
Who is using
Discussion
- Issue: https://github.com/go-eagle/eagle/issues
- Discord: https://discord.com/channels/968369660900814869
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!
- Fork the repository to your own GitHub account.
- Create a new branch for your changes.
- Make your changes to the code.
- Commit your changes and push the branch to your forked repository.
- Open a pull request on our repository.
Stargazers over time
License
MIT. See the LICENSE file for details.


