ORMs and deployments - Code with Hugo 13
Writing modern #Sequelize
Sequelize is a popular and stable ORM for Node. The downsides to this stability and age is that its syntax and docs are a bit incomplete and outdated.
Reading through issues and the source I realised there’s a better way to write Sequelize with ES6. That’s why I’m working on a Sequelize ES6 cheat sheet.
I’m not a huge fan of ORMs. They’re a leaky abstraction, you still need to understand relational databases to run one effectively. They’re also a necessary evil to avoid re-inventing the wheel and organise your code to be able to scale a development team.
1. Using ES6 classes for Sequelize 4 models
A taster of what the Sequelize ES6 cheat sheet will look like. It walks through using ES6 class syntax (+ inheriting from Sequelize.Model
) to define models.
2. Unit testing Sequelize 4 ES6 class models
The companion article to “Using ES6 classes for Sequelize 4 models”. A look at the how and why of unit testing Sequelize ES6 class models.
In other news, the Sequelize ES6 cheat sheet is slowly taking shape, you can keep track of progress on 🚧 WIP.
#Deployment and #CI
1. CircleCI 2.0 local CLI Using CircleCI extensively, I wish I had known about the local CLI earlier. The CircleCI local CLI allows you to run your builds locally, which is better than repeateadly hitting the CI server with commits of varying quality.
2. Deploy to multiple environments with git and CircleCI
3. How I host things
An answer to a wip.chat question: “What is your dev stack of choice”.
- frontend:
- Vue: simple to get started with, grows up with you (you can add a store/router later)
- handlebars (server-rendered)
- static HTML (from a static site generator)
- backend:
- Express/Node (goto): Simple and stable setup with above average performance and talks JSON by default.
- Netlify lambda (evaluation stage): Would reduce infrastructure work and costs, there’s a vue-cli plugin as well (vue-cli-plugin-netlify-lambda)
- static hosting:
- GitHub Pages: free, available without touching any other service (see “Build and deploy a Vue/React/vanilla JS app with Parcel and GitHub Pages”)
- Netlify
- application hosting:
- now.sh: not the cheapest but gives you immutable deploys and a simple command-line interface (a deploy is just
now
) - Heroku:
git push heroku master
😁 - Cloudflare for DNS + CDN
- now.sh: not the cheapest but gives you immutable deploys and a simple command-line interface (a deploy is just
- database:
- Postgres: it’s stable, it’s fast, it’s relational, it has all sorts of goodies like JSON, JSONB fields.
- Airtable: it’s easy to manage, it’s relational, it has a nice API/Node.js client library, try it here.
I’m still on the lookout for good/cheap database hosting, which has lead me towards Dokku possibly spun up on DigitalOcean.
From the web
1. Simple Analytics “Simple, clean, and friendly analytics”, has been making splashes both on HackerNews and ProductHunt, you can see Code with Hugo analytics at https://simpleanalytics.io/codewithhugo.com.
2. Why/how words with friends is adopting React Native - Zynga Engineering
A great post by Zynga Engineering on their progressive adoption of React Native to write the non-game screens of “Words with friends”.
3. Using Airtable as a handy cloud storage for your apps - Flavio Copes
This explains Airtable and walks you through setting it up better than I can.
4. You Calendrical Fallacy Is…
Nice walkthrough of issues we come across when working with dates and times.
5. How we track pageviews is all wrong - Philip Walton
An exploration on a better way to track pageviews on the contemporary web.
As always you can get in touch on Twitter @hugo__df or by replying to this email :).