Code Monkey home page Code Monkey logo

ticketing_app's Introduction

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

ticketing_app's People

Contributors

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