Authentication microservice on golang

Start application

To start application run docker-compose up command in the root folder


The service supports the following endpoints:

POST /users/ – create new user

Request Body example:

  "email":"[email protected]"

Response Body example:

    "id": "62b1e8157fd90928aceb9f92",
    "username": "user",
    "email":"[email protected]"


type Config struct {
	IsDebug bool `env:"IS_DEBUG" env-default:"true"`
	Listen  struct {
		BindIP string `env:"BIND_IP" env-default:""`
		Port   string `env:"PORT" env-default:"8080"`
	MongoDB struct {
		Username string `env:"MONGO_USERNAME"`
		Password string `env:"MONGO_PASSWORD"`
		Host     string `env:"MONGO_HOST" env-required:"true"`
		Port     string `env:"MONGO_PORT" env-required:"true"`
		Database string `env:"MONGO_DATABASE" env-required:"true"`
	JWT struct {
		SecretKey           string `env:"JWT_SECRET"`
		AccessTokenExpTime  int    `env:"ACCESS_TOKEN_EXP_MINUTES" env-default:"15"`
		RefreshTokenExpTime int    `env:"REFRESH_TOKEN_EXP_HOURS" env-default:"48"`
	Bcrypt struct {
		Cost string `env:"BCRYPT_COST" env-default:"10"`


View Github