Upgrade to Pro — share decks privately, control downloads, hide ads and more …

KAUCHE Loves Go

Avatar for Yuki Ito Yuki Ito
October 26, 2022

KAUCHE Loves Go

Avatar for Yuki Ito

Yuki Ito

October 26, 2022
Tweet

More Decks by Yuki Ito

Other Decks in Programming

Transcript

  1. Agenda • Why Go? • Go at KAUCHE • Code

    Generation • Clean Architecture • From Modular Monolith To Microservice
  2. Agenda • Why Go? • Go at KAUCHE • Code

    Generation • Clean Architecture • From Modular Monolith To Microservice
  3. Why Go? • Simplicity • Ecosystem • e.g. gRPC, google-cloud-go

    etc... • Used by Many Cloud Native Softwares • e.g. Kubernetes, Istio etc... • Goroutines & Channel
  4. Agenda • Why Go? • Go at KAUCHE • Code

    Generation • Clean Architecture • From Modular Monolith To Microservice
  5. Code Generation - gRPC gRPC is a modern open source

    high performance Remote Procedure Call (RPC) framework that can run in any environment. https://grpc.io/
  6. Code Generation - gRPC rpc GetProduct(GetProductRequest) returns (GetProductResponse) { option

    (google.api.http) = { get: "/..." }; } type CustomerServiceServer interface { GetProduct(context.Context, *GetProductRequest) (*GetProductResponse, error) // ... } Generate (protoc) Protocol Bu ff ers Go
  7. Code Generation - GraphQL GraphQL is a query language for

    APIs and a runtime for ful fi lling those queries with your existing data. https://graphql.org/
  8. Code Generation - GraphQL GraphQL Schema Generate (gqlgen) type QueryResolver

    interface { Products(ctx context.Context) ([]*Product, error) // ... } Go
  9. Code Generation - Database Fully managed relational database with unlimited

    scale, strong consistency, and up to 99.999% availability. https://cloud.google.com/spanner
  10. Code Generation - Database CREATE TABLE Products ( ProductId STRING(36)

    NOT NULL, -- ... ) PRIMARY KEY(ProductId); Database Schema Generate (yo) func FindProduct(ctx context.Context, db YORODB, productID string) (*Product, error) { // ... } Go
  11. Agenda • Why Go? • Go at KAUCHE • Code

    Generation • Clean Architecture • From Modular Monolith To Microservice
  12. Clean Architecture • Entities • Business Objects • Use Cases

    • Application Business Rules • Drivers • gRPC • Cloud Spanner • Identity Platform • Event System • ...
  13. Agenda • Why Go? • Go at KAUCHE • Code

    Generation • Clean Architecture • From Modular Monolith To Microservice
  14. Modular Monolith Almost all the cases where I've heard of

    a system that was built as a microservice system from scratch, it has ended up in serious trouble. ... you shouldn't start a new project with microservices, even if you're sure your application will be big enough to make it worthwhile. MonolithFirst Martin Fowler https://martinfowler.com/bliki/MonolithFirst.html
  15. Modular Monolith ✅ Pros - Single Deployment Unit - Simple

    Design ❌ Cons - Independence - Autonomy
  16. Architecture: 2022 ~ Commerce gRPC API Gateway Social GraphQL Customer

    GraphQL Federation (Apollo Router) Commerce GraphQL Social gRPC Platfrom Business
  17. Agenda • Why Go? • Go at KAUCHE • Code

    Generation • Clean Architecture • From Modular Monolith To Microservice