Backend service for mobile/web application for a small cinema playing only movies

Related tags

App ffc
Overview

FFC - Fast & Furious Cinema

ffc.jpg

Stability: Experimental

Backend service for mobile/web application for a small cinema playing only movies from Fast & Furious franchise. Some assumptions were made and some shortcuts were implemented. So be warned that this is just an experimental version.

Build and run

There are some prerequisite to play with the project:

  • Docker should be installed - as integration tests are using Testcontainers to avoid all those in-memory/embedded/mocked solutions, and check if integrations really works.
  • Docker Compose should be installed - as project is using MongoDB for persistence, and starting provided docker-copose.yaml is painless way to run it locally.
  • OMDb API Key is required - as movie details are fetched from OMDb API.

You can build the service and run all the tests with ./gradlew clean build. All boilerplate REST API code is generated from OpenAPI specification and all code for mappers is generated from MapStruct annotated interfaces, so if you decide to import this project to IDE of your choice, some missing classes can be reported. Just re-build the project to fix that issues.

If you want to start the application locally, then all you have to do is start all dependencies with:

docker-compose up --detach

And after that start the service with:

ADAPTERS_OMDB_API_KEY=<change-me> ./gradlew bootRun

NOTE: Just remember to use proper API key for OMDb API instead of <change-me>. And when you are done playing with the application tear down MongoDB with docker-compose down --volumes.

After application is up and running you can explore the API and play with it using:

Some API methods requires you to be authenticated user. You can use one from table below. Mind that STAFF role will allow you to execute methods from internal API.

Username Password Roles
kermit secret STAFF, USER
elmo secret USER

So simple yet so complicated

I have assumed that cinema that is showing only nine rather mediocre movies will not be operating on daily basis - fixed ticket prices and showing hours. Rather in from event to event manner. And because of that internal API for showing dates and ticket prices looks so simple. Staff member can create an event for a given date with list of screenings and dedicated ticket prices for each of them. Also, that simple PUT for date method could be easily extended to accept POST-ing an ultimate representation of everything - Excel spreadsheet (or at least his simpleton brother CSV file).

One of expected results of the challenge was API documentation in OpenAPI/Swagger format. I have turned that requirement around - I have started with designing specification and using it as an an input for generating REST controllers interfaces and models, and input for validator of incoming requests.

I was trying to design REST API with Richardson's Maturity Model Level 2 in mind, and because of that there are separate resources for showings, movie details and ratings. I hear whining of front-end developers - and now we have to make multiple api calls to get everything what we need. For example to get movie details and its showing hours for given day. Well... you don't have to. As an extra, GraphQL API was implemented, so you can use it to get what you need. Following query result will return movie title, average rating and showing times in a single server call.

{
  movieDetails(id: "tt0232500") {
    title
    averageRating {
      averageRating
      votesCount
    }
    showings(from: "2021-12-06", to: "2021-12-12") {
      date
      showings {
        startAt
      }
    }
  }
}

It compiles - deploy

Hell no - there's still a lot to be done. I think that in Fowler's Make It Work - Make It Right - Make It Fast, current state of the service is just after It Work.

At least following should be done:

  • Unit tests for all generated mappers, alongside with some programming suggar in form of convenient test data builders/fixtures.
  • More fine-grained integration tests - now different scenarios are cramped in one place. Also some "glue" in form of helper methods should be implemented - for example for setting up service state for given scenario.
  • Paging in results of API methods returning collections - to avoid returning large payloads and crippling service performance.
  • Real security config.
  • Real cache implementation and configuration - as one currently used can lead to memory leaks (no restictions on cache size or time), and return inacurate data as OMDb API responses are cached indefinitely.
  • Circuit breaker and fallback movie details provider for case when OMDb API would be unavailable.
  • API rate limiting and monitoring - to know if service is performant enough and to know when some less naive (non blocking?) implmentation will be required. Not to forget about DoS attacks detection.
  • Better exception handling.
  • Logging - for now code base is so simple, that I have forgotten about this aspect until now.
You might also like...
Open Super dApp - Your gateway to the new digital commons. Integrated mobile messenger, Ethereum wallet, and Web 3.0 browser built on open, decentralized, and encrypted protocols.
Open Super dApp - Your gateway to the new digital commons. Integrated mobile messenger, Ethereum wallet, and Web 3.0 browser built on open, decentralized, and encrypted protocols.

A fully open source, open standard, decentralized "super app" including a secure, encrypted Matrix compatible messenger based off of the Element Messenger, and an Ethereum crypto wallet and web3 browser based off of Alpha Wallet.

An Android mobile app for viewing device screen in your web browser
An Android mobile app for viewing device screen in your web browser

