Node.js Microservice with NestJS: Part 1 - Service Overview

Overview of the tour-service

Over the next few posts we will dig into building the tour-service.  In this post we will briefly go over what the service will do and its primary components that we will be building out in subsequent posts. 

For more details about the entire application we will be building and deploying, check out the prior posts:

What will the tour-service do?

The tour-service accepts REST API calls containing a user's current GPS coordinates and returns information about nearby points of interest, which we will be referring to as Landmarks.  The tour-service queries data providers such as Wikipedia to get information about Landmarks within a given distance of the user's coordinates then returns a list of those Landmarks


The Primary tour-service Components

This is a diagram of the application and its components that will be described in more detail below.




Landmark Controller

The LandmarkController will receive REST API calls from the mobile app.  It transforms the incoming API calls into requests that it passes to the LandmarkService and then again transforms the LandmarkService response into an API response.

Landmark Service

The LandmarkService is responsible for calling all of the LandmarkProviders to get landmark info.  It then leverages the GeoService to calculate the distance between the user's current location and each Landmark.

Geo Service

The GeoService provides functionality for calculating distance between coordinates.

Landmark Providers

LandmarkProviders wrap external sources for getting landmark info.  They then convert this information into a common format.  Initially we will only implement a single LandmarkProvider, the WikipediaLandmarkProvider.  It will use the Wikipedia APIs to query landmark information from Wikipedia.  Later we may add some additional providers.

Wikipedia Client

The WikipediaClient is an HTTP client API for making calls to the Wikipedia APIs. 


Up Next

In the next post we will go though scaffolding our app using the NestJS CLI.

Comments

Popular posts from this blog

Node.js Microservice with NestJS: Part 3 - NestJS Dependency Injection

REST APIs with Controllers - Node.js Microservice with NestJS: Part 4

Constructor-Based vs Property-Based Dependency Injection in NestJS - Which is Better?