How to design & develop REST microservices in Golang (Go)
4.5 (295 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
3,201 students enrolled

How to design & develop REST microservices in Golang (Go)

All you need to integrate SQL & NoSQL databases, search engines and all the tools that you need in your REST API.
4.5 (295 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
3,201 students enrolled
Created by Federico León
Last updated 4/2020
English [Auto]
Current price: $69.99 Original price: $99.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 20.5 hours on-demand video
  • 1 article
  • 2 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • How to structure and organize your microservice.
  • Domain Driven Development.
  • Hexagonal architecture applied.
  • MySQL integration and configuration.
  • Integrate Cassandra DB in your microservices.
  • Elasticsearch integration and configuration.
  • Logging to standard output and log files.
  • DAO pattern implementation.
  • How to build, publish and use a custom Go library.
  • Testing all the layers of your application.
  • How dependencies work in Go.
Course content
Expand all 48 lectures 20:40:10
+ Introducción
3 lectures 18:19

A brief description about what we're going to build during this course.

Preview 07:34

In this video we're looking at a quick preview on what we're going to build, the approaches, the technologies, the patterns, the tools, everything so you can have a good idea about what you're about to learn during this course.

Preview 10:14

In this lecture I'm just sharing the course repositories so you can take a look at them from day one. This is all we're going to do during this course! Don't feel overwhelmed, I can ensure you that by the end of this course you'll dominate all of this! Enjoy and let's Go :)

These are all of the repos!
+ Creating our projects: Users API
6 lectures 02:42:24

Creating all of our projects in Github.

Create projects in Github

An introduction to HTTP frameworks in Go. We're using gin-gonic for both our Users and OAuth API and gorilla/mux for our Items API later.

HTTP frameworks

An introduction to the MVC pattern in Go.

Basic application structure: MVC pattern

How and why we should always start from our domain and then going backwards in the layers.

Starting from our domain

How to structure the domain persistence layer: a kind introduction to the DAO pattern.

How to structure our domain persistence

How to work with dates in Go.

Working with dates
+ MySQL integration
7 lectures 03:31:49

Adding and configuring our MySQL database in Go.

Configure MySQL client in Go

How to insert rows in our MySQL database.

How to insert rows

How to read a single row from our MySQL server.

How to read rows

How to handle MySQL errors.

How to handle MySQL errors

How to update rows in our MySQL database.

How to update rows

How to delete rows from our MySQL database.

How to delete rows

How to find rows in our MySQL database.

How to find rows
+ Fixing the mistakes we made
3 lectures 01:36:43

An introduction to the marshaller concept, how to develop and where to use it!

How to marshal structs

Implementing our services via interfaces so we have a consistent and mockeable business logic handler in our entire application.

Preview 25:33

Adding a logger to our application ( zap from Uber in this case).

No logging system
+ Creating our projects: OAuth API
4 lectures 01:34:10

An introduction to OAuth authentication.

OAuth authentication

An introduction to Domain Driven Development.

Domain Driven Development

How to start working on the domain as the start point of our application development process.

DDD - Starting with the domain

How to implement our DDD approach in Go.

DDD - Project structure
+ Cassandra integration
4 lectures 01:08:52

An introduction to CassandraDB.

Introduction to Cassandra DB

An introduction to one of the Cassandra clients in Go.

Cassandra Go client

In this lesson we're interacting with our Cassandra cluster to insert, get and update records.

How to insert, get and update records

In this lesson we're improving our GetSession() implementation based on recommendations from the Cassandra Go client.

Tune our get session implementation
+ Making the authentication work
3 lectures 01:24:14

How to authenticate users in our ecosystem by leveraging on the OAuth API.

Authenticating users

In this lesson we're looking at how to generate access tokens in our OAuth API. Please take a look at the external resources attached to this lesson so you can define the best approach that fits the best for your use cases.

Generating access tokens

In this lesson we're defining two different requests: One for our OAuth API and other for our Users API so you can create one based on the other one and not be restrained to the same interface.

Different requests for the two APIs
+ Golang libraries & dependencies
4 lectures 01:50:34

How to create an OAuth library in Github that we're going to use in all of our microservices to authenticate against our OAuth API.

Creating a shared OAuth library

An introduction to how dependencies work in Go and how we can use dep to generate and maintain our vendor folder.

GOROOT: Where Go is installed. Default: /usr/local/go

    export GOROOT=/usr/local/go

    export PATH=$PATH:$GOROOT/bin

GOPATH: Workspace for Go projects. Default: ~/go

    Go 1.13 set "modules" as the confirmed dependency system in Go.

    Go < 1.13: Every Go project must be cloned INSIDE of your GOPATH.

    Go >= 1.13: Every Go project using modules must be cloned OUTSIDE of your GOPATH.

How dependencies work: go modules

How to explicitly define transitive dependencies in our libraries.

Defining transitive dependencies

How to create a Utils library in Github and use it in all of our projects.

Creating a shared utils library
+ Creating our projects: Items API
11 lectures 05:37:19
Application structure: MVC & gorilla/mux

In this lesson we're configuring our Mux router in the Items API.

Configure our mux router

A kind introduction to ES.

Introduction to Elasticsearch

Adding the ES client in our Go application.

Adding ElasticSearch client

In this lesson we're covering how to implement and organize our code in order to index new documents in ES.

Index documents in ES

In this lesson we're removing the copies of the logger from all the repos and moving it to a common library that we can import and use.

Moving our logger to the utils library

In this lesson we're improving the quality of our errors library.

Improving our errors library

In this lesson we're applying vendor to all of our projects and making them ready to ship.

Dependencies: Using modules in all projects
How to get documents by ID

In this lesson we're implementing both the get by id and search features in our API.

Searching documents in ES

In this video I'm explaining the homework you have in order to add the delete and update endpoints to our API.

Homework: Add delete and update endpoints
+ Testing
1 lecture 28:15

In this lesson we're unit testing our OAuth library. I'll leave some exercises so you can continue testing the application.

Testing our application: OAuth client
  • Just complete the Golang tour available at Golang's website
  • Nice to have: Part 1 of this course


In this second part of the series I'm working with MySQL, Cassandra and Elasticsearch as persistence layers and we're going to create 3 different microservices using different design patterns: MVC, featured MVC and Domain Driven Development implementing the Hexagonal architecture.

At the end of the course you'll learn:

  • How to structure our application's packages and code.

  • MVC pattern, Domain Driven Development and Hexagonal Architecture applied!

  • How to configure MySQL client in Go. DAO pattern implemented.

  • How to configure and use CassandraDB client in Go.

  • How to configure and use Elasticsearch in Go.

  • Testing and mocking database integrations.

  • Stress test the microservice with goroutines.

  • How dependencies work in Go. Usage of Go modules.

  • How to build, publish, use and share a custom Go library.

  • Application design patterns.

  • Preparing our distributed logging system.

  • Real life examples and exercises.

I'm sure you're going to enjoy this course! if you have any doubts, please check the reviews on my other courses so you can get an idea about what you're about to get. This is real life and industry experience!

Hope to hear from you!


Who this course is for:
  • Software engineers.
  • Software developers.
  • Technical leaders.
  • Architects.
  • Anyone who wants to get serious about microservices in Go.