tonic

A static site generator based on scheduled tasks

npm install tonic
12 downloads in the last month

tonic.js

tonic.js is a node.js framework to help build websites which contain near real-time data that is retrieved from third-party APIs. This makes it especially suited for making personal dashboards or personal websites with embedded data.

Almost any datasource can be used from within tonic.js as long as it is accessible from the computer running the tonic executable. Some example datasources are Fitbit data, Yelp reviews, Facebook or Foursquare checkins, Tumblr posts, and Goodreads history. If you can write some JavaScript to access it, you can use it!

tonic.js works on OS X, Windows, and Linux.

How It Works

Why Static?

The goal of tonic was to create an extremely easy to way to build and deploy dashboard websites. Having to run and properly configure an application server and a database seems like overkill just to beable to show the last five albums I listened to on my website. I took inspiration from Jekyll and Wintersmith and decided that static site generation was the way to go. Although you do still have to run tonic on your server (at least once a day), I felt that running a single command is way easier than the knowledge required to run other solutions.

Getting Starting

Before you get started, you must already have node.js installed.

Installing

$ npm install -g tonic

Creating a Website

$ tonic new MyTonicWebsite

This will create a skeleton website. The site contains a single job which will update the main page of the website every minute with a bad joke.

Running Your Website

$ tonic run MyTonicWebsite

Once tonic is running, you can open index.html within the site's public directory. This page will update once a minute as long as tonic is running.

Note that whenever you run the tonic command, all jobs will immediately run even if they are only scheduled to run at a specific time of day.

Website Folder Structure

Writing Jobs

Writing Tempates

Deployment

You can easily deploy the static pages generated by tonic to any webserer, however, it makes more sense to have your site automatically update. In order to do this, you need to have a server that supports node.js.

Deploying to your own server

If you have access to your own server where you can run processes, this is by far the easiest deployment method. Simply follow the same process as above and configure your webserver to serve static files from your site's public directory.

It is also probably a good idea to use something like upstart or forever.

Deploying to Heroku

TODO

Deploying to Windows Azure

TODO

Deploying Elsewhere

Probably possible, feel free to update this with anything else that has worked for you.

npm loves you