Backend Master Class [Golang + Postgres + Kubernetes + gRPC]

Backend Master Class [Golang + Postgres + Kubernetes + gRPC]

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 51 lectures (12h 56m) | 4.19 GB

Learn everything about backend web development: Golang, Postgres, Gin, gRPC, Docker, Kubernetes, AWS, GitHub Actions

In this course, you will learn step-by-step how to design, develop and deploy a backend web service from scratch. I believe the best way to learn programming is to build a real application. Therefore, throughout the course, you will learn how to build a backend web service for a simple bank. It will provide APIs for the frontend to do the following things:

  • Create and manage bank accounts.
  • Record all balance changes to each of the accounts.
  • Perform a money transfer between 2 accounts.

The programming language we will use to develop the service is Golang, but the course is not just about coding in Go. The course is divided into 4 main parts:

In the first part, you will learn deeply about how to design the database, generate codes to talk to the DB in a consistent and reliable way using transactions, understand the DB isolation levels, and how to use it correctly in production. Besides the database, you will also learn how to use docker for local development, how to use Git to manage your codes, and how to use Github Action to run unit tests automatically.

In the second part, you will learn how to build a set of RESTful HTTP APIs using Gin – one of the most popular Golang frameworks for building web services. This includes everything from loading app configs, mocking DB for more robust unit tests, handling errors, authenticating users, and securing the APIs with JWT and PASETO access tokens.

In the third part, you will learn how to build your app with Docker and deploy it to a production Kubernetes cluster on AWS. The lectures are very detailed with a step-by-step guide, from how to build a minimal docker image, set up a free-tier AWS account, create a production database, store and retrieve production secrets, create a Kubernetes cluster with EKS, use Github Action to automatically build and deploy the image to the EKS cluster, buy a domain name and route the traffics to the service, secure the connection with HTTPs and auto-renew TLS certificate from Let’s Encrypt.

The last part is a work-in-progress, where we discuss more advanced backend topics such as managing user sessions, building gRPC APIs, using gRPC gateway to serve both gRPC and HTTP with 1 single implementation of the handler, embedding Swagger documentation as part of the backend service, running asynchronous workers, gracefully shutdown servers, etc. We will keep making and uploading new videos, so please come back here to check them out from time to time.

This course is designed with a lot of details, so that everyone, even with very little programming experience can understand and do it by themselves. I strongly believe that after the course, you would be able to work much more confidently and effectively on your projects.

What you’ll learn

  • Design database schema using DBML and automatically generate SQL code from it
  • Deeply understand the DB isolation levels, transactions and how to avoid deadlock
  • Automatically generate Golang code to interact with the database
  • Develop a RESTful backend web service using the Gin framework
  • Secure the APIs with user authentication, JWT and PASETO
  • Write stronger test set with high coverage using interfaces and mocking
  • Build a minimal Docker image for deployment and use Docker-compose for development
  • Set up Github Action to automatically build and deploy the app to AWS Kubernetes cluster
  • Register a domain and config Kubernetes ingress to route traffic to the web service
  • Enable automatic issue & renew TLS certificate for the domain with Let’s Encrypt
Table of Contents

Working with database Postgres SQLC
1 Design DB schema and generate SQL code with dbdiagramio
2 Install & use Docker Postgres TablePlus to create DB schema
3 How to write & run database migration in Golang
4 Generate CRUD Golang code from SQL Compare dbsql gorm sqlx & sqlc
5 Write unit tests for database CRUD with random data in Golang
6 A clean way to implement database transaction in Golang
7 DB transaction lock & How to handle deadlock in Golang
8 How to avoid deadlock in DB transaction Queries order matters
9 Deeply understand transaction isolation levels & read phenomena
10 Setup Github Actions for Golang Postgres to run automated tests

11 Implement RESTful HTTP API in Go using Gin
12 Load config from file & environment variables in Go with Viper
13 Mock DB for testing HTTP API in Go and achieve 100 coverage
14 Implement transfer money API with a custom params validator
15 Add users table with unique & foreign key constraints in PostgreSQL
16 How to handle DB errors in Golang correctly
17 How to securely store passwords Hash password in Go with Bcrypt
18 How to write stronger unit tests with a custom gomock matcher
19 Why PASETO is better than JWT for tokenbased authentication
20 How to create and verify JWT & PASETO token in Golang
21 Implement login user API that returns PASETO or JWT access token in Go
22 Implement authentication middleware and authorization rules in Golang using Gin

Deploying the application to production Docker Kubernetes AWS
23 How to build a small Golang Docker image with a multistage Dockerfile
24 How to use docker network to connect 2 standalone containers
25 How to write dockercompose file and control service startup orders
26 How to create a freetier AWS account
27 Auto build & push docker image to AWS ECR with Github Actions
28 How to create a production database on AWS RDS
29 Store & retrieve production secrets with AWS secrets manager
30 Kubernetes architecture & How to create an EKS cluster on AWS
31 How to use kubectl & k9s to connect to a kubernetes cluster on AWS EKS
32 How to deploy a web app to Kubernetes cluster on AWS EKS
33 Register a domain & set up Arecord using Route53
34 How to use Ingress to route traffics to different services in Kubernetes
35 Auto issue & renew TLS certificates with certmanager and Lets Encrypt
36 Automatic deploy to Kubernetes with Github Action

Advanced Backend Topics gRPC
37 How to manage user session with refresh token
38 Generate DB documentation page and schema SQL dump from DBML
39 Introduction to gRPC
40 Define gRPC API and generate Go code with protobuf
41 How to run a golang gRPC server and call its API
42 Implement gRPC API to create and login users in Go
43 gRPC Gateway write code once serve both gRPC & HTTP requests
44 How to extract information from gRPC metadata
45 Automatic generate & serve swagger documentation from Go server
46 Embed static frontend files inside Golang backend servers binary
47 Validate gRPC parameters and send humanmachine friendly response
48 Run DB migrations directly inside Golang code
49 Partial update DB record with SQLC nullable arguments
50 Hey its not the end yet
51 Whats next