BETA Shoulder is in beta — Findings may sometimes be wrong. Your feedback shapes what we fix next. Share feedback

Hardcoded Development URLs

Description

Detects hardcoded development URLs (localhost, 127.0.0.1) in production code that should use environment variables.

What Shoulder detects

Hardcoded development URL found: {code} Development URLs like localhost should be configured via environment variables.

How to fix

Replace hardcoded URLs with environment variables:

Before: const API_URL = 'http://localhost:3000';
After:  const API_URL = process.env.API_URL || 'http://localhost:3000';

For database connections:
Before: host: 'localhost'
After:  host: process.env.DB_HOST || 'localhost'

Applies to

Frameworks

express fastify nodejs

References

Scan for this issue

Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=javascript-hardcoded-dev-urls .

Related rules