Screen Stream over HTTP An Android mobile app for viewing device screen in your web browser. Developed by Dmitriy Krivoruchko · If there are any issue

You can store all your password, bank details, card details in one place and remember only one master PIN. The application works totally offline.
You can store all your password, bank details, card details in one place and remember only one master PIN. The application works totally offline.

Keep Password An application where you can store all your password, bank details, card details in one place and remember only one master PIN. The appl

📒 NotyKT is a complete 💎Kotlin-stack (Backend + Android) 📱 application built to demonstrate the use of Modern development tools with best practices implementation🦸.
📒 NotyKT is a complete 💎Kotlin-stack (Backend + Android) 📱 application built to demonstrate the use of Modern development tools with best practices implementation🦸.

NotyKT 🖊️ NotyKT is the complete Kotlin-stack note taking 🖊️ application 📱 built to demonstrate a use of Kotlin programming language in server-side

Book Parking is a demo application based on MVVM architecture. The app allows users to booking parking slots, the app uses firebase for the backend.
Book Parking is a demo application based on MVVM architecture. The app allows users to booking parking slots, the app uses firebase for the backend.

Book Parking is a demo application based on MVVM architecture. The app allows users to booking parking slots, the app uses firebase for the backend.

A full-stack application showing the power 💪 of KOTLIN. Entire android app + backend Apis written in Kotlin 🔥
A full-stack application showing the power 💪 of KOTLIN. Entire android app + backend Apis written in Kotlin 🔥

Gamebaaz 🎮 A full-stack application showing the power 💪 of KOTLIN. Entire android app + backend Apis written in Kotlin 🔥 Android Backend Jetpack Co

A simple app to show case Master detail application for Movies
A simple app to show case Master detail application for Movies

Decade of Movies App Demo Application to understand the architecture of MVVM App with Unit tests Build Instructions The gradle build system will fetch

An Application that displays movies details
An Application that displays movies details

Movies An Application that displays movies details Architecture This Application follows the Ports & Adapters architecture, where the application logi

🎥 A Simple and Minimal Movies Android Application to demonstrate the Modern Android Development and Jetpack Compose.
🎥 A Simple and Minimal Movies Android Application to demonstrate the Modern Android Development and Jetpack Compose.

ComposeMovie Android 🎥 A Simple and Minimal Movies Android Application to demonstrate the Modern Android Development and Jetpack Compose. Built with

Owner
Łukasz Lipka
Łukasz Lipka
Movies-db-example - Sample Android application that loads movies data from a remote server

Movies Application Sample Android application that loads movies data from a remo

Bilal Ibrahim Hairab 0 Feb 8, 2022
Movies - Simple Application to show movies and advertisemnets

Movies Simple Application to show movies and advertisemnets Technologies This Ap

Reham Galal 0 Feb 3, 2022
Small library that allows the application to display a small troubleshooting guide in case of repeated app startup crashes.

AppSalvager What is it? AppSalvager allows you to combat the issue of repeating crashes on app startup. Failed data migration, SDKs not handling their

Alexander Leontev 29 Aug 31, 2022
A Music Player for android that renders beautiful DNA(Visualization) of the currently playing music.

MusicDNA - A Music Player like no other A Music Player for android that makes use of the Visualizer Class for rendering a beautiful DNA (Visualization

Harjot Singh Oberai 2.8k Jan 5, 2023
The android port of the 2048 game (for offline playing)

2048-android This is the Android port of the 2048 game made by Gabriele Cirulli https://github.com/gabrielecirulli/2048 It's nothing fancy; just a Web

Paul S 996 Dec 24, 2022
Wandroid project based on Kotlin + JetPack + concurrent implementation of MVVM architecture for playing Android App

Wandroid project based on Kotlin + JetPack + concurrent implementation of MVVM architecture for playing Android App

null 32 Feb 13, 2022
Mobile app to Show Movies From TMDB API [Qhala Interview Solution], for the Android Engineer Role

Qhala Interview ?? ?? This is an Interview Tech challenge by Qhala I used TMDB API to solve this challenge. Screenshots Movies Movie Detail Prerequisi

James Nyakundi 5 May 1, 2022
Android Phishing Application.This Project is for Educational purposes only.The Developer of this application is not responsible of any bad usage

Android Phishing Application.This Project is for Educational purposes only.The Developer of this application is not responsible of any bad usage

Aria Shirazi 93 Oct 23, 2022
Application: SLA report This application calculates, based on an input, the average duration per service of Axon.

Application: SLA report This application calculates, based on an input, the average duration per service of Axon.

null 3 Aug 5, 2022