Introduction To SteamPress

Written by Tim on Friday, February 10, 2017. Last edited on Wednesday, May 17, 2017.

Welcome to SteamPress! SteamPress started out as an idea - after all, I was porting sites and backends over to Swift and would like to have a blog as well. Being early days for Server-Side Swift, and embracing Vapor, there wasn't anything available to put a blog on my site, so I did what any self-respecting engineer would do - I made one! Besides, what better way to learn a framework than build a blog!

I plan to put some more posts up going into how I actually wrote SteamPress, going into some Vapor basics like Authentication and other popular #help topics on Slack (I probably need to rewrite a lot of it properly first!) either on here or on https://geeks.brokenhands.io, which will be the engineering site for Broken Hands, which is what a lot of future projects I have planned will be under. This however requires DynamoDB integration with Vapor (which the Swift SDK work has been started here) as that is what I use for most of my DB usage (it's cheap, I don't have to manage any DB servers etc and I can tear down/scale web servers and the DB will scale in parallel without me having to do anything). But I digress...

Usage

I designed SteamPress to be as easy to integrate as possible. Full details can be found in the repo but as an overview:

You need to add it as a dependency in your Package.swift:

dependencies: [
    ...,
    .Package(url: "https://github.com/brokenhandsio/SteamPress", majorVersion: 0, minor: 1)
]

Next import it at the top of your main.swift (or wherever you link it in):

import SteamPress

Finally initialise it:

let steamPress = SteamPress(drop: drop)

That’s it! You can then blog away to your hearts content. Note that the first time you access the login page it will create a admin user for you, and print the credentials out (you need to restart the Heroku app at this point to flush the logs for some reason if you are trying to run on Heroku)

You also need to link up all the expected templates, so see the README for that, or look at the Example Site - this code that powers this site!

Features

One of the reasons for writing this post is to show off some of the features of SteamPress! As you can see, we have blog posts (obviously!), multiple users for the blog and you can tag blog posts with different labels to help categorise posts. Currently (especially in the example site), the list of users, labels etc isn’t particularly functional but it will be expanded over time. We also have pagination for large number of posts.

There are also some hidden features that prove useful. You can write posts in markdown and then use LeafMarkdown to easily format your posts. Combine it with some syntax highlighting (I use http://prismjs.com on this site and you can easily write code and have it highlighted for you, as seen above. Great for technical blogs especially!)

Roadmap

Currently I have released SteamPress under version 0 as I expect there to be some significant, most probably breaking, changes coming up to add better functionality. Among these include comments (probably just using Disqus) and making the site a bit easier and nicer to use with some Javascript to do things like form validation and making the labels UI a bit better. Also it would be nice to improve the experience of writing posts (some sort of preview function?), as well as things like AMP and generally tidying the code up! Also, the site desperately needs some UI love!

Other things include:

  • Proper testing!
  • Remember Me functionality for logging in
  • Slug URL for posts - helps SEO and makes life a bit easier!
  • Image uploading
  • Blog drafts
  • Sitemap/RSS feed - again for SEO
  • Searching through the blog

If you have any ideas, find any bugs or any questions, just create an issue in Github for either the main engine or the example site.

Happy blogging!

Tim