Integrations, APIs and what the government could learn

· by Ryan Lemire · Read in about 3 min · (548 words)

Today’s development and productivity tools are all about integrations and APIs, the ability to connect tools together with zero custom code. The government spends a fortune on connecting programs through complex system integration contracts and projects. This is an area they could learn a lot from the commercial sector. This blog for example is written in markdown, static web files generated with Hugo, deployed to AWS S3 through their API, subscription requests sent to a Zaiper webhook, and the email addresses are passed to a MailChimp mailing list. I set the entire thing up in less than an hour..

Hugo

Hugo is a static site generator, basically it allows you to write in markdown and the tool will generate all the HTML and static files required to render the site. It is as simple as:

The steps assume you have hugo and awscli installed with awscli configured to use your keys. If you interested you can install hugo and awscli

$ hugo new site myBlog
$ hugo new post/integrations.md
#fire up your favorite text editor
$ vim content/post/integrations.md
#check you work 
$ hugo server --buildDrafts
#create the site
$ hugo undraft content/post/integrations.md
$ hugo
#all the files are now in our /public folder

AWS S3

So now that we have a bunch of static files, what do we do with them? To the cloud! AWS S3 offers cheap static web hosting. Once you set up your domain and bucket deploying the site is one command:

$ aws s3 sync --profile lemire --acl "public-read" --sse "AES256" public/s3://$BUCKET_NAME --exclude 'post' --exclude 'favicon.png'

Which you can drop in a simple shell script such as deploy.sh

#!/bin/bash

set -e

BUCKET_NAME=lemirereport.com

#Build the site
hugo -v

#Deploy changes
aws s3 sync --profile lemire --acl "public-read" --sse "AES256" public/ s3://$BUCKET_NAME --exclude 'post' --exclude 'favicon.png'

You now have a live website that you can redeploy anytime with a simple ./deploy.sh. Since this is a blog, you also probably want people to sign up for updates.

Zaiper

Zaiper is an online tool for connecting applications together. For example you could connect GitHub (Source Control) to you team’s Slack (chat platform) and have it send updates to the chat channel any time someone commits code. In the case of the blog, I set up a simple Webhook to receive POST submits when someone adds their email address. Through Zapier and without any code I connected the webohook to MailChimp. Now when you enter your email, it goes off to Zaiper which updates my MailChimp distro.

MailChimp

All I needed to do here was set up a list through MailChimp’s web UI.

Inside of an hour I deployed a site to the cloud and integrated all aspects of the application with zero integration code. I utilized cloud platform APIs and SaaS tools, oh and all of this costs me less than $5 a month…

This is all possible because these tool providers and platforms have open APIs other platforms can read and interact with. To connect Zapier to Mailchimp I just need to login to Mailchimp through the Zapier web UI. There is no reason the government and the DoD in particular can not take a lesson from this and start requiring all programs have well defined, published RESTful APIs that any other program can access for integrations.