Skip to content

timrourke/hamlet

Repository files navigation

Hamlet

https://raw.githubusercontent.com/timrourke/hamlet/master/header.jpg

See the project online at hamlet.timstack.com.

Hamlet, cleverly named after the play of which it is the subject, is a Backbone.js application built with a RESTful Sinatra JSON API backend.

The challenge: A social e-reading application

Using Shakespeare's masterpiece as its subject, Hamlet is an attempt to build a modern e-reader application with social features, an uncluttered reading experience, and a modern interface. Conceived and built to solve one problem well, the scope of the application's design is limited to creating an enriched reading experience for a great work of literature that is often read in groups and discussed as it is read.

Commenting is the primary feaure of the application. Users may create an account and create comments on each individual line of the play, and then upvote or downvote comments for their perceived quality.

There's something rotten in the state of Denmark

The most difficult aspect of building this project was making the best use of Backbone.js. Backbone by its very nature is a very light-weight, low-level JavaScript MVC framework that is quite unopinionated. For a newcomer to this framework, the learning curve of the API is fairly short, but the user is left to construct their own approach to application structure, inter-component messaging, and global state management.

Beware the sirens of stateful DOM might beckon your craft onto the rocky lee.

Halmet 2.0

In a second pass, I would like to rearchitect the application's components to take better advantage of Backbone.js's inbuilt messaging interface. In addition, the following features have yet to be addressed in full:

  • Adding in the footnotes from the original text
  • Replies to comments
  • Dynamic sorting of comments upon upvoting/downvoting
  • A richer social experience with personalized profiles and chat
  • Greater navigational clarity
  • Deeper exploration of securing JWTs

Technologies used

Interesting gems used

  • jwt - a JSON Web Token implementation in Ruby
  • pony - The express way to send mail from Ruby.
  • hiredis Ruby wrapper for hiredis

Installation instructions

  1. Git clone into an empty directory.
  2. Run bundle install && npm install && bower install with appropriate permissions.
  3. Using the config-example/ folder as a guide, create a folder in the root of the project called .config/. This folder is ignored by git by default to prevent publishing login credentials to GitHub or a public environment. Use the included example files as a template and complete with config parameters appropriate for your environment.
  4. Run a redis server and a postgresql server, ideally as daemonized services.
  5. Open the postgres terminal (psql in terminal) and run your migration by using the following command: \i "/path/to/project/migrations/migrations.sql"
  6. Quit postgres and run bundle exec rackup in the root folder of the project
  7. Navigate to localhost:9292, or whatever URL you've configured Rack/Unicorn/etc. to serve the project to.
  8. Read Hamlet and cry into your sherry.

About the text used

For this project, I used a public domain version of Shakespeare's Hamlet found on Project Gutenberg. This version of the play was heavily edited by Charles Kean, F.S.A. for a performance of the play on January 10, 1859. The primary revisions were for modernization of spelling, not for content or phraseology.

In addition to the modernized language in the Project Gutenberg source text, Charles Kean wrote extensive footnotes. These have yet to be implemented in the project, but will be the next feature added to the application in future versions.

About

Hamlet Sinatra Backbone e-reader application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published