Skip to content

bluz71/platters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Platters

About

This application, Platters, is an example web application developed using the Ruby on Rails web framework and associated technologies.

The Platters application is my complete album collection converted into a database-backed web application with optional user registration, log in and commenting components.

Platters is primarily a server-side application with sprinkles of JavaScript. Note, using a client-side JavaScript framework, such as Ember.js or React, was ruled out due to complexity for such a small application such as this.

Build Status

Build Status

Core Technologies

Significant Libraries

Deployment

Development Tooling

Testing Framework and Tooling

Miscellaneous application features

  • Busy submission buttons

All form submission buttons use the Rails Unobtrusive JavaScript (UJS) data-disable-with functionality to disable, and display a spinner icon, whilst a submitted form is being processed.

  • Client-side form validations

Certain form elements, such as Artist name and Album title, are validated client side for blankness in addition to traditional server-side validation.

  • Turbo Drive

This Rails application uses Turbo Drive for performant in-app page to page navigation. The Turbo top-of-page progress bar is enabled to provide visual feedback for page navigation that takes longer than 500ms. Turbo Drive also loads visited in-app pages from an internal transition cache, this will result in near instant page loads for cached pages, with later automatic page refresh if page changes have occurred. The transistion cache is disabled only for the randomized albums page due to a jarring effect with cover images.

  • PostgreSQL text search

Artist and Album search both use the PostgreSQL @@ text search operator which provides support for: English dictionary stemming, multi-word search, stop words, and fuzzy text search for misspellings.

  • Auto-hide Flash messages

Flash notice messages, as seen during resource creation, deletion and modification, will automatically hide, then be removed after a few seconds as well as being user dismissible.

  • Infinite scrolling comments

Album, artist and user Comments will be displayed in bundles of 25 at a time, newest to oldest. Scrolling to the end of a page of comments will result in the retrieval of the next 25 comments, and so on until all comments have been retrieved. Whilst comments are being retrieved a spinner icon will be displayed until that batch of comments have been appended to the page. This behaviour is modelled on Twitter infinite scrolling.

  • Show all / show less Album tracks

Albums with more than twenty tracks will, by default, show only the first twenty tracks with a fade effect over the last four tracks of those twenty. A toggle is available to show all tracks, and once selected a show less toggle is then provided.

  • Comment limits per-user per-day

Users are only allowed to post 100 comments per-day. This will prevent rogue users abusing the site.

  • Polymorphic associated comment model

Comments can be posted for artists and albums, hence individual comments can belong to either an artist or album instance. Polymorphic associations are the most elegant way to model this multi-owner relationship.

  • Counter caches

Counter caches are a mechanism to efficiently return the number of records through a has_many association. Using counter caches avoids the SQL COUNT operation which is an expensive operation especially for very large tables. Counter caches are defined for: Artist albums_count, Artist comments_count, Album tracks_count and Album comments_count.

  • Short-lived API tokens with unobstrusive refreshing

The separate React-based front-end application uses JSON Web Tokens for sesssion management. The tokens created by this server are short-lived (30 minutes), but can be unobtrusively refreshed (up to 6 months). Note, resetting a user password via Forgot Password? in the front-end application will invalidate all current API sessions for that user, useful if the user has had their session hijacked via a lost or stolen machine.

Why Rails

Ruby on Rails was chosen early on, from a host of possible web development choices, due to the following appealing factors:

  • Developer happiness and enjoyment.
  • Unix based tooling, development and hosting.
  • Active communities, both locally and abroad.
  • Future employment possibilities.
  • Gateway to interesting new technologies.

About

An example Ruby on Rails application hosted at: https://platters.cc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published