• Stars
    star
    537
  • Rank 82,649 (Top 2 %)
  • Language
    TypeScript
  • Created almost 3 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Event-driven microservices architectured e-commerce app created using Express.js, Typescript, NATS-Streaming and Next.js

Checkout my other project

Join the Talkhouse Family😊 | WebRTC based peer to peer voice, video calling and messaging web app build with MERN stack

microservices-architectured-app

An event-driven asynchronous communication based microservices architectured e-commerce app created using express, typescript, nats-streaming and next.js

What is this ?

It's an e-commerce based web app for buying and selling tickets of different live and fun events happening around the city based on microservices architecture. The app is broken down into multiple individual services that talk to each other through publishing events via an event bus. Each service is responsible for handling and implementing a specific feature of the app like auth service handles authentication, orders service handles orders, payments service implements user payments and all these services work and communicate asynchronously through an event bus(nats-streaming) to run the entire app

Why microservices ?

Using microservices architecture and not relying on the monoloith pattern makes the app more durable, fault tolerant, highly available and increases the up time of the app. So if one of the services crashes, other parts of the app will still be functional and available to the users. Microservices and distributed systems is the heart of modern software and backend engineering.

Technologies used

  • Next.js for server side rendering and building frontend
  • Express.js is used for building backend
  • Mongodb as database
  • Mongoose as an ORM
  • Typescript , backend is written entirely in typescript to prevent headaches you get when infinte number of events are flowing around with no hints
  • Stripe for handling payments
  • Jest and Supertest for testing
  • Docker for containerization
  • Kubernetes for conatiner orchestration
  • Skaffold command line tool that facilitates continuous development for Kubernetes-native applications. Makes working with and managing kubernetes and different kubernetes services and deploymets a lot easier.
  • NATS Streaming is used as an event bus or message queue for publisihing and handling the events emitted by different services.
  • Bull.js is a fast and robust queue system. It is used to implement the payment expiration timer.

App Architecture

The app is divided into 7 services that handle and implement a specific feature and functionality of the app:

  • auth handles the entire app authentication and authorization. JWT and cookie based authentication is used.
  • expiration handles the payment expiration timer to make sure user pays within a specified time frame.
  • orders for handling user orders
  • payments for handling stripe payments
  • tickets for handling tickets(creating, updating, fetching). Instead of selling products, this e-commerce app sells tickets of different live events happening around the city.
  • common all the common functionality like requireAuth, error handling, and other middlewares and functions shared by different services are grouped together. This service is published as an npm package and installed in other services to be used.
  • client handles and implements the frontend of the app.
  • infra manages all the kubernetes deployment and service (.yaml) files that run run the app

Kubernetes and Docker Architecture

Each service, mogongodb database and nats-streaming server is dockerized as a docker container. The docker conatiners are managed and orchestrated by their respective kubernetes deployment.yaml files inside the infra directory. The communication between different kuberentes deployments is governed by service ObjectType. Finally ingress-service, which uses ingress-nginx (an Ingress controller for Kubernetes using NGINX) as a reverse proxy and a load balancer to proxy or direct incoming requests to their respective services under the ticketing.dev hostname. Skaffold is used to get all the kubernetes deployments and services up and running with a single command skaffold dev which uses skaffold.yaml file.

Installation

Getting this project up and running on your local machine is a notoriously dfficult task. It requires some knowlege of docker and kubernetes ecosystem. If you are still up for the challenge, or if you don't have a life, try getting it work. Make sure you have docker, kubernetes and skaffold installed. Set the required envirenmental variables and run the following command:

skaffold dev

And boom app will be up and running, no extra setup and dependencies required.

To delete any resources deployed by Skaffold and stop all the deployments, services and containers run

skaffold delete

Suggestion

Try running and testing it locally only if you don't have a life. Otherwise I'm not the one to blame for you scratching your head 😫 while trying to understand this microservices mess of event-driven communication betweewn the services πŸ˜‘

More Repositories

1

talkhouse

