Past events

Managing
Configurations in
Node.js

TUESDAY - November 21ST 2023

Matteo Collina

Managing Configurations in Node.js

In the beginning, there were configuration files. Every environment had one committed to a repository. Then, we discovered the beauty of  12-factor applications and of having environment-specific values set as environment variables.Then, NODE_ENV came along, and shattered our idyllic world.

Libraries with millions of weekly downloads check for
NODE_ENV=production to enable optimizations, changing the behaviour of applications. Given this worked so well, developers started loading configuration files (or secrets) based on the value of NODE_ENV to identify _their_ "production" environment.

However, questions began to arise. What value should be used for the staging environment? What about QA? Ultimately, If the same code isn’t run everywhere, we face being hit by bugs that cannot be reproduced across environments, which leads us to set
NODE_ENV=production everywhere.

In this masterclass, we explored:

Why managing configurations is important;

How to distinguish between environments;

What risks NODE_ENV can pose;

Node.js configuration best practices;

How to set up Node.js configurations with Platformatic

During the class, you’ll have the opportunity to ask Matteo your questions about Node.js application design.