Skip to main content

Examples

Kratos provides a wealth of sample code/projects for reference

Components' Usage

Configuration

  • config example of using config to parse configuration files

Service Discovery and Registration

  • consul example of service registration on the server side and service registration on the client side using the consul plug-in.
  • etcd example of service registration on the server side and service registration on the client side using the etcd plug-in.
  • kube example of service registration on the server side and service registration on the client side using the kubernetes plug-in.

HTTP

  • gin example of use gin as the router.
  • handler example of use basic http handler.
  • health example of health check API.
  • mux example of use mux as the router.
  • static example of static files serving.
  • upload example of file upload.

RPC

  • helloworld example of remote calls using http and gRPC.

Trace

  • traces example of use jaeger for tracing.

WebSocket

  • ws example of file WebSocket.

Complete Projects

  • blog a simple CRUD project which includes MySQL Redis integration.

  • beer-shop an online shop application, mono-repo microservices demo for kratos.