hypermasher
hypermasher copied to clipboard
A Node.js application which shows users a stream of the latest Hyperlapse videos set to chill music
Hypermasher
NOTE: I no longer maintain this repository. I also believe the Instagram API it used has been deprecated. Further, I no longer own hypermasher.com and I am not responsible for the content there today.
Hypermasher is a Node.js application which shows users a stream of the latest Hyperlapse videos set to chill music.
It was created by Andrew T. Baker as part of his funemployment. It is open source under the Apache 2.0 license.
Reception
Hypermasher inspired Hyperlax, a much better implementation of this concept created by Taylor Crane.
Both apps were featured in the very first episode of Rate My App. You can watch the video here.
Getting started
Hypermasher is a fairly lean app and takes minutes to set up. It uses redis to store metadata about the videos it serves, but has no other components outside of Node.js.
To run Hypermasher, you need to get API keys from Instagram. Once you have those, you can run Hypermasher natively through npm or through Docker using docker-compose.
Instagram API keys
To get your Instagram API keys, visit their developer site: http://instagram.com/developer. Follow the prompts for "Register your Application".
You'll know you're done when you see values for CLIENT_ID and CLIENT_SECRET.
Running locally with Docker
Docker is an easy way to run Hypermasher locally, but if you have Node.js and redis-server installed on your machine, you might prefer running Hypermasher through npm as described in the next section.
In addition to Docker, you will need docker-compose. Installation instructions here: https://docs.docker.com/compose/install/
To run Hypermasher locally using Docker:
- Make sure your Docker daemon is running and connected to your client. You can test this by making sure
docker psreturns a valid result cdinto the Hypermasher root directory- Set the
INSTAGRAM_CLIENT_IDandINSTAGRAM_CLIENT_SECRETenvironment variables in a new file called.envin this directory - Run
docker-compose up -d(-dto run our containers in detached mode) - Connect to Hypermasher in your browser at port 8000
- If you're running Docker natively go to http://localhost:8000
- If you're using boot2docker go to port 8000 on the IP address provided by the
boot2docker ipcommand. Ex: http://192.168.59.103:8000
You're now running Hypermasher locally, but we haven't fetched any videos from Instagram yet. To do that, we need to run one additional command:
$ docker-compose run node bin/getVideos
You should see a result like 33 videos primed. Now refresh your browser - you should see the first video loaded and ready to play. Hit any play button on the screen to start Hypermasher.
Running locally with npm
If you have Node.js and redis-server installed locally, then you can run Hypermasher without Docker.
To run Hypermasher locally through npm:
- Start the redis server with
redis-server cdinto the Hypermasher root directory- Install the Node.js dependencies with
npm install - Start Hypermasher with
npm start - Go to http://localhost:3000 to see Hypermasher in your browser
You're now running Hypermasher locally, but we haven't fetched any videos from Instagram yet. To do that, we need to run one additional command:
- Set the
INSTAGRAM_CLIENT_IDandINSTAGRAM_CLIENT_SECRETenvironment variables in your terminal session. I like using autoenv to make this easy. - Run the command
bin/getVideos
You should see a result like 33 videos primed. Now refresh your browser - you should see the first video loaded and ready to play. Hit any play button on the screen to start Hypermasher.
Running in production
When running in production (export NODE_ENV=production), Hypermasher caches the rendered template for the /hyperlapse route to speed up response time.
After a deployment, you can clear that template cache by running the executable found at bin/clearViews.
Testing
Hypermasher includes a couple end-to-end tests powered by Protractor. Hypermasher isn't an Angular app, but I wanted to learn Protractor a little better so I used it anyway.
Running the tests
You will need to install Protrator and a webdriver. For most people, all you need is:
$ npm install -g protractor
$ webdriver-manager update
Before you can run the tests, you need to start the Hypermasher server and the Selenium server:
$ fig up -d
$ webdriver-manager start
Then, run the tests with:
$ protractor tests/conf.js