Skip to main content
Hostwares

How to Keep Production Configuration Different From Development

sowad sheikh··1 min read

Your development environment is designed for experimentation.

Production is designed for real users.

They should not necessarily have identical configuration.

A Simple Example

Development:

NODE_ENV=development API_URL=http://localhost:3000 PAYMENT_MODE=test

Production:

NODE_ENV=production API_URL=https://api.example.com PAYMENT_MODE=live

The application code can remain mostly the same.

The environment changes.

Why Separate Configuration?

You don't want development testing to:

Send real emails Charge real cards Modify production data Call expensive production APIs Accidentally notify real customers Keep the Differences Explicit

Write down which variables differ between environments.

For example:

DATABASE_URL API_URL PAYMENT_KEY EMAIL_PROVIDER LOG_LEVEL

This makes deployments easier to understand.

Don't Copy Production Secrets Into Your Laptop

If you need production access, use the minimum credentials required.

Development should be able to work without exposing unnecessary production secrets.

Hosting Configuration Is Part of Deployment

Hostwares lets environment variables be configured per site and made available during build and runtime.

That means different deployments can use different configuration while sharing the same source repository.

Same Code, Different Environment

That's the goal.

Same repository ↓ ┌─────────────┐ │ │ Dev Prod │ │ Test config Live config

Keep your code reusable and your environments intentionally different.

Ready to deploy?

Launch your app on Hostwares — start for $1.00/mo with auto-scaling & global CDN.

Start for $1.00/mo

Ready to deploy? Start for $1.00/mo

Deploy now