This repository contains the codes of the Backend Master Class course.
This course is a step-by-step guide on how to design, develop, test and deploy a backend web service from scratch.
The backend service is a simple bank system that allows:
- Create and manage accounts and users.
- Record all balance changes to each account.
- Make transfers between accounts.
- Design the database schema
- Generate codes to talk to the DB
- Understand the DB isolation levels
- How to use Docker
- How to use Git and GitHub Actions to automate the CI/CD process
- Build a RESTful API using Gin
- Loading app configs
- Mocking DB for more robust unit tests
- Handling errors
- Authentication and authorization using JWT & PASETO
- Build app with Docker and deploy to Kubernetes Cluster on AWS
- Setup free tier AWS account
- Create a production DB on AWS RDS
- Store and retrieve production secrets using AWS Secrets Manager
- Create a Kubernetes Cluster with EKS
- Use GitHub Actions to automatically build and deploy the image to the Kubernetes Cluster
- Buy a domain name and route traffics to the service
- Secure with HTTPS and auto-renew SSL certificates from Let's Encrypt
- Managing user sessions
- Building gRPC API
- Using gRPC Gateway to serve both gRPC and HTTP requests at the same time
- Embedding Swagger UI to document the API
- Updating a record using optional parameters
- Writing structured logger HTTP middlewares and gRPC interceptors
- Asynchronous processing using background workers and Redis as its message queue
- Create and send emails to users via Gmail SMTP server
- Writing Unit Test for our gRPC services that might involve multiple dependencies at once
- Improve stability and security of the server
- Updating dependenby packages to the latest version
- Use Cookies to make the refresh token more secure
- How to gracefully shutdown the server to protect the processing ressources
- Lecture #0: Simple Bank
- Lecture #1: Database Design
- Lecture #2: Install & use Docker & Postgres
- Lecture #3: How to write & run DB migration in Golang
- Lecture #4: Generate CRUD Golang code from SQL
- Lecture #5: Unit Testing in Go db CRUD
- Lecture #6: DB Transaction in Golang
- Lecture #7: DB Transaction lock & how to handle deadlock
- Lecture #8: How to avoid DB Deadlock
- Lecture #9: Transaction isolation level
- Lecture #10: Github actions
- Lecture #11: Implement RESTful API
- Lecture #12: Load Config from file & env vars
- Lecture #13: Mock DB for testing HTTP API
- Lecture #14: Custom params validator
- Lecture #15: Add user table with unique & foreign key constraints
- Lecture #16: handle db errors
- Lecture #17: Hash Password
- Lecture #18: Stronger Unit tests
- Lecture #19: Why PASETO is better than JWT
- Lecture #20: Create & verify JWT & PASETO
- Lecture #21: Implement login API with paseto & jwt
- Lecture #22: How to implement authentication middleware
- Lecture #23: Build a minimal golang docker image
- Lecture #24: How to connect containers in the same docker network
- Lecture #25: How to use Docker compose
- Lecture #26: How to create a free tier AWS account
- Lecture #27: Build & push docker image to AWS ECR
- Lecture #28: How to create a production DB on AWS RDS
- Lecture #29: Store & retrieve production secrets with AWS secrets manager
- Lecture #30: How to create an AWS EKS Cluster
- Lecture #31: Kubectl & k9s
- Lecture #32: Deploy a web app to Kubernetes on aws
- Lecture #33: Register a domain & set up A-record using Route 53
- Lecture #34: How to use Ingress to route traffics to different services in K8s
- Lecture #35: Automatic issue TLS certificates in Kubernetes with Let's Encrypt
- Lecture #36: Automatic deploy to Kubernetes with Github action
- Lecture #37: how to manage user session with refresh token
- Lecture #38: Generate DB docs
- Lecture #39: Introduction to gRPC
- Lecture #40: Define gRPC API and generate Go code with protobug
- Lecture #41: How to run gRPC server
- Lecture #42: Implement gRPC API
- Lecture #43: Write code once, serve both gRPC & HTTP requests
- Lecture #44: Meta data in gRPC
- Lecture #45: Generate & serve Swagger with Go
- Lecture #46: Embed static frontend files inside Golang backend
- Lecture #47: gRPC params validation
- Lecture #48: Run DB migration with Go
- Lecture #49: Partial update & null params in go with sqlc
- Lecture #50: Build gRPC update with optional parameters
- Lecture #51: Add authorization to protect gRPC API
- Lecture #52: Write structured logs for gRPC APIs
- Lecture #53: HTTP logger middleware
- Lecture #54: Process async tasks with background workers
- Lecture #55: Integrate async worker to Go web server
- Lecture #56: Send async tasks to Redis within a DB transaction
- Lecture #57: How to handle errors and print logs for Go Asynq workers
- Lecture #58: The importance of delay in async tasks
- Lecture #59: How to send emails in go
- Lecture #60: How to skip test
- Lecture #61: Email verification
- Lecture #62: Implement email verfication API
- Lecture #63: How to unit test gRPC services
- Lecture #64: Unit test gRPC auth
- Lecture #65: Config sqlc version 2
- Lecture #66: Switch DB driver to pgx
- Lecture #67: Handle DB erros with PGX
- Lecture #68: Docker compose
- Lecture #69: Golang binary packages