Giter VIP home page Giter VIP logo

ticketing-app's Introduction

ticketing-app

Build a basic ticket selling app using microservice approach.
This project is a part of the udemy course provided by Stephen Grider.

Goal of this Project ๐ŸŽฏ

  1. Focus on how to apply microservice concept into building an applcation
  2. Each part of features or use cases inside of the app can be categorized and divided into services having its own independent system (i.e. programming language, business logic, database).
  3. Get a basic understanding how asynchronous communication works inside the system using a message queue to publish and listen on events (data)

System Overview ๐ŸŒ

This application provides a simple ticket selling system (lots of improvement are needed if intended to use in the real world).

  • Auth: Everything related to user accessing (registrating and authenticating) into the system.
  • Ticket: tickets available to users to reserve and purchase
  • Order: Acts like shopping cart for each user to reserve a ticket.
  • Expiration: Watches for orders to be created, cancels them after 15 minutes.
  • Payment: Handles credit card payments. Cancels orders if payments fails, completes if payment succeeds.

Side Note: Each service is contained inside a docker image which will be deployed inside a kubernetes pod (one container per pod) which is exposed by a Cluster IP service.

Another Side Note: Since all of the services are independent, having its own system and database, that's where message queue comes into play to asynchronously publish and listen on events (data) throughout all services.

Tech Stack ๐Ÿงฐ

  • Programming Language: Javascript, Typescript
  • Front-end Framework: Next.js (server-side rendering version of React)
  • Back-end Framework: Express.js, Node.js
  • Database: MongoDB, Redis
  • Package Manager: npm
  • Devops: Docker, Kubernetes, NATS Streaming Server, ingress-nginx, Skaffold, Github Actions

Lesson Learned ๐Ÿ“š

@omekrit's opinion

  • The big challenge in microservice is data since each service has its own database.
  • Typescript makes it a lot easier to capture data properties and bugs inside the system.
  • Testing is a must for this type of application and you need to make sure that the components inside each service are loosely coupled so that you can create mocks and test on a single unit/component.
  • Async communication focuses on communicating changes using events sent to an event bus.
  • Async communication encourages each service to be 100% self-sufficient which will be relatively easy to handle temporary downtime or new service creation.
  • Async communication can provide concurrency issues where each service processes an event in an incorrect order which can introduce a big problem to the app.
  • To tackle the concurrency issue, I added versioning strategy inside the database schema to keep track on the right order of event.
  • Data replication is needed for microservice.
  • Docker makes it easier to package up services.
  • Kubernetes is a pain to setup, but makes it easier to deploy and scale services.
  • With GitHub Action, I can apply test execution and deployment scripts to be run on push or pull request for the code to be tested and deployed automatically.
  • You can use cloud service provider to leverage the image building and container orchestration process if your local machine has low speed cpu and not a lot of RAM
  • Apart of microservice concept, it's a prerequisite for everyone before jumping into the microservice world to first have a basic understanding of how to build an app (programming languages, front-end, back-end, frameworks, tools, and other stuff related)

Further Improvements ๐Ÿ“ˆ

  • Redesign in business logic and database structures inside the system is needed if intended to use as a real world application.
  • To deploy the system, further kubernetes cluster configuration: service, load balancer, host, and github workflow is required.
  • User interface/experience part is currently overlooked (since this app focuses only on the back-end)

ticketing-app's People

Contributors

khomkrity 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.