Coder Social home page Coder Social logo

movies-app's Introduction

Fullstack Case Study

The goal of the case study was to create a simple build a simple website that with a search box where a user will be able to search for movies by name and see the list of the results.

Overview of the final result

results page:

alt text

cellphone layout:

alt text

no results page:

alt text

error page:

alt text

How to run it

make sure that you have docker installed on your machine. If you don't have it you can download it here.

Then at project root (the same folder that contains the docker-compose.yml file) open your terminal and run

docker-compose up

this will automatically resolve all dependencies, build and start the application. After a few minutes you shall be able to access the app from your own computer at http://localhost:3000.

Overall architecture

The app is split in 2 main layers

  • frontend (made with react)
  • backend (made with node and express)

###Backend

the backend side of the app is pretty simple, it uses an express server, with async handler (so we can use async and await) directly at the handler and a caching middleware to cache repeated requests

the external calls are made with axios

frontend

The front end app, runs with react + redux + rxjs(to handle async action and side effects)

rxjs was choose instead of thunk or sagas due to easiness of manipulating streams and manipulating, dispatching new actions and filtering payloads from it. All of the described can be done with thunks and sagas, but due to the fluent api and one liners rxjs is a bit more syntaticaly pleasant IMHO.

axios was choosen as our library to execute external requests, it would be possible execute the requests with plain fetch but the cache adapter makes simpler to get the results directly from the memory in case of local caching

finally recompose was used to assemble the HOCs (again not the only way)

the components are organized in presentational (dumb) comopnents and views(containers). Only the views are directly connected to our store, the presentational components are always pure functional components each component tries to be as self container as possible so the component folders normaly contain its style and images

tests where implemented with jest + enzyme. A couple of tests were implemented to show concepts like shallow rendering, mounted tests and mocks.

How to turn it into a production ready app

right now the app is served from in dev mode with react proxy to the server, ideally a third container should be created with a nginx image. The app container would just build the app and put it's output into a volume the nginx container would use the same volume to serve the static assets and then act as a reverse proxy to the server. This would allow things like load balancing and scalling the app up by adding more backend containers

##Time spent and things I would do differently

I believe that I spent around 6 hours of work to setup the docker structure and build the app. So I consider the amount of time given a good amount. I wouldn't really change much besides of writting more and better test cases adding linting and pretty to the server.

movies-app's People

Contributors

victorrseloy avatar

Stargazers

Vonpupp avatar Maikel Neris avatar

Watchers

 avatar James Cloos avatar  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.