Build A Microservices App With .Net And Nextjs From Scratch
Published 7/2023
MP4 | Video: h264, 1280x720 | Audio: AAC, 44.1 KHz
Language: English | Size: 14.18 GB | Duration: 31h 37m
Published 7/2023
MP4 | Video: h264, 1280x720 | Audio: AAC, 44.1 KHz
Language: English | Size: 14.18 GB | Duration: 31h 37m
How to build a microservices based app using .Net, NextJS, IdentityServer, RabbitMQ running on Docker and Kubernetes
What you'll learn
To build an application with .Net using Microservices architecture
To build a client app for the application using NextJS
To use RabbitMQ for Service bus communications
To install and use IdentityServer in the Microservices app
To be able to test the projects using Unit and Integration testing with XUnit
To publish the Microservices app to Docker compose
To publish the Microservices app to Kubernetes cluster both locally and on the internet
Requirements
Some coding experience is required to participate in this course
Windows, Mac or Linux computer that is capable of running Docker
Description
Microservices is the latest 'buzzword' and hot topic in the web development industry at the moment and nowadays having microservices as part of your skillset is becoming more and more essential. This course aims to teach you how to build a microservices based app using .Net for the backend services and Next.js for the client app. We start from nothing and build up the app until we have a completed app that we can publish to a Kubernetes cluster on the internet.Here are some of the things that are covered in this course:Creating several backend services using .Net that provide functionality for the appService to service communication using RabbitMQ and gRPC Using IdentityServer as the identity provider. Creating a gateway using Microsoft YARPBuilding a client side app with Next.js using the new App Router functionality (since Next.js 13.4)Using SignalR for push notifications to the client appDockerizing our different servicesCI/CD workflows using GitHub actionsAdding ingress controllersPublishing the app locally using docker composeThe goals of the main part of this course is to build this app and be able to run and publish everything locally without having to sign up or pay for any cloud services. Once you have completed the main part of the course there are 3 optional Appendixes that cover:Unit and integration testingPublishing locally to KubernetesPublishing the app to a Kubernetes cluster on the internetTools you need for this courseIn this course all the lessons are demonstrated using Visual Studio Code, a free (and fantastic) cross platform code editor. You can of course use any code editor you like and any Operating system you like… as long as it's Windows, Linux or Mac. Please ensure that your computer can run Docker as this is a requirement for this course (please see the pre-requisite lesson available as a preview to confirm this). Is this course for you?This course is very practical, about 90%+ of the lessons will involve you coding along with me on this project. If you are the type of person who gets the most out of learning by doing, then this course is definitely for you. On this course we will build an example Auction Application with several services that we will use to provide its functionality. For the client side of things we are using Next.js to take advantage of its client side and server side capabilities which is an excellent fit for what we are building. All you will need to get started is a computer with your favourite operating system that is capable of running Docker, and a passion for learning how to build a microservies based application using .Net and Next.js.
Overview
Section 1: Introduction
Lecture 1 Introduction
Lecture 2 Course pre-requisites
Lecture 3 Setting up the developer environment
Lecture 4 Course assets and source code
Lecture 5 VS Code troubleshooting and tips
Lecture 6 Microservices - the big picture
Section 2: Section 2 - Creating the first microservice
Lecture 7 Introduction to section 2
Lecture 8 Creating the first micro service
Lecture 9 Reviewing and simplifying the project
Lecture 10 Adding the entity classes
Lecture 11 Adding the Database context class
Lecture 12 Adding a Postgres database server
Lecture 13 Creating seed data
Lecture 14 Shaping the data to return
Lecture 15 Adding an API controller
Lecture 16 Adding a postman collection
Lecture 17 Adding the create auction endpoint
Lecture 18 Adding the update auction endpoint
Lecture 19 Adding the delete auction endpoint
Lecture 20 Saving changes into source control
Lecture 21 Summary
Section 3: Section 3 - Creating a Search microservice
Lecture 22 Introduction to Section 3
Lecture 23 Creating the second micro services
Lecture 24 Adding the MongoDb server
Lecture 25 Adding the Item model
Lecture 26 Adding seed data
Lecture 27 Adding a search controller
Lecture 28 Paginating the results
Lecture 29 Adding filtering and ordering
Lecture 30 Synchronous messaging
Lecture 31 Adding Http communication to get the data
Lecture 32 Making our Http communication resilient
Lecture 33 Summary of Section 3
Section 4: RabbitMQ
Lecture 34 Introduction to Section 4
Lecture 35 What is RabbitMQ
Lecture 36 Installing RabbitMQ
Lecture 37 Adding and configuring mass transit
Lecture 38 Adding the contracts
Lecture 39 Adding a consumer to consume a message from the Service bus
Lecture 40 Publishing the Auction Created event to the bus
Lecture 41 What could go wrong?
Lecture 42 Adding a message outbox
Lecture 43 Using message retries
Lecture 44 Consuming fault queues
Lecture 45 Challenge: Adding the update and delete consumers
Lecture 46 Challenge solution
Lecture 47 Summary of section 4
Section 5: Identity Server
Lecture 48 Introduction to Section 5
Lecture 49 OAuth and OpenIDConnect
Lecture 50 Creating the Identity Server project
Lecture 51 Reviewing and configuring our new project
Lecture 52 Seeding data and adding a migration
Lecture 53 Reviewing the login page in identity server
Lecture 54 Adding a register page
Lecture 55 Adding a register page part 2
Lecture 56 Adding a register page part 3
Lecture 57 Adding client credentials to allow clients to request a token
Lecture 58 Adding a custom profile service to identity server
Lecture 59 Configuring auth on the resource server
Lecture 60 Configuring the auth endpoints on the resource server
Lecture 61 Summary of section 5
Section 6: Adding a Gateway Service
Lecture 62 Introduction to Section 6
Lecture 63 Adding the Gateway service
Lecture 64 Adding the Reverse Proxy configuration
Lecture 65 Adding authentication to the Gateway config
Lecture 66 Testing our Gateway service in Postman
Lecture 67 Adding the remaining contracts we need
Lecture 68 Adding the remaining consumers to the Auction Service
Lecture 69 Adding the remaining consumers in the Search Service
Lecture 70 Adding a new client to the Identity service configuration
Lecture 71 Summary of Section 6
Section 7: Dockerizing our application
Lecture 72 Introduction to Section 7
Lecture 73 Creating a docker account
Lecture 74 Dockerizing the Auction Service
Lecture 75 Updating our docker compose file for the Auction Service container
Lecture 76 Dockerising the Search service
Lecture 77 Dockerising the Identity Service
Lecture 78 Debugging a .Net service in a docker container
Lecture 79 Dockerising the Gateway Service
Lecture 80 Testing our docker containers
Lecture 81 Summary of Section 7
Lecture 82 Introduction to Section 8
Lecture 83 Creating the NextJS project
Lecture 84 Reviewing and simplifying the NextJS Project
Lecture 85 Creating a nav bar
Lecture 86 Fetching data from the API
Lecture 87 Adding an Auction Card component
Lecture 88 Styling the auction cards
Lecture 89 Adding a countdown timer to the auction card
Lecture 90 Adding loading to the images
Lecture 91 Adding types to the project
Lecture 92 Adding pagination to our list
Lecture 93 Using server functions in client components
Lecture 94 Adding a set page size option
Lecture 95 Using Zustand for state management
Lecture 96 Refactoring our code to use the zustand state
Lecture 97 Adding a search bar
Lecture 98 Adding the search functionality
Lecture 99 Adding a reset to the search function
Lecture 100 Adding the sorting functionality
Lecture 101 Adding the filtering functionality
Lecture 102 Adding a component to display when zero results
Lecture 103 Summary of section 8
Section 8: Client side identity with NextAuth (AuthJS)
Lecture 104 Introduction to Section 9
Lecture 105 Before we begin
Lecture 106 Installing Next Auth into our client app
Lecture 107 Adding the login functionality
Lecture 108 Getting the session details in the client
Lecture 109 Populating the session data
Lecture 110 Populating the User actions dropdown
Lecture 111 Protecting routes
Lecture 112 Testing API authentication
Lecture 113 Getting the access token to use to authenticate to our resource server
Lecture 114 Summary of Section 9
Lecture 115 Introduction to Section 10
Lecture 116 Routing in NextJS
Lecture 117 Getting the auctions won
Lecture 118 Creating an Auction form
Lecture 119 Creating an Auction form part 2
Lecture 120 Creating a reusable text input
Lecture 121 Creating the auction form part 3
Lecture 122 Creating a reusable date input
Lecture 123 Creating a fetch wrapper
Lecture 124 Adding the create auction server action
Lecture 125 Adding react hot toast to display notifications if something goes wrong
Lecture 126 Adding the auction details page content
Lecture 127 Adding the edit auction page
Lecture 128 Adding the delete auction functionality
Lecture 129 Summary of section 10
Section 9: Creating the bid service
Lecture 130 Introduction to Section 11
Lecture 131 Creating the Bid Service
Lecture 132 Adding the models to the Bid Service
Lecture 133 Adding an API Controller for the bids
Lecture 134 Adding the get bids endpoint
Lecture 135 Adding the auction created consumer
Lecture 136 Testing the bid functionality in Postman
Lecture 137 Adding the DTOs and Automapper
Lecture 138 Adding a producer for the BidPlaced
Lecture 139 Challenge solution
Lecture 140 Adding a Background service for the auction finished event
Lecture 141 What is gRPC?
Lecture 142 Adding gRPC part 1
Lecture 143 Adding gRPC part 2
Lecture 144 Adding a gRPC client
Lecture 145 Updating the Gateway service
Lecture 146 Dockerising the BidService
Lecture 147 Summary of Section 11
Section 10: Adding a SignalR service
Lecture 148 Introduction to Section 12
Lecture 149 Creating the Notification service
Lecture 150 Adding a SignalR Hub
Lecture 151 Adding the Consumers
Lecture 152 Adding CORS support to the Gateway
Lecture 153 Dockerising the NotificationService
Lecture 154 Updating the Docker compose file
Lecture 155 Summary of section 12
Lecture 156 Introduction to Section 13
Lecture 157 Refactoring the auctions into a zustand store
Lecture 158 Updating the Auction cards with the current high price
Lecture 159 Getting the bids for an auction
Lecture 160 Creating a bid item
Lecture 161 Creating a bid store
Lecture 162 Creating a bid form
Lecture 163 Updating the error handling
Lecture 164 Adding conditionals to the form and testing
Lecture 165 Adding SignalR to the client app
Lecture 166 Adding the new bid to SignalR
Lecture 167 Adding a toast for an auction created
Lecture 168 Adding a toast for an auction finished event
Lecture 169 Disabling the auction finished form when the auction finishes
Lecture 170 Preventing low bids
Lecture 171 Summary Section 13
Section 11: Publishing the app to production (locally)
Lecture 172 Introduction to Section 14
Lecture 173 Preparing the client app
Lecture 174 Creating the Dockerfile for nextjs
Lecture 175 Fixing the identity server issues in docker compose
Lecture 176 Giving the Identity Server a static ip address
Lecture 177 Adding an ingress to Docker compose
Lecture 178 Adding SSL to the ingress
Lecture 179 Final app cleanup and resolving SignalR issue
Lecture 180 End of course summary
Section 12: Appendix A - Testing
Lecture 181 Intro to Appendix A - Testing
Lecture 182 The simplest unit test possible
Lecture 183 Reviewing the code in the Auction controller and what we are testing
Lecture 184 Creating an Auction Repository and interface
Lecture 185 Refactoring the Auctions controller to use the repository
Lecture 186 Mocking things
Lecture 187 Unit testing the GET methods part 1
Lecture 188 Unit testing the GET methods part 2
Lecture 189 Unit testing the POST request
Lecture 190 Challenge - Practicing creating unit tests for the other controller methods
Lecture 191 Challenge solution
Lecture 192 Integration testing setup
Lecture 193 Setting up a Custom web application factory for integration testing
Lecture 194 Adding test data to the DB
Lecture 195 Creating an integration test for the GET method part 1
Lecture 196 Creating an integration test for a GET request part 2
Lecture 197 Creating an integration test for the POST request
Lecture 198 Challenge - Practicing creating integration tests for the other methods
Lecture 199 Challenge solution
Lecture 200 Testing the Service bus
Lecture 201 Using Collection fixtures to share the DB across test classes
Section 13: Appendix B - Publishing to Kubernetes (locally)
Lecture 202 Intro to Appendix B - Kubernetes
Lecture 203 No ‘depends on’ in Kubernetes - using Polly to retry instead
Lecture 204 Adding a GitHub action to push our Identity Server image to Docker hub
Lecture 205 Deploying our IdentityServer to a Digital Ocean server
Lecture 206 Configuring the Linux server to host the identity server
Lecture 207 Creating the first Kubernetes manifest for a deployment
Lecture 208 Adding a persistent volume claim
Lecture 209 Adding a load balancer to allow us to connect to the postgres deployment
Lecture 210 Adding a cluster ip our services can use
Lecture 211 Creating a deployment for RabbitMQ
Lecture 212 Creating a Mongodb deployment
Lecture 213 Creating the auction service deployment
Lecture 214 Creating the search service deployment
Lecture 215 Creating the bid service deployment
Lecture 216 Creating the notification service deployment
Lecture 217 Creating the gateway service deployment
Lecture 218 Creating the client app deployment
Lecture 219 Adding an nginx ingress controller for docker-compose
Lecture 220 Adding SSL to the ingress controller
Lecture 221 Fixing Identity Server issues
Section 14: Appendix C - Publising to Kubernetes (Internet)
Lecture 222 Introduction to Appendix C
Lecture 223 Kubernetes secrets
Lecture 224 Using a manifest to create secrets
Lecture 225 Updating the rest of the secrets
Lecture 226 Adding a workflow to deploy our Auction service
Lecture 227 Creating a kubernetes cluster on Digital Ocean
Lecture 228 Connecting to our new kubernetes cluster
Lecture 229 Creating a workflow to deploy our manifests automatically
Lecture 230 Dev resources and prod resources
Lecture 231 Creating the other deployment workflows for the other services
Lecture 232 Deploying the secrets and the ingress controller
Lecture 233 Deploying our manifests via github actions
Lecture 234 Checking our deployment
Lecture 235 Getting a domain name to point at our Load balancer
Lecture 236 Tying up the loose ends part 1
Lecture 237 Tying up the loose ends part 2
Lecture 238 Adding SSL to our deployment part 1
Lecture 239 Adding SSL to our deployment part 2
Lecture 240 Finishing up the deployment
Those who would like to learn how to build an app with Microservice architecture using .Net