Home - nuthanc/microservice GitHub Wiki

Insights from Microservice course

  • Section pages are just for describing in my own words
  • More details in Ticketing wiki and Udemy course for contents

What is it?

  • Ticketing App
  • Microservice Application with Events between Services
  • Users can create and edit a Ticket for a particular event(not a microservice event)
  • Users can buy the ticket by placing an order
  • After placing an order, you can either pay for that ticket or cancel it
  • After selecting and placing an order, there is a timer to pay for that ticket as that ticket is reserved
  • If you don't pay within that time, the order becomes canceled and the ticket is unreserved
  • Check more about App-Demo, Auth-flow, Tech-Used, NextJS-flow, Ticket-Creation-flow etc in other Pages

Services

  • Ticket
  • Order
  • Auth
  • Payment
  • Expiration
  • Client

Events

  • ticket:created
  • ticket:updated
  • order:created
  • order:cancelled
  • charge:created
  • expiration:completed

Frontend implementation

  • NextJS
  • It's used for Server-side rendering
  • For that, mainly getInitialProps is used
  • Whatever getInitialProps returns is passed to the Component as props
  • _app is created to have a common Header
  • The components are rendered from it
  • Routing: Next Router
  • Link: href for file path as well as as for actual url

Versioning to avoid Concurrency

  • Used version field to avoid Concurrency(out of order events)
  • This is generally required for Update events
  • For Create events, it doesn't matter in which order the ticket is created

Files and Directories required to start

  • package.json using npm init -y
  • src dir containing index.ts and app.ts(Why this separation? For tests)
  • Separate folders for routes, models, events, mocks, errors, and middlewares(In common dir)