Mirroring developer environments across a team is a good practice to minimize “worked on my system” type bugs. A development environment that runs the app from within a Docker container can virtually eliminate this class of bugs by standardizing the environment that a Node.js application is developed in via version-controlled configurations.

Image for post
Image for post

TLDR

Why dockerize an app development environment?

Dockerize That Development Environment

Helpful Dockerized Node.js Development Environment Tips

Example docker-compose’s for Mocking Service Dependencies

This post was peer reviewed by Felipe Amorim

Why dockerize an app development environment?

Running an application via a Docker container will require additional system resources (e.g. RAM) and will generally increase a given application’s complexity. Even with these downsides, dockerizing an application can prove to be a net positive due to several…


This walk-through will demonstrate a basic Node.js Docker configuration that will allow for easy, fast, and deterministic deployments. Web app hosting services e.g. Elastic Beanstalk (EB) that support deployments of Docker containers grant developers much more control over the configuring of the deployment environment.

Edit: To fully reap the benefits of supporting a Node.js project with Docker, read the follow up to this post where we walkthrough a local development setup that also uses this Docker image.

Image for post
Image for post

TLDR

What is Docker?

Why use Docker for an App’s Deployment Environment

A Dockerized Elastic Beanstalk Environment


Redux is awesome for how it explicitly defines all possible state transformations (actions) and how those transformations mutate the store (reducers) — but it doesn’t prescribe a way for components to query the store.

One way to solve this problem is through use of the Selector Pattern, centralizing state access concerns in one place and reducing code complexity.

Image for post
Image for post

TLDR

This post was peer reviewed by Cameron Sampson

Selector Pattern

The Redux store allows an application to centralize global application state (e.g. state shared across two or more components). This is a good thing in that it reduces application complexity. …


Image for post
Image for post

Web applications typically begin their life serving their own static assets (JavaScript, CSS, etc) to the browser. An alternative to this strategy would have these assets be hosted by an asset hosting service (e.g. Amazon Simple Storage Service (S3)).

This post will demonstrate a set of deployment tasks to automate the configuration of a web application to delegate it’s static assets hosting to another service. Specifically, we will upload Webpack-generated javascript assets to an S3 bucket and then deploy the associated web application (with references to the versioned, immutable assets) to an AWS Elastic Beanstalk (EB) environment.

TL;DR

Why use an asset hosting service?


Unit test coverage grants confidence that code logic is correct(and serves as great developer documentation!). Test design can benefit from the mocking of both inconsequential, long-running processes and interactions with state external to the code under test. In addition, this mocking can help limit the scope of a test, allowing for better targeting of incorrectness. The jest testing framework provides powerful dependency mock tooling that makes this work trivial.

Image for post
Image for post

This post was peer reviewed by Kevin Hosford

TLDR


tldr: Older versions of NPM possibly handle the symbol linking associated with npm install a bit differently than modern versions. A consequence of this can manifest in the loss of some functionality of the package.json scripts property.

Image for post
Image for post

I recently git clone'd one of my Nodejs projects to a MacOS workstation that didn’t have Nodejs or NPM installed. Consequently, before running the project, I had to install both. After acquiring Nodejs and NPM, I navigated to the project directory, executed npm install, and then attempted to execute one of the project’s NPM scripts as defined in the project’s package.json. …


If one deploys a Node.js application to an Amazon Web Services Elastic Beanstalk instance that does not provide enough RAM for the application’s npm install, the deploy may fail without any clear indication of the problem. One can indirectly determine if insufficient memory is the cause of failure and then pursue several techniques to resolve this type of issue.

Image for post
Image for post

This post was peer reviewed by Lance Lacoste

Main Points

Deployment failures due to insufficient memory are difficult to diagnose with AWS EB tools

How to estimate the memory requirements of a project’s npm install

What to do if an npm install requires more RAM than the current deploy instance…


This post covers the configuring of a Node.js project to a PostgreSQL database with the popular ORM Sequelize. Also, the ease of initializing a database schema with Sequelize’s CLI, including the use of the associated migration framework is demonstrated.

Image for post
Image for post

This post was peer reviewed by Cameron Sampson

Object-relational mapping libraries (or ORMs) allow for database interactions to be expressed exclusively with the syntax and semantics of the programming language an application is coded in, as opposed to including literal SQL queries in a code base. An ORM models the tables of a database with classes and allows for interactions to be defined via methods (create, delete, update, etc). Relationships between tables can also be modeled in this structure, allowing for run-time enforcement of foreign key relationships. …


The tools made available by Segment provide powerful web UIs and simple yet sophisticated integration APIs that allow for powerful user analytics via the management of various 3rd-party app analytics platforms. The challenge of leveraging Segment’s API on an Angular 1.x project presents an opportunity to dig into some of the really powerful, time-saving aspects of the Angular framework.

Image for post
Image for post

Implementation of the Segment library into a web client is relatively simple. After signing up for an account and ‘integrating’ a suite of 3rd party analytics platforms (both via the Segment web UI), any web page will begin sending basic user analytics data to the Segment servers as soon as a ‘snippet’ of JavaScript is included on the page. …

About

Dean Slama Jr

A journaling of solutions to interesting problems encountered in the modern web stack @henryslama www.dslama.net

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