Skip to content

lambley/ticketing_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ticketing_app

Ticket reselling app created using microservices architecture

Technologies:

  • React (Frontend)
  • Typescript and Express - creating an npm library (Backend)
  • MongoDB and Redis (Database)
  • Next.js (Framework)
  • Docker, Kubernetes, NATS streaming server (Infrastructure)
  • Google Cloud (remote environment) [optional]

Global Dependencies

Features

  • Users can list a ticket for an event for sale
  • Other users can purchase this ticket
  • Any user can list tickets for sale and purchase tickets
  • When a user attemps to purchase a ticket, the ticket is 'locked' for 15 minutes
  • While 'locked', no other user can purchase that ticket
  • Ticket prices can be edited if they are not locked

Resource Types

User
email string
password string
Ticket
title string
price number
userId reference to User
orderId reference to Order
Order
userId reference to User
status created/cancelled/awaitingPayment/completed
expiresAt Date
ticketId reference to ticket
Charge
orderId reference to Order
status created/failed/completed
amount number
stripeId string
stripeRefundId string

Service Types

Name Desc
auth all signup/in/out
tickets controls creation, editing, and ticket update logic
orders creating and editing orders
expiration monitors order time (default 15mins), after which an order is cancelled
payments responsible for charges via stripe

Event types

  • UserCreated UserUpdated
  • OrderCreated OrderCancelled OrderExpired
  • TicketCreated TicketUpdated
  • ChargeCreated

GoogleCloud

  • notes on remote setup here

Testing in Microservices

  • Using Jest - with command npm run test.
  • Make fake requests with supertest library.

Scope:

  • Test a single piece of code in isolation - e.g. Unit Tests for individual middleware
  • Test how different pieces of code work together e.g. from one middleware to routehandler
  • Test how different components work together e.g. testing microservice
  • Test how different microservices work togehter e.g. how orders service works with ticketing service

Test Goals

  • Basic Request Handling
  • Unit Tests for database Models
  • Event emitting and receiving

Flow for creating each service

  • Create package.json with npm init -y and install dependencies
  • Write Dockerfile
  • Create index.ts as entry point for project
  • Build docker image and push to docker hub
  • Write k8s file for deployment and service(s) e.g. ClusterIP
  • Update skaffold.yaml for development update syncing
  • Write k8s file for MongoDB deployment and service e.g. ClusterIP

About

ticket reselling app created using microservices architecture

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published