https://github.com/sergicanet9/scv-go-tools
Toolkit for building REST and gRPC APIs in Go, structured around clean architecture principles.
https://github.com/sergicanet9/scv-go-tools
clean-architecture go grpc mongodb observability postgresql restapi
Last synced: 6 months ago
JSON representation
Toolkit for building REST and gRPC APIs in Go, structured around clean architecture principles.
- Host: GitHub
- URL: https://github.com/sergicanet9/scv-go-tools
- Owner: sergicanet9
- License: mit
- Created: 2021-06-26T08:46:40.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-12-06T10:06:06.000Z (7 months ago)
- Last Synced: 2026-01-12T03:01:39.009Z (6 months ago)
- Topics: clean-architecture, go, grpc, mongodb, observability, postgresql, restapi
- Language: Go
- Homepage:
- Size: 152 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# scv-go-tools v4


[](https://pkg.go.dev/github.com/sergicanet9/scv-go-tools/v4)
Toolkit for building REST and gRPC APIs in Go, structured around clean architecture principles.
## 🚀 Included packages
| Package | Description |
|------------------ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| api/middlewares | HTTP middlewares for panic recovery, JWT authentication, role-based authorization, and request/response logging. |
| api/interceptors | gRPC interceptors providing equivalent functionality to HTTP middlewares, supporting both unary and stream gRPC calls. |
| api/utils | Utility functions for sending HTTP and gRPC success/error responses with proper status code management, and JSON unmarshalling from files with support for parsing time.Duration. |
| infrastructure | Connection management for MongoDB and PostgreSQL, a PostgreSQL migration runner, and a generic MongoDB repository implementation. |
| mocks | Mock creation for MongoDB and PostgreSQL repositories to facilitate unit testing. |
| observability | New Relic integration for APM and log forwarding, including a singleton logger. |
| repository | Interface for the Repository pattern defining CRUD operations, designed for multiple storage implementations and extensibility through composition. |
| wrappers | Custom type wrappers including specialized error types for simpler error code mapping and a gRPC Server Stream wrapper for enabling context injection. |
| testutils | Convenient utility functions to simplify testing. |
## ⚙️ Installation
Run the following command inside a Go project to add the library as a dependency:
```
go get github.com/sergicanet9/scv-go-tools/v4
```
## ✅ Testing
### Run all unit tests with code coverage
```
make test-unit
```
### View coverage report
```
make cover
```
## 📝 Usage examples
Check out [go-hexagonal-api](https://github.com/sergicanet9/go-hexagonal-api) and [go-microservices-demo](https://github.com/sergicanet9/go-microservices-demo) for practical examples of how to use the library with both REST and gRPC APIs.
## ✍️ Author
Sergi Canet Vela
## ⚖️ License
This project is licensed under the terms of the MIT license.