WebRTC based peer to peer voice, video calling and messaging web app build with MERN stack.
TypeScript
130
star
2

datastructures-and-algorithms

For JavaScript lovers | JavaScript Implementation of various data structures and algorithms.
JavaScript
76
star
3

paperhouses

Airbnb like web app built with React, TypeScript, GraphQl and Express.js
TypeScript
38
star
4

whatsApp-lite

Not just another whatsApp Clone but more, built with React Native, Expo, TypeScript and Firebase.
TypeScript
37
star
5

go-grpc-implementation

Golang + Gin + Docker + gRPC + NGINX
Go
23
star
6

E-commerce-MERN-stack

ShopLinee - A fully fledged E-Commerce site build with MERN stack.
JavaScript
20
star
7

saalik.me

My portfolio built with Next.js, TypeScript, Firebase, and Vercel ✨
TypeScript
17
star
8

react-paint

Paint web app build with react and canvas
TypeScript
11
star
9

Musically---React-Music-Player

Musically - Music Player build with react
JavaScript
7
star
10

UI-Colors

For designers and frontend developers, to make their life a little easy while choosing between different shades of colors.
JavaScript
7
star
11

Revents

Revents - A social media app created with react and firebase
JavaScript
5
star
12

nextjs-graphql

Starting point for your next Fullstack NextJS and GraphQL million dollar personal project.
TypeScript
4
star
13

goravel

PHP's Laravel like web framework supercharged with Go
Go
3
star
14

dev-blog

Blog website created with next.js, tailwindcss and markdown
JavaScript
2
star
15

Netflix-Clone

Netflix Clone - Clone of Netflix build with react
JavaScript
2
star
16

ReadIt

ReadIt - Bookmark App for desktops created with Electron.js
JavaScript
2
star
17

trello-clone

Trello Clone build with React, TypeScript and react-beautiful-dnd
TypeScript
2
star
18

serverless-marketplace-app

A serverless marketplace app created with aws-amplify and graphql
JavaScript
1
star
19

speedtester

Speed Tester - A simple web app built using Javascript that tests typing speed.
JavaScript
1
star
20

saalikmubeen

1
star
21

typegraphql-api

A graphql authentication api created with type-graphql, the best typescript and graphql library
TypeScript
1
star
22

nextjs-blog

JavaScript
1
star
23

sellyNow

SellyNow - React Native shopping app
JavaScript
1
star
24

your_tracks

GraphQL API build with python graphql library, graphene and graphene-django
Python
1
star
25

Node-rest-api

A restful api built with core Node.js without using any external libraries or dependencies
JavaScript
1
star
26

graphql-typescript-api

Complete user authentication API from scratch with GraphQL and TypeScript. Clone this repo and use it as a boilerplate or starting point for your next GraphQL and TypeScript project.
TypeScript
1
star
27

Arpari-Hiring-Assignment

Arpari Hiring Assignment
JavaScript
1
star
28

Chat-App

Chat App - A simple text sending app created using socket.io where you can join and create your own chat rooms.
JavaScript
1
star
29

LightsOut

LightsOut - A simple game build using ReactJS
JavaScript
1
star
30

first-electron-app

JavaScript
1
star
31

django-recipes-api

An API that allows users to manage and create recipes build with DRF
Python
1
star
32

Capture-Photography-Portfolio

Capture - A photography portfolio website created with react and framer-motion.
JavaScript
1
star
33

Expensify---Expense-Manager-App

Expensify - Expense Manager App build with react, redux and firebase.
JavaScript
1
star
34

devsearch

Devsearch - Connect with skilled remote developers
HTML
1
star
35

Todo-API

TodoAPI App- A fairly complex Todo app which consumes its own api built using node js.
JavaScript
1
star
36

great-places

Capture and save the list of all the places you had fun travelling
JavaScript
1
star
37

ColorBeats-Maker

ColorBeats - Clone of patatap website, it produces different beats and sounds. Each keyboard key is related to a specific sound and background.
JavaScript
1
star