Slack Lunch Club, Part 2/7: Project Setup

Image for post
Image for post

Please read Part 1 if you have not.

This part is an overview of the this pull request.

3rd Party Setup

We will be using Amazon Web Services exclusively. I have tried almost all the other providers and too be frank, they are generally not as good yet. Their free tier is very generous as well, which is great for small fish like us. This stack costs about $10 per month to run.

All the necessary accounts are listed here in Step 1 in the README.

Docker, Eslint, Stylelint, Flow, Prettier, and App Secrets

We will use Docker for repeatable dev and testing environments.

Eslint, Stylelint, Prettier, and Flow Type are awesome tools. They are pretty much required for any serious javascript project, though you could use Typescript instead of Flow if you like. I prefer Flow because it is incrementally adoptable and well supported by other Facebook tools (React, GraphQL).

The way I chose to manage application secrets / environment variables is very simple and really only works for tiny projects / teams. If its just you building an app, don’t waste time with HashiCorp Vault or other sophisticated tools. Just create a strong master encryption key for the project ( a GUUID ), and trust that the key will be kept safe. See the README for more instruction on usage.

Editor Setup

I’ve used Sublime Text, then Atom, but now I’ve fallen in love with Visual Studio Code. VSCode is a phenomenal editor which I highly recommend. Here is a gist of my settings for this project, which you can sync with the settings-sync extension. https://gist.github.com/mikestaub/1655b37a0b40915f646ed82d7231ce6e

Serverless

For side projects that don’t get much traffic, it makes no sense to pay for a server that is barely used. The scalability and resiliency of FaaS is great, and for small teams you just want to focus on your business logic, not dev ops.

This Serverless, Inc company is doing great work. They provide an easy to use, open source CLI that works with different cloud providers. The community is huge and growing daily. There are tons of awesome plugins that make extending the framework a breeze.

Usually launching an AWS lambda function with this tool takes literally 1 minute, but because we are using a custom database, (ArangoDB) we will have to create a bit more infrastructure first. We need to create a VPC, with private and public subnets. We also need a NAT instance to let our private lambdas connect to the internet, and an OpenVPN instance to allow us to connect to our private instances (like the ArangoDB web UI ).

Note: If you do not need advanced graph features, I recommend using AWS DynamoDB — it would greatly simplify this stack. AWS recently launched their own graph database service soon called Neptune, but it supports the Gremlin Query Language, which is not as nice as ArangoDB’s AQL and doesn’t support nested properties in the documents. Using an EC2 backed database goes against the serverless ideology, but based on my benchmarks it is an acceptable trade-off for this specific application.

The global-aws folder will launch all the AWS resources we need that are not stage-dependent ( security groups, SSL certificates, etc). Serverless supports CloudFormation templates, which makes all of this easy and repeatable.

Just follow the steps in the README to launch the resources.

Now that we have our global-aws stack deployed, let’s move on to Part 3.

Written by

Engineer. Investor. Founder peapods.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store