The follow on from Part III: From Fiction to Function

The transition from year to year is always a weird one. Everything sort of goes to shit around December 16th and doesn't really recover until a full month later. If you can even remember what you were working on. Between the usual festivities and a 3 week trip to go Kiteboarding in The Philippines, it was easily February before work really picked back up on Ghost again.

The front end was moving along. My friend James became the second ever contributor to Ghost when he decided to take my mockups and start putting them through their paces with some initial HTML and CSS while we were sitting at the beach in Boracay. The back end had ground to a halt, however, after the frustrations with the initial WordPress plugin had left the project without any real direction.

Experimental Editing

About a year before the whole Ghost story started I was staying with my friend Robin Hawkes when he showed me this neat little OSX writing app called Mou. It had a very simple concept: Markdown on the left, and a live preview on the right. You could style the preview pane with various themes or even your own custom CSS.

I loved it. It was the thing that converted me to using Markdown, and it quickly became the writing UI that I wanted to have in a blogging platform. So I integrated that into the original idea and blog post about Ghost.

Now, in February 2013, I was talking to Robin about Mou again. But this time about how one might be able to achieve the same thing inside a browser. He suggested we put together a prototype using a couple of JavaScript libraries and see if we could do it.

As it turned out: we could.

All technologies adapt and evolve over the years. Growing and fading in popularity and ubiquity. One of the crowning achievements of WordPress is undoubtedly that it paved the way for an entire generation of Open Source software. Its popularity sparked the move of countless web hosts to supporting PHP environments.

Another technology which has been revisited countless times over the years is JavaScript, which has the added string to its bow of being able to run on both the server as well as the client. In recent years there has been huge uptick towards JavaScript again as libraries like Node.js have soared in popularity on the server side - and pretty much every HTML5 API out there is powered by JavaScript on the client side.

Almost every exciting technological innovation that's happening on the web right now is powered by JavaScript. There are also more JavaScript developers on GitHub than any other language, by a significant margin.

Given all these trends, and a working experimental editor, we started to wonder... what if we built this entire thing in JavaScript? Another interesting, if somewhat obnoxious, idea.

After all, Hannah had mentioned that she was pretty much a full time JavaScript developer now, Robin worked almost exclusively in JavaScript, and I'd been picking it up alongside my front-end work for a while now.

What could go wrong?

Exploring New Areas

By March, it felt like we were on to a good thing. What's more, it was exciting! The anchor that had weighed us down while we were trying to build the WordPress plugin was gone and we were free to explore not just new ideas, but entirely new technologies.

Many revelations followed during this period. Small things which would later turn into big milestones.

A great example of this was when it came time to look at databases. The obvious choice when working with something as hipsteriffic as Node.js is the equally trendy, skinny-jeans sporting MongoDB. What could be more sexy, more elusive, more hacker-news friendly than a slice of Mongo pie? (Actually, Redis - as it turns out)

We shaved our beards, put down our imported latin american coffee, and turned off the stereo with the music by a band you've never even heard of. You know. To think about things sensibly.

A blog is not a complex web application. It's actually a pretty simple one, with a straightforward schema. What's more, when you eliminate the concept of comments (as I already had in the original idea for Ghost) - a blog is incredibly, incredibly light on its database. It's basically just a couple of people (or many times: just one person) writing to the database when they save a new post. Everyone else reads from it.

SQLite is a file based database which requires zero configuration. Traditionally, it's used by programmers in their development environment because it's very easy to get up and running. It's then subsequently shunned in production, due to performance issues where SQLite slows down significantly handling concurrent requests to write to the database. But... as we've discussed, a blog doesn't really have any issue with that.

It meant that, to start working with Ghost locally, one would simply have to type "npm install" and everything would work right away, whether on a Mac, a PC, a Raspberry Pi, or even a USB stick. No extra installation or setup needed. Pretty incredible.

NB: Ghost runs through an ORM, so you can actually drop in any type of database you like. SQLite is simply a sensible default.

The more we experimented, the more we discovered things we loved.

One advantage of using the Express.js framework was that we could automatically make pretty permalinks by registering routes. No server configuration. was possible right off the bat. It seems obvious - but for anyone who has ever wrestled with PHP / mod_rewrite detection - it's a thing of beauty.

We also fell in love with the Handlebars.js templating language. A beautiful, semantic, customisable, logicless set of tags which we could let anyone use to theme Ghost with incredible ease. Miles ahead of arbitrarily executed PHP tags.

And it was fast. Really fast.

No Longer an Experiment

After a while, it stopped being an experiment. What started out as a bit of fun was proving to be incredible viable. This was the path that we needed to follow to make Ghost a reality.

But here's the thing. I'd taken time off from client work for a good 5 months by this point to see where I could make Ghost go. While we had a new and exciting direction, it was clear that this was something that would take a great deal of time to turn into a reality. I had time, but was fast running out of money. Hannah and Robin both had their bills covered, but no time, due to full time jobs at MOO and Mozilla, respectively.

So, I needed a plan. There were many options to secure the future of the project, and by my estimation the majority of them would be fatal to its success. Choosing the right one at this stage would be absolutely critical.

More than anything else, this step would define its true place in the world.

Next: Preparation for Trial by Fire