Giter VIP home page Giter VIP logo

nestjs-microservices-example's Introduction

This repository shows how you can build API with microservice architecture using nestjs

Features of this example

This example is basically an API for some task manager application. It provides a possibility to perform sign up users, confirm user's emails, manage user's tasks.

Running the example with docker-compose

Execute docker network create infrastructure && cp .env.example .env && docker-compose up -d from the root of the repository

Accessing the API itself and swagger docs for the API

  • Once you launch the API it will be accessible on port 8000.
  • Swagger docs for the API will be accessible locally via URI "http://localhost:8000/api"

Launch services for integration testing (using docker-compose)

  • Execute sudo vim /etc/hosts and add line 127.0.0.1 db to it. This is a temporary step, it will not be required since new update.
  • Execute cp .env.example .env && cp .env.test.example .env.test
  • Execute docker-compose -f ./docker-compose.test.yml up -d from the root of the repository
  • Run cd ./gateway && npm install && npm run test from the root of this repo

Brief architecture overview

This API showcase consists of the following parts:

  • API gateway
  • Token service - responsible for creating, decoding, destroying JWT tokens for users
  • User service - responsible for CRUD operations on users
  • Mailer service - responsible for sending out emails (confirm sign up)
  • Permission service - responsible for verifying permissions for logged in users.
  • Tasks service - responsible for CRUD operations on users tasks records
  • The service interact via TCP sockets

This example uses a SINGLE database (MongoDB) instance for all microservices. This is not a correct point, the correct way is to use a separate DB instance for every microservice. I used one DB instance for all microservices to simplify this example.

nestjs-microservices-example's People

Contributors

denrox avatar dependabot[bot] avatar joker666 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.