Erick Arbe 5 minute read
January 9, 2013

Goodbye Cowboy Coding. Hello Statamic.

So this site you are looking at is very new. I've owned this domain for a while, but only used it for testing scripts or setting up WordPress test sites for clients. I've never really built it out into anything meaningful. Then I heard about a new CMS called Statamic.

I started looking at Statamic as a referral from someone on Twitter who I had known primarily as a WordPress developer - and I too, primarily develop client sites on WordPress. He said that using this new CMS was a refreshing break from building on WP all the time. So of course my interest was piqued.

WordPress Vs. Statamic

So I bought myself a Statamic license and let the coding begin. I watched the few screencasts they have on their site, then began building my site locally on my machine via MAMP.

The one thing I often find myself doing with WordPress is cowboy coding (and by cowboy coding I mean never really using development or staging servers before taking my code to the production site). Now, for bigger projects I always use development servers - but the process becomes a bit of a chore. I have to launch MAMP, create a new database, download WP, install it, then launch it. Then after I get a few WP sites running on my machine, I get a clusterF of databases running.

Oh, and version controlling a site on WP (or any CMS with a database) is kind of a bitch. I say this because I usually collaborate on the content of the site with my business partner. While I'm working on functionality - he may be working on presentation and content. This is a little tough to do when working from a database that is located on my computer! So what I found myself doing was launching test sites on dummy domains. This at least allowed us to work together on the same website without too much conflict. Of course to me - it's not ideal.

Enter Statamic

The ability to version control everything - even the content of a Content Management System - was pretty mind-blowing for me. Yes, I'm a noob when it comes to flat file CMSs, so if I sound over-excited - that is why.

Statamic requires no database whatsoever - but it does run on PHP 5.3 (which I had to call hostgator to get running on our server). It also uses YAML - I have no idea what it does, but it's pretty frigin awesome. ALSO, Statamic lets you choose how you want to write your content. You can write it in HTML, Markdown, TXT, or Textile. I chose to use markdown. I've never really had to use markdown before, but now that I'm starting to write my content in markdown I'm starting to realize why it's such a terrific way to write copy - especially when writing about code.

Back to: getting off cowboy coding.

Statamic allowed me to quickly set up a dev site on my local machine with MAMP (since you have to run PHP). I was up and running in a matter of minutes. Just edit the .htaccess file and you're good to go. I was able to start building the site exactly how I wanted through good ole' HTML, CSS and JS. It was also nice to have live refresh enabled through the use of CodeKit. After that I was adding my own content and started with version control on GitHub. This was the turning point for me - realizing that versioning, testing, setting up a staging site, and setting up the production site where all going to be a seamless transition. There's no back and forth, copying and pasting, creating new databases, exporting and importing SQL files, and worrying about where the latest version exists. Everything just got a little more simple. Oh - and I don't have to edit the site on the production server anymore (AKA cowboy coding). Not that I had to in the first place, but now it's just waaaay easier to make all my edits on the dev site. Whewh.

Added Bonus: Site Security

With WordPress there are definitely some security risks. For starters - you're running a database. Anytime you run a database there is risk of some type of injection. Of course there are many ways to protect your WP install - like moving the wp-config file above the site root, or changing the database prefix, the list goes on. But with Statamic there is no database (yes, I probably sound like a broken record now) so the risk of a database injection is completely eliminated! Woot! Also, moving the content and config files above the public site root is super crazy easy to do. This just gives a terrific layer of security.

Building From the Content Out

Statamic has definitely made me rethink how a content management system should work. I've had a complete mental change in how I go about architecting websites now. I guess it also helps that I just finished reading Content Strategy For Mobile by Karen McGrane - a book I highly recommend. The content truly comes first and I can easily manipulate the content management system for what ever it is that I am trying to accomplish with this website rather then building layers on top of existing layers that exist in a more defined content management system.

So could we start to see more flat-file Content Management Systems in the future? I sure hope so. Databases will always have a time and place - but when they're just a little overkill, a static site generator will work wonders. And you'll probably see me creating more client sites with this lovely little CMS.