Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ahmedeid6842/tickets
๐๏ธ ๐๏ธ 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.
https://github.com/ahmedeid6842/tickets
docker kubernetes message-broker microservices mongodb nats-streaming node-js object-oriented-programming redis typescript
Last synced: about 1 month ago
JSON representation
๐๏ธ ๐๏ธ 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.
- Host: GitHub
- URL: https://github.com/ahmedeid6842/tickets
- Owner: ahmedeid6842
- Created: 2023-06-16T00:36:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-16T14:43:13.000Z (over 1 year ago)
- Last Synced: 2024-04-06T14:31:54.649Z (10 months ago)
- Topics: docker, kubernetes, message-broker, microservices, mongodb, nats-streaming, node-js, object-oriented-programming, redis, typescript
- Language: TypeScript
- Homepage:
- Size: 270 KB
- Stars: 18
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![logo-no-background](https://github.com/ahmedeid6842/Code-Base/assets/57197702/8898f229-8118-4c1c-8a0b-89a84c60f949)
Tickets Microservices
### ๐ Table of Contents
- [๐ Introduction](#introduction)
- [๐ Getting Started](#getting-started)
- [Prerequisites โ](#prerequisites)
- [Environment Variables :key:](#environment-variables)
- [Setup โฌ๏ธ](#setup)
- [Install :heavy_check_mark: ](#install)
- [Usage ๐คฟ ๐โโ๏ธ](#usage)
- [๐ API Reference](#api-reference)
- [๐๏ธ๐จ Architecture](#architecture)
- [๐ฅ Authors](#authors)
- [๐ค Contributing](#contributing)
- [โญ๏ธ Show Your Support](#show-your-support)
- [๐ญ Up Next](#up-next)
- [๐ Lessons Learned](#lessons-learned)
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.To get a local copy up and running, follow these steps.
In order to run this project you need:
### Environment Variables :key:
To run this project, you will need to add the following environment variables to your [secrets.yaml](./infra/k8s/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](https://www.base64encode.org/)._
### Setup โฌ๏ธ
1. Setup Ingress-Nginx Controller, refer to the [documentation](https://kubernetes.github.io/ingress-nginx/deploy/) 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:
```bash
cd my-folder
git clone https://github.com/ahmedeid6842/Tickets.git
```### Install :heavy_check_mark:
Install this project with **[kubectl](https://kubernetes.io/docs/tasks/tools/)** :
```bash
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:
```bash
kubectl get all
```
- Alright, it's showtime! ๐ฅ Hit `ticketing.dev/api/users/currentuser` and BOOM! ๐ฅ You should see the microservices working like a charm. โจ๐งโโ๏ธ
> _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._
### Postman ๐คฉ
Here is the link to the Postman documentation for Tickets: **[Postman Docs - Tickets](https://documenter.getpostman.com/view/10444163/2s946feY8x)**.
- 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.
## ๐ค Author
**Ahmed Eid ๐โโ๏ธ**
- Github: [@ahmedeid6842](https://github.com/ahmedeid6842/)
- LinkedIn : [Ahmed Eid](https://www.linkedin.com/in/ahmed-eid-0018571b1/)
- Twitter: [@ahmedeid2684](https://twitter.com/ahmedeid2684)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](https://github.com/ahmedeid6842/Tickets/pulls) ๐ or create a [new issue](https://github.com/ahmedeid6842/Tickets/issues/new) ๐ก. Your contribution will help make this project even better! โค๏ธ ๐ช
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 ๐จโ๐ป.