All Projects → pthethanh → micro

pthethanh / micro

Licence: MIT license
A simple tool kit for building microservices.

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to micro

Grpc Jersey
gRPC<->Jersey bridge
Stars: ✭ 23 (+53.33%)
Mutual labels:  grpc, grpc-gateway
Tesla
Tesla is a gateway service that provides dynamic routing,waf,support spring cloud,gRPC,DUBBO and more.
Stars: ✭ 109 (+626.67%)
Mutual labels:  grpc, grpc-gateway
Danby
A webserver that's also a grpc proxy for browsers
Stars: ✭ 26 (+73.33%)
Mutual labels:  grpc, grpc-gateway
Grpc Example
An example of using Go gRPC and tools from the greater gRPC ecosystem together with the GoGo Protobuf Project.
Stars: ✭ 352 (+2246.67%)
Mutual labels:  grpc, grpc-gateway
Micro Starter Kit
Cloud Native GoLang Microservices - gRPC, GraphQL
Stars: ✭ 167 (+1013.33%)
Mutual labels:  grpc, micro
Grpc Websocket Proxy
A proxy to transparently upgrade grpc-gateway streaming endpoints to use websockets
Stars: ✭ 395 (+2533.33%)
Mutual labels:  grpc, grpc-gateway
Grpc Hello World
An example of gRPC+grpc-gateway
Stars: ✭ 104 (+593.33%)
Mutual labels:  grpc, grpc-gateway
docker-protobuf
An all-inclusive protoc Docker image
Stars: ✭ 105 (+600%)
Mutual labels:  grpc, grpc-gateway
Go Grpc
A simpler grpc framework
Stars: ✭ 133 (+786.67%)
Mutual labels:  grpc, micro
Protoeasy Go
Simpler usage of protoc. Deprecated.
Stars: ✭ 129 (+760%)
Mutual labels:  grpc, grpc-gateway
Go Project Sample
Introduce the best practice experience of Go project with a complete project example.通过一个完整的项目示例介绍Go语言项目的最佳实践经验.
Stars: ✭ 344 (+2193.33%)
Mutual labels:  grpc, micro
Clay
Proto-first minimal server platform for gRPС+REST+Swagger APIs
Stars: ✭ 212 (+1313.33%)
Mutual labels:  grpc, grpc-gateway
Turbo
A lightweight microservice tool, turn your grpc|thrift APIs into HTTP APIs!
Stars: ✭ 275 (+1733.33%)
Mutual labels:  grpc, grpc-gateway
Grpc Gateway Generator
A script to generate a ready to use grpc-gateway with swagger, by just providing the path to the protos and a simple configuration file.
Stars: ✭ 18 (+20%)
Mutual labels:  grpc, grpc-gateway
Ovpm
OpenVPN Management Server - Effortless and free OpenVPN server administration
Stars: ✭ 256 (+1606.67%)
Mutual labels:  grpc, grpc-gateway
Micro Mesh
gRPC微服务架构实践
Stars: ✭ 50 (+233.33%)
Mutual labels:  grpc, grpc-gateway
Grpc Gateway
The gRPC-Gateway is a plugin of the Google protocol buffers compiler protoc. It reads protobuf service definitions and generates a reverse-proxy server which translates a RESTful HTTP API into gRPC. This server is generated according to the google.api.http annotations in your service definitions.
Stars: ✭ 12,223 (+81386.67%)
Mutual labels:  grpc, grpc-gateway
Rules protobuf
Bazel rules for building protocol buffers and gRPC services (java, c++, go, ...)
Stars: ✭ 206 (+1273.33%)
Mutual labels:  grpc, grpc-gateway
protoc-gen-grpc-gateway-ts
protoc-gen-grpc-gateway-ts is a Typescript client generator for the grpc-gateway project. It generates idiomatic Typescript clients that connect the web frontend and golang backend fronted by grpc-gateway.
Stars: ✭ 68 (+353.33%)
Mutual labels:  grpc, grpc-gateway
Sitko.Core
Sitko.Core is a set of libraries to help build .NET Core applications fast
Stars: ✭ 46 (+206.67%)
Mutual labels:  grpc

micro

Actions Status GoDoc GoReportCard

Just a simple tool kit for building microservices.

What is micro?

micro is a Go tool kit for enterprise targeted for microservices or well designed monolith application. It doesn't aim to be a framework, but just a microservices tool kit/library for easily and quickly build API applications.

micro's vision is to be come a good tool kit for beginner/intermediate developers and hence it should be:

  • Easy to use.
  • Compatible with Go, gRPC native libraries.
  • Come with default ready to use features.
  • Backward compatible.

