Ghost – Just a Blogging Platform
The modern web is always changing, and this article is more than two years old.
Ghost is a new open source blogging platform dedicated solely to dead-simple publishing. It’s goal it to let writers write, and have fun doing it. No crazy hierarchy of menus to wade through; no finicky WYSIWYG editor mangling HTML; nothing to worry about except creating delightful posts. According to the creators of the project, Ghost is and always will be, “Just a Blogging Platform.”
The internet at large seemed to agree with this notion. Last April, a Kickstarter campaign raised nearly £200,000 to fund the development of Ghost. This funding allowed the formation of a non-profit entity to oversee the development of Ghost and manage a hosting platform coming later this year.
The Ghost project is led by John O’Nolan, who came up with the idea and drives the vision, and Hannah Wolfe who leads the development effort and makes the vision reality. Development takes place on GitHub and everything else Ghost related is available at Ghost.org.
Built on NodeJS…
One of the most common criticisms of Ghost so far is focused on the choice of technology platform – NodeJS. Many non-technical folks frown at the lack of shared hosting options and cryptic use of the command line. Developers have questioned the use of Node as a platform, stating that a traditional web application such as a CMS is better suited for more mature technologies such as PHP, Rails or Django.
The foundation of Ghost is built upon Express – a lightweight web application framework for NodeJS. Express provides a basic MVC style structure to the application as well as a pile of utilities in the form of libraries and middleware. Ghost makes heavy use of Express routes to handle requests and organize back-end logic. Other notable Node modules are integrated to help out with the model and view layers.
Another controversial technical decision made by the Ghost core team is the use of SQLite as the default database. In context, though, it makes perfect sense. Using SQLite removes the dependence on a separately installed database server. The installation process for Ghost will download a pre-compiled binary executable of SQLite for most platforms (including Windows). A database instance is set up automatically when Ghost runs for the first time. It’s all very smooth, and Ghost operates like a single cohesive application, rather than a conglomeration of applications and servers you might find with other platforms.
If the thought of running your precious blog with thousands of posts and millions of visitors on a SQLite database makes you cringe, fear not. Ghost is using a new ORM called Bookshelf, along with a query builder called Knex, to abstract away any real dependencies on SQLite itself. In fact, the core team already has Ghost working with MySQL, and community members have reported PostgreSQL working as well. Support for additional databases such as MongoDB are also planned for the future.
The view layer of the application uses Handlebars templates. As of Ghost version 0.3, part of the application is rendered on the server and returned as HTML, and part of the application functions like a single-page app. In some places Backbone.js views render Handlebars templates and make requests to Express routes for new data. It’s a little convoluted, but discussion is underway on refactoring more towards the single-page app / service-oriented architecture.
There are tons of other great libraries in use, including When for promises, and Showdown for Markdown parsing. If you are really interested in the inner workings, take a look at the repo on GitHub for a complete look at the source code. There are also plenty of interesting discussions going on in the Issues around the architecture and potential refactoring in the Top Priority queue. Much of the Ghost team is also available on Freenode (IRC) in #Ghost.
Download and Install
To get your hands on Ghost and start using it on your local machine, you have several options.
By far the easiest method so far is the BitNami installer. It is a downloadable point-and-click style installation wizard that gets Ghost running in a self contained sandbox environment. No command line interaction is necessary. It is the easiest, but also the least flexible option.
The most common method of downloading and installing Ghost is by visiting ghost.org/download and downloading a pre-built .zip file of the latest stable release. It contains all the source in the repository, but has the SASS and Handlebars templates precompiled for you. You still need to have NodeJS installed on your system beforehand though.
To install with the default settings, simply unzip the file, go to the unzipped subdirectory in your command prompt, and run
npm install --production and then
npm start. Ghost should start on localhost using port 2368. Take a look at the getting started guide for more info.
For the brave and/or curious, you can also install Ghost by cloning the GitHub repository and building it on your system with the included Grunt tasks. You will need to have Grunt, Sass and Bourbon installed before attempting this, though. The contributing guide has full instructions on installing from source.
Additionally, if you are a fan of virtual machines, the Ghost team also has a pre-built Vagrant profile available for download. I haven’t used it myself, but it’s kept up to date and has detailed setup instructions in the README file.
To keep Ghost running in the background, rather than occupying a terminal session the entire time it’s running, look into the Forever module. It allows multiple NodeJS applications to run in the background, and will automatically restart them if they crash.
Once installed, visit http://127.0.0.1/ghost to set up your user account and log into the admin panel. The interface is intuitive enough to immediately start writing – click the + icon to create a new post, go to the Settings menu to change the logo and banner image, etc… A full user guide is available at http://docs.ghost.org/usage/.
Where Ghost really shines is with its Markdown writing interface. There are a ton of keyboard shortcuts that aren’t immediately apparent, but are tremendously useful. There is a Markdown help panel and keyboard shortcut listing available by clicking the (?) icon just underneath the title. The writing interface allows you to write and format an entire post without taking your hands off the keyboard or typing out verbose HTML tags. You can even add placeholders for images using the keyboard, then drag and drop them into your post when the writing is complete. It’s very slick, and once you get used to it, is much faster than using a WYSIWYG editor.
Create Your Own Themes
Themes are intended to be as logic-less as possible with regards to content. Any manipulations made to the content or display settings should be handled by Ghost itself. In next major release (0.4), a plugin API will be introduced that will allow the creation of custom theme ‘helpers’. Some additional built-in features such as per-post banner images, and a static navigation menu interface are coming as well.
The easiest way start a new theme is to copy the default theme – Casper. Duplicate the
There are a few third-party themes listed on the Ghost Marketplace preview, and a few dedicated Ghost theme stores have popped up as well (including my own – Theme Spectre). For a more advanced starter theme, take a look at Linen (available on GitHub) which makes use of additional HBS templates, SASS, and Grunt.
Arguably the biggest roadblock to actually using Ghost as a real world blogging platform is finding a place to host it online. Those that are familiar with Node probably won’t have trouble firing it up on a VPS, but for those used to shared hosting and 1-click installers are running into friction. Luckily the popularity of Ghost has already convinced some large hosting companies to take action and create easy(er) options for Ghost hosting.
Rackspace has a predefined deployment, Digital Ocean has a ‘droplet’, BitNami lets you migrate your local installation online, and newcomer hostghost.io just gives you a pre-installed Ghost instance. Hosting yourself on a VPS is a viable option as well, and this can be done at pretty much any VPS provider. Check the ‘deploy’ page of the Ghost documentation for more info.
Ghost itself will have its own paid hosting option later this year. What’s particularly interesting is that because Ghost is a non-profit, all proceeds from the hosting platform are de-facto reinvested into Ghost. There are no owners or investors to appease, so the Ghost team is only accountable to its users.
I may be a bit biased, but I think Ghost is more than “just a blogging platform”. With all the success and popularity it’s garnered thus far, Ghost has the potential to be a ‘killer app’ for Node. Thousands of Ghost’s Kickstarter backers previously had no exposure to NodeJS, and are now (in some cases begrudgingly) accepting it as readily as they would a PHP application. Hosting services who previously had NodeJS service as an afterthought are now bending over backwards to get proper NodeJS and Ghost offerings on the table. Ghost is not the first project to thrust Node into the limelight, but it’s certainly helping it stay on the big stage.