Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hidayathamir/go-user
Golang microservice template. Clean Architecture, HTTP and GRPC Example, isolation integration tests, isolation unit tests, and database connection pooling.
https://github.com/hidayathamir/go-user
clean-architecture clean-code go golang grpc integration-testing microservice repository-pattern rest-api unit-testing
Last synced: 10 days ago
JSON representation
Golang microservice template. Clean Architecture, HTTP and GRPC Example, isolation integration tests, isolation unit tests, and database connection pooling.
- Host: GitHub
- URL: https://github.com/hidayathamir/go-user
- Owner: Hidayathamir
- Created: 2024-03-08T12:43:50.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-25T22:19:56.000Z (10 months ago)
- Last Synced: 2024-11-30T13:50:21.441Z (2 months ago)
- Topics: clean-architecture, clean-code, go, golang, grpc, integration-testing, microservice, repository-pattern, rest-api, unit-testing
- Language: Go
- Homepage:
- Size: 209 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-user
Golang microservice template. Clean Architecture, HTTP and GRPC Example, isolation integration tests, isolation unit tests, and database connection pooling.
# Features
- [x] Clean architecture implementation.
- [x] Controller, usecase, repository layer separation.
- [x] HTTP and GRPC example in controller layer.
- [x] Isolation integration tests using containers.
- [x] Isolation unit tests with mock support.
- [x] Database connection pooling.# Code structure
```
├── config/ contains the application configuration.
├── internal/
│ ├── app/ contains the application starter.
│ ├── controller/ contains the presentation layer and handles incoming requests from clients.
│ │ ├── http/
│ │ ├── grpc/
│ ├── usecase/ contains the application business layer.
│ ├── repo/ contains the data access layer.
│ ├── entity/ contains the domain model.
├── go.mod
├── go.sum
├── main.go
├── README.md
```For presentation layer: Some people call it controller (in our case), delivery, transport, or handler.
For business layer: Some people call it usecase (in our case), service, domain, or application.
For data access layer: Some people call it repo/repository (in our case), or persistence.
# Get Started
## Run application
Run postgres container.
```
make compose-up-postgres
```Run go app.
```
make go-run
```## Run test
Test can be without the need to run the application.
Run test integration.
```
make go-test-integration
```Run test unit.
```
make go-test-unit
```## Run for deployment
For deployment. Run postgres container also build and run go app container.
```
make deploy
```## Other command
See `Makefile`.