REST APIs of the future with go-kit
Tsvetan Dimitrov
Agenda
Onion
vs
Layered
Architecture
go-kit
Architecture
Features
Reservation System Demo Application
Overview
Structured
Logging
Error Handling
API Documentation
Onion vs Layered Architecture
Layered Architecture
violates the
Dependency Inversion Principle (DIP)
, because the
Domain Library
depends on the
Data Access Library
.
Dependency Inversion Principle
Abstractions should not depend upon details. Details should depend upon abstractions.
Onion Architecture
Dependency Inversion Principle (DIP)
is applied -
the
details (UI, Data Access)
depend on the
abstractions (the Domain Model)
.
Go-kit
Overview
Microservices Toolkit
High Separation of Concerns
"Few opinions, lightly held"
Transports
,
Endpoints
,
Services
Extensible via
Middleware
Features
Built-in
HTTP
and
gRPC
transports
Built-in
Middlewares
:
Auth
Logs
Metrics
Rate Limiting
Service Discovery
Distributed Tracing
Go-kit Onion Architecture
Reservation System Demo Application
Overview
Booking system
REST
API
CRUD
operations
Database:
SQLITE
Entity Relationship Diagram
Talk is cheap, show me the code?!?!!
What's next?
Distributed Tracing
+
go-kit
integration
gRPC
transport in
go-kit