README ¶
golang-rest-api
A sample production grade REST API application written in Golang with minimal business functionalities but should have all non-functional areas covered up.
- Microservices
- Docker Containers
- REST Api + GRPC for internal Communication
- Distributed logging
- Distributed tracing
- Monitoring (grafana + Prometheus)
- Performance analysis(pprof + benchmark testing + autocannon)
- SQL database with Auto Migration and Seeding
- Debugging capacity with inspector
- Load .env files for configuration settings
- 80% Unit testing coverage
- Mocks (mockery)
- Swagger OpenApi & Markdown Docs
- ThunderClient requests for Testing APIs
- Makefile
- Docker-Compose for local running
- Enforcing Coding standards with
https://github.com/tekwizely/pre-commit-golang
TODO: AWS Cloud Specifics
- NoSql database
- S3 Storage
- AWS SnS/SQS
- ngrok for local dev testing
- Configurations management using SOPs & AWS KMS
Generate Swagger documentation for the Server
- Run command
make generate
Test Application Server
- Run command
make test
Build Application Server
- Run command
make build
Run Application Server
- Run command
make run
Reload Application Server
- Run command
make reload
When we run above run or reload command, the db container and app container will be up and running then we can access APIs provided by the App
-
The terminal shell looks like this
-
The swagger documentation UI will be available at
http://localhost:8080/swagger/index.html
-
The PProf will be avilable at
http://localhost:8080/debug/pprof
-
The Inspector UI will be available at
hhttp://localhost:8080/_inspector
-
The metrics api will be available at
hhttp://localhost:8080/metrics
-
The Newrelic UI will look like this
-
The Thunder-Client dashboard will look like this
-
The docker state will look like this
-
The Coding standard will be enforeced while commiting the code to the repository
Documentation ¶
There is no documentation for this package.
Directories ¶
Path | Synopsis |
---|---|
pkg
|
|
app/usecases/diner
Package diner provides the use case for diner
|
Package diner provides the use case for diner |
app/usecases/menu
Package menu provides the use case for menu
|
Package menu provides the use case for menu |
app/usecases/order
Package order provides the use case for order
|
Package order provides the use case for order |
domain/diner
Package diner contains the business logic for the diner entity
|
Package diner contains the business logic for the diner entity |
domain/errors
Package errors defines the domain errors used in the application.
|
Package errors defines the domain errors used in the application. |
domain/menu
Package menu contains the business logic for the menu entity
|
Package menu contains the business logic for the menu entity |
domain/order
Package order contains the business logic for the order entity
|
Package order contains the business logic for the order entity |
infrastructure/mocks/repository
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
infrastructure/repository/diner
Package diner contains the repository implementation for the diner entity
|
Package diner contains the repository implementation for the diner entity |
infrastructure/repository/menu
Package menu contains the repository implementation for the menu entity
|
Package menu contains the repository implementation for the menu entity |
infrastructure/repository/order
Package order contains the repository implementation for the order entity
|
Package order contains the repository implementation for the order entity |
infrastructure/rest/adapter
Package adapter is a layer that connects the infrastructure with the application layer
|
Package adapter is a layer that connects the infrastructure with the application layer |
infrastructure/rest/controllers
Package controllers contains the common functions and structures for the controllers
|
Package controllers contains the common functions and structures for the controllers |
infrastructure/rest/controllers/diner
Package diner contains the diner controller
|
Package diner contains the diner controller |
infrastructure/rest/controllers/errors
Package errors contains the error handler controller
|
Package errors contains the error handler controller |
infrastructure/rest/controllers/menu
Package menu contains the menu controller
|
Package menu contains the menu controller |
infrastructure/rest/controllers/order
Package order contains the order controller
|
Package order contains the order controller |
infrastructure/rest/middlewares
Package middlewares contains the middlewares for the rest api
|
Package middlewares contains the middlewares for the rest api |
infrastructure/rest/routes
Package routes contains all routes of the application
|
Package routes contains all routes of the application |