Env vs Constants | The 4 Types of Config Values Every Developer Should Know

Опубликовано: 29 Май 2026
на канале: Mufty Codes
61
16

Many developers—especially beginners—struggle with one common question:

Should this value go into a .env file or should it be a constant in the code?

In this video, I break down a simple framework that helps you decide exactly where configuration values should live in your application.

Instead of guessing, you'll learn how to classify values based on two key factors:

Whether the value is secret
Whether the value changes across environments

Using this approach, we arrive at four categories of configuration values:

1. Secret and Constant
2. Secret and Dynamic
3. Not Secret and Constant
4. Not Secret and Dynamic

Understanding these categories will help you build applications that are:
More secure
Easier to configure
Easier to maintain across development, staging, and production environments

This is an important concept for developers working with modern frameworks and tools like Node.js, Next.js, Docker, and cloud platforms that rely heavily on environment-based configuration.

If you've ever been unsure whether something belongs in a .env file, a config file, or a constants file, this video will give you a clear rule you can apply in any project.

What You'll Learn
What environment variables are
What constants are in application code
The difference between secret vs non-secret values
The difference between constant vs environment-dependent values

A simple rule to decide where configuration values belong

Chapters
00:00 Introduction
00:30 The Two Factors that Matter
01:47 Secret and Constant
01:19 Secret and Dynamic
01:54 Non_Secret and Constant
02:22 Non_Secret and Dynamic
02:50 Final Thoughts