Git Product home page Git Product logo

microtwitt's Introduction

MicroTwitt

A simple twitter like application for learning NestJS Microservice

Tech Stack

Nest Logo Nats Logo Redis Logo Postgres Logo Postgres Logo Postgres Logo

Architecture

Postgres Logo

Application has basic functionality of an web application backend for user authentication, Tweet CRUD operations, timeline creation, search and social networking.

Functionalities are separated as a microservice. In microservice architecture, generally each service has own team to manage & develop its features.

Each microservice:

  • is containerized with Docker
  • has own scope, development lifecycle
  • has own package management

Services

Api Gateway

API gateway is single entry point for all services. External clients access data & functions via REST API. Api Gateway delegates the request to other services

User

Responsible for User management. Using JWT Authentication

Social

Serves and updates user relations (follow mechanism) and provides searching in graph data. Uses neo4j graph database. We can manage this service for creating follow suggestions and improving search of users

Timeline

Creates and serves timeline data for each user and caches to be able to respond fast. This service can be modified for injecting ads and suggestions for income and better user experience

Tweet

CRUD and search operations of Tweets are handled in Tweet microservice. It uses Postgres database which is also used by User microservice, to reduce data layer services. But if we would like to separate concerns of development and create a domain driven architecture, we can create another database for this service

How to Run

Use docker compose to build and run.

docker compose build
docker compose up

You can use swagger page to access and send request to API. enter address to yor browser

http://localhost:3000

Conclusion

I've omitted the unit tests, integration tests, data seed, monitoring tools, detailed logs, SSL (maybe I will add data seed and monitoring tool later)

Creating and developing all micro services in one repo has overheads:

  • Services have shared packages but we must handle them isolated, that's why each image build common packages over again
  • Difficult to create reusable components
  • Increasing internal network traffic
  • Challenging to match logs of each services' logs to review of an user session

TODO

  • Add a monitoring tool: e.g zipkin
  • Add data seeding script
  • Test with 2x of each service to inspect routing/load balancing of NATS

microtwitt's People

Contributors

okanakdogan avatar

Watchers

 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.