I expect micro requires no more than 15 minutes for a beginner/intermediate developer to be able to use the tool kit effectively. This means micro will come with lots of useful default features, but at the same time provide developers ability to provide their alternatives.

micro is built around gRPC. It exposes both gRPC and REST API over 1 single port using grpc-gateway, with default ready to use logger, metrics, health check APIs.

Currently micro comes with a collection of plugins that can be found here

Getting Started

Start your own

Create new gRPC service

func (s *service) SayHello(ctx context.Context, req *pb.HelloRequest) (*pb.HelloReply, error) {
    return &pb.HelloReply{
        Message: "Hello " + req.GetName(),
    }, nil
}

// Register implements server.Service interface
// It registers gRPC APIs with gRPC server.
func (s *service) Register(srv *grpc.Server) {
    pb.RegisterGreeterServer(srv, s)
}

// RegisterWithEndpoint implements server.EndpointService interface
// It is used to expose REST API using gRPC Gateway.
func (s *service) RegisterWithEndpoint(ctx context.Context, mux *runtime.ServeMux, addr string, opts []grpc.DialOption) {
    pb.RegisterGreeterHandlerFromEndpoint(ctx, mux, addr, opts)
}

Start a simple server, get configurations from environment variables.

package main

import (
    "github.com/pthethanh/micro/server"
)

func main() {
    srv := &service{}
    if err := server.ListenAndServe(srv); err != nil {
        panic(err)
    }
}

More complex with custom options.

package main

import (
    "github.com/pthethanh/micro/log"
    "github.com/pthethanh/micro/server"
)

func main() {
    srv := server.New(
        server.FromEnv(),
        server.PProf(""),
        server.Address(":8088"),
        server.JWT("secret"),
        server.Web("/", "web", "index.html"),
        server.Logger(log.Fields("service", "my_service")),
        server.CORS(true, []string{"*"}, []string{"POST"}, []string{"http://localhost:8080"}),
    )
    if err := srv.ListenAndServe( /*services...*/ ); err != nil {
        panic(err)
    }
}

See doc for more options.

Features

Currently, micro supports following features:

Server

  • Exposes both gRPC and REST in 1 single port.
  • Internal APIs:
    • Prometheus metrics.
    • Health checks.
    • Debug profiling.
  • Context logging/tracing with X-Request-Id/X-Correlation-Id header/metadata.
  • Authentication interceptors
  • Other options: CORS, HTTP Handler, Serving Single Page Application, Interceptors,...

See doc and examples for more detail.

Auth

  • Authenticator interface.
  • JWT
  • Authenticator, WhiteList, Chains.
  • Interceptors for both gRPC & HTTP

See doc for more detail.

Broker

  • Standard message broker interface.
  • Memory broker.
  • NATS plugin.
  • More plugins can be found here.

See doc for more detail.

Cache

  • Standard cache service interface.
  • Memory cache.
  • Redis plugin.
  • More plugins can be found here.

See doc for more detail.

Config

  • Standard config interface.
  • Config from environment variables.
  • Config from file and other options.

See doc for more detail.

Health

  • Health check for readiness and liveness.
  • Utilities for checking health.

See doc for more detail.

Log

  • Standard logger interface.
  • Logrus implementation.
  • Context logger & tracing using X-Request-Id and X-Correlation-Id
  • Interceptors for HTTP & gRPC.

See doc for more detail.

Util

  • Some utilities that might need during the development using micro.

See doc for more detail.

Interceptors and Other Options

micro is completely compatible with Go native and gRPC native, hence you can use external interceptors and other external libraries along with the provided options.

Interceptors: go-grpc-middleware

See examples for more detail.

Why a new standard libraries?

micro is inspired by go-kit and go-micro.

go-kit is a good tool kit, but one of the thing I don't like go-kit is its over use of interface{} which cause a lot of unnecessary type conversions and some of other abstractions in the libraries which are not compatible with Go native libraries. Although go-kit is very flexible, it's a little bit hard to use for beginner/intermediate developers. It has a lot of options for developers to choose and hence hard to force everyone inside a company to use the same set of standards.

go-micro is a great framework for microservices and very well designed. And it influences micro very much, but there are some coding styles that I don't like go-micro, that's why I made micro for myself.

Update: go-micro is now moved to https://github.com/asim/go-micro and it's very well designed. I recommend trying it first to see if it fits your needs.

Documentation

  • See doc for package and API descriptions.
  • Examples can be found in the examples directory.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].