Git Product home page Git Product logo

ahmedeid6842 / tickets Goto Github PK

View Code? Open in Web Editor NEW
19.0 1.0 0.0 276 KB

๐ŸŽŸ๏ธ ๐ŸŽ›๏ธ The Ticket App Microservices Backend is an efficient Node.js and Typescript-based solution that uses microservices, NATS streaming, and Kubernetes deployment for ticketing apps.

TypeScript 98.75% Dockerfile 1.25%
docker kubernetes message-broker microservices mongodb nats-streaming node-js object-oriented-programming redis typescript

tickets's Introduction

logo-no-background

Tickets Microservices

๐Ÿ“‘ Table of Contents

๐Ÿ“˜ Introduction

The Ticket App Microservices Backend is a Node.js Typescript-based backend that utilizes microservices architecture to provide a seamless user experience. This backend is composed of several microservices including Auth, Expiration, Common, Order, Payment, and Ticket. Auth handles authentication and authorization, while Expiration uses the Bull package to set expiration time for tickets and delay events for 15 minutes after order creation. Common is an npm package that shares the code of events interfaces. Order handles order creation and cancellation with firing events, Payment handles payment using Stripe, and Ticket handles ticket creation and updates. To handle message streaming between services, this backend uses NATS streaming service built on top of NATS-streaming.

The code is written in Typescript, making use of interfaces, classes, and generators to ensure a well-organized and easily maintainable codebase. Kubernetes service and deployment were used to create a deployment for each service and its database and to build ingress and set up the NATS streaming service. This Ticket App Microservices Backend provides a reliable and efficient backend for your ticket app needs. The Ticket App Microservices Backend is a reliable and efficient solution for ticket app needs, with Mongoose version numbers utilized to solve concurrency issues between services.

(back to top)

๐Ÿš€ Getting Started

To get a local copy up and running, follow these steps.

Prerequisites โ—

In order to run this project you need:

Environment Variables ๐Ÿ”‘

To run this project, you will need to add the following environment variables to your secrets.yaml file

JWT_KEY : string, JSON web token secret (Example: JwtKey)

SALT_FACTORY: number of rounds to create salt for hashing ( Example: 10 )

STRIPE_KEY: your stripe API key to handle the payment

Note: All environment variables must be encoded in base64 format.

Setup โฌ‡๏ธ

  1. Setup Ingress-Nginx Controller, refer to the documentation for instructions. This will guide you through the process of setting it up correctly to handle incoming traffic.

  2. Clone this repository to to your preferred directory:

cd my-folder
git clone https://github.com/ahmedeid6842/Tickets.git

Install โœ”๏ธ

Install this project with kubectl :

kubectl apply -f ./infra/k8s

Usage ๐Ÿคฟ ๐Ÿƒโ€โ™‚๏ธ

After following the above instructions, the Kubernetes cluster should be up and running.

  • To verify the health of all Kubernetes cluster components and ensure that they are in a ready state, you can run the following command in the terminal:
kubectl get all

cluster-health

  • Alright, it's showtime! ๐Ÿ”ฅ Hit ticketing.dev/api/users/currentuser and BOOM! ๐Ÿ’ฅ You should see the microservices working like a charm. โœจ๐Ÿง™โ€โ™‚๏ธ

Postman_Docs_GIF

Note: the reason you are receiving {"currentUser":null} is because you are not currently logged in. However, this indicates that the services are operational and functioning properly.

(back to top)

๐Ÿ” API Refernce

Postman ๐Ÿคฉ

Here is the link to the Postman documentation for Tickets: Postman Docs - Tickets.

Postman_Docs_GIF

(back to top)

๐Ÿ—๏ธ๐Ÿ”จ Architecture

  • Presented here is the general infrastructure diagram for the ticket cluster, illustrating the communication channels utilized by the distinct services to interoperate with one another.

Infrastructure

(back to top)

๐Ÿ‘ค Author

Ahmed Eid ๐Ÿ™‹โ€โ™‚๏ธ

(back to top)

๐Ÿค Contributing

We're always looking to improve this project! ๐Ÿ” If you notice any issues or have ideas for new features, please don't hesitate to submit a pull request ๐Ÿ™Œ or create a new issue ๐Ÿ’ก. Your contribution will help make this project even better! โค๏ธ ๐Ÿ’ช

โญ๏ธ Show your support

If you find this project helpful, I would greatly appreciate it if you could leave a star! ๐ŸŒŸ ๐Ÿ’Ÿ

๐Ÿ”ญ Up next

  • Implement validation for incoming requests ๐Ÿšฆ
  • Add automated testing for each microservice ๐Ÿงช
  • Implement "Forgot Password" functionality ๐Ÿ’

๐Ÿ’Ž Lessons Learned

  1. Understanding of concurrency issues and techniques to mitigate them.

  2. Development of a good interface and base classes using TypeScript to enhance code organization and reusability.

  3. Configuration and use of a message broker to facilitate event sharing between microservices.

  4. Creation of a robust architecture for the microservices cluster using Kubernetes.

  5. There is always something new to learn ๐Ÿ‘จโ€๐Ÿ’ป.

(back to top)

tickets's People

Contributors

ahmedeid6842 avatar

Stargazers

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