Giter Site home page Giter Site logo

mahabubx7 / cinebook Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 510 KB

Cinebook (Backend APIs): A platform for all cineplex to sell tickets online

License: MIT License

TypeScript 100.00%
adonisjs-framework authorization docker docker-compose json-api nodejs pbac postgresql rbac-authorization redis restful-api swagger token-based-authentication typescript

cinebook's Introduction

CineBook - Theater's online ticket booking

Backend API - AdonisJs (v5) + PostgreSQL

This is only the backend application to serve the server-side logics and processed APIs to the client applications like website or mobile apps.

Database Diagram ERD [initial]

Corrections are coming soon.

erd

Application workflows

Just demonstrating the basic workflow of this application

Latest Movies & Select a Show

flowchart TD
A[Request GET: `/movie`] --> B[Array :: of Movies : includes theater that running it];
B -- Select a `Theater` GET: /theater/:id --> C[Object :: Theater : includes screenings, required query movieId];

C -- Choose a show GET: /screen/shows?movieId=X&theaterId=Y --> D[Array :: Shows including movie & theater info];

Book a seat for the selected show

flowchart TD
A[Request GET: /screen/show/:id] --> B[Object :: Show : includes auditoriums with related info];
B -- Select an Auditorium GET: /auditorium/:id --> C[Object :: Auditorium info includes capacity of seats & more];
C -- Selects seats & make booking POST: /booking  --> D[Process :: BookingDto into a booking record with validations];
E(Seat Booking process ends);
D --  Accepted  --> E;
D --  Declined  --> E;

Some necessary hints

// Seat :: BookingDto
/**
 * @User by authentication automatically grabs the 'userId' of users/customer
 */
interface BookingDto {
  showId: number // selected: screening (i.e. Movie(1): Morning show 6AM to 10AM)
  auditoriumId: number // selected: auditorium (i.e. SuperComfortAC-5)
  date: string // i.e. '2023-12-24' YYYY-MM-DD
  seats: string[] // i.e. ['A12', 'A13', 'A14']
}

// Example Record: Accepted
/**
 * @Unique Set: ['showId', 'seatNumber', 'auditoriumId', 'date']
 * @Combination this Set makes sure that there is no duplicate record of booking
 */
const bookingRecords = [
  // each row <--> per seat
  {
    id: 1,
    userId: 777, // user-id @customer
    showId: 1, // screening
    seatNumber: 'A12', // each seat number
    auditoriumId: 2, // auditorium
    date: '2023-12-24', // YYYY-MM-DD
    status: 'pending', // status @enum ['pending', 'booked', 'available']
  },
  // ... more like this
]
Motivation

When I was preparing myself and trying to make some good portfolios that can make impression, I thought about many like e-commerce, rental, and some others as quite popular among new developers like me.

Later I decided to make some little & unique things from others to make a small difference. Then I choose this idea. Because, its quite different from any regular new developer's portfolio showcase.

More information

This application serves JSON API only. I'm using a very good node.js based framework called AdonisJs and PostgreSQL database for this.

Runtime: Nodejs (>= 18.x) :: LTS preferred
Framework: AdonisJs (v5)
Databases: [
  PostgreSQL, # As primary database
  Redis, # As system data helper
]
DbDriver: Lucid ORM (knex.js)
TypeSafe: YES <TypeScript>
Authentication: @adonisjs/auth
Authorization: @adonisjs/bouncer (policy)
Email: @adonisjs/mailer (smtp) + mjml
Docs: Swagger (OpenApi v3)
Test: @japa # adonisjs uses Japa
Storage: @adonisjs/drive-s3 # MinIO or AWS S3

Movie API usage

To fetch movie details: I am using the TheMovieDB (TMDB)

Fetch Movie poster image: https://image.tmdb.org/t/p/w600_and_h900_bestv2/{link}

Note: This is a portfolio or prototype based backend api based application with NodeJs-stack. For more info, please contact me @mahabubx7 [[email protected]]

cinebook's People

Contributors

mahabubx7 avatar

Stargazers

 avatar

Watchers

 avatar

cinebook's Issues

Migrate ⏩ to AdonisJs recommended swagger

Migrate to AdonisJs recommended swagger

  • Migrate from adonis-autoswagger to adonis5-swagger
  • Create or generate .yml schema files for each controllers & models.
  • Setup the Swagger UI

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.