In this lecture, we're going to review a system diagram that outlines the architecture of our application.
Now, this lecture is completely optional.
You don't need to complete this to move on with the project.
So if you simply just want to download this and move along, you can.
Otherwise, let's jump through this diagram.
We can see the first component here is the actor, which will just be the user sending a request to
our system and ultimately create a reservation.
Now each of these rectangles represent a different microservice.
So of course we have the reservations.
Microservice listening on Port 3000 and this is going to represent the gateway to our system.
It's going to be where the user is going to send the request to actually create the reservation using
post slash reservations route.
Now you can see here they need to first obtain a JWT.
And in order to get that JWT, we're going to communicate with the auth microservice on Http port 3001.
We're going to send a slash login request with our user's login credentials to the auth microservice.
Now the auth microservice will also have a route to create a user which is going to persist users to
our MongoDB database that you can see is connected here.
So the user will create an account and then they'll use the slash login route to authenticate with those
credentials that will be stored in MongoDB.
And in exchange they're going to get back this Json web token, which is a sign token and provides authentication
for future calls in the app.
So when we do make this post call to reservations, the first thing it's going to do is it's going to
take that JWT and then send a request to the auth microservice on TCP Port 3002.
It's going to use this message pattern, authenticate and include the JWT that the user sent along with
the original request.
Now the auth microservice will throw an error if this JWT is invalid, otherwise it's just going to
return a successful status and that means that we're authenticated and can continue to create a reservation.
So from here the reservation service will persist the data to the MongoDB database and then it's going
to communicate to our next microservice the payments microservice on TCP Port 3003.
It's going to send a message pattern of create charge, which is going to actually bill our user so
the payments microservice will reach out to our Stripe API to bill the user with the payment credentials
that are supplied in this request.
Then the payments microservice is emitting a notification to our notification service, which is our
last microservice listening on Port 3000.
And for the notifications microservice will have a notify email message pattern that will take your
request and emit the notification to our email provider.
In this case, we will be using Gmail, so we'll send an email to the user after we have billed them
and successfully created the reservation.
So feel free to download this PDF and reference it as we start to build out this system.
Let's go ahead and jump right in.
I'll see you in the next lecture.