Stale Fallback
localhost:3000 hardcoded in production code
warningAI Quality
stale-fallbackWhy this matters
AI tools hardcode localhost URLs during development. In production, these either fail (the port isn't open) or leak information about your development setup.
✗ Bad
const API_URL = "http://localhost:3000/api";
export async function fetchUser(id: string) {
const res = await fetch(
`http://localhost:3000/api/users/${id}`
);
return res.json();
}✓ Good
const API_URL = process.env.NEXT_PUBLIC_API_URL
?? "http://localhost:3000/api";
export async function fetchUser(id: string) {
const res = await fetch(`${API_URL}/users/${id}`);
return res.json();
}How to fix
Replace hardcoded localhost URLs with environment variables. Use NEXT_PUBLIC_API_URL or similar, with localhost as a development-only fallback.