Code Monkey home page Code Monkey logo

theclub-backend's Introduction

Summary

This is subproject is the backend for theCLUB's technical test. It is built with TypeScript, Express, Prima and Postgres, and tested with Jest.

Setup

  1. run npm ci to install dependencies
  2. To setup the database, make sure docker is installed.
  • With docker installed run: docker run --rm --name postgres-playlists -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres:13-alpine
  1. To seed the database run: npx prisma migrate dev --name init, ignore the bad exit code I didn't have time to debug this (the database still seeds + creates succsessfully).
  2. The .env in this repo sets the port of the server and the details of the postgres database.

Commands

npm run dev - runs the dev server
npm run test - run the server tests

Basic architecture

  1. Data is stored in the postgres database.
  2. On initial page load this is fetched by the frontend and cached in redux.
  3. All requests to create a playist, add a track etc are sent to the backend which use the prisma ORM to operate on the database.
  4. A response is sent to the frontend which updates its cache accordingly.

TODOS

Here is a list of todos across the whole project that I would address if I had more time. I worked on this Thursday evening + night, and a bit on Friday morning - ironically I was at a gig Wednesday.

  1. Higher test coverage - I have only included a few sample tests so far, and I would opt to increase the test coverage first thing. In the front end I would also test UI elements with react-testing-library. I failed to get prisma mocking working as well (you can peep in the commit history).
  2. Error handling - I would expand the endpoints to send more verbose errors (whether database or server related), and ingest those errors in redux appropriately.
  3. Refactoring back end to dependency inject prisma
  4. Adding album covers
  5. Adding some nice transition animations with framer-motion and some general UI improvements :)
  6. Adding more songs with the database seed + fixing the dodgy exit code.

theclub-backend's People

Contributors

invisibletree avatar

Watchers

NULL INVIS 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.