nestjs config doctor

    by Saeed Gholami

    3

    Diagnoses NestJS ConfigModule, .env, and Docker/Kubernetes environment failures — finds missing vars and misconfigurations before your app boots.

    Free

    1 installSecurity scanned

    Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLI+17 more

    See it in action

    You say

    My NestJS app starts fine on my laptop but crashes in Kubernetes with "ConfigService unable to load variable DATABASE_URL". Diagnose my ConfigModule setup, .env files, and k8s/deployment.yaml and tell me exactly what is misconfigured.

    Your agent does

    NestJS Configuration Diagnostic Report

    | Field | Value | |-------|-------| | Project | billing-service | | NestJS version | 10.4.0 | | Status | MISCONFIGURED | | Root cause | Kubernetes Secret key mismatch for DATABASE_URL |

    Summary

    Local development works via .env. In Kubernetes, the deployment references secretKeyRef.key: database_url but the application expects DATABASE_URL. Linux environment variables are case-sensitive.

    Findings

    [CRITICAL] K8s Secret key case mismatch

    • Location: k8s/deployment.yaml:34
    • Issue: Secret key database_url does not match DATABASE_URL in code
    • Impact: ConfigService.getOrThrow('DATABASE_URL') throws at startup in production
    • Recommendation: Align the Secret key to DATABASE_URL

    Environment variable inventory

    | Variable | Used in | Present in .env | In .env.example | Validated at startup | |----------|---------|-----------------|-----------------|----------------------| | DATABASE_URL | app.module.ts | Yes | Yes | No | | JWT_SECRET | auth.module.ts | Yes | No | No |

    Recommended .env.example

    NODE_ENV=development PORT=3000 DATABASE_URL= JWT_SECRET=

    Resolution steps

    1. Update the Kubernetes Secret to use key DATABASE_URL (not database_url)
    2. Fix deployment.yaml secretKeyRef.key to DATABASE_URL
    3. Add Joi or Zod validation in ConfigModule.forRoot()
    4. Replace ConfigService.get() with getOrThrow() for required variables
    5. Redeploy and verify /health endpoint responds

    About this skill

    Overview

    NestJS Config & Environment Doctor is a specialized diagnostic skill for NestJS applications that fail to start, load incorrect configuration, or behave differently across local, container, and Kubernetes environments. It performs structured, evidence-based analysis of your configuration layer and delivers actionable remediation guidance.

    The Problem

    NestJS configuration failures are among the most common blockers before production deployment. Applications may boot with missing environment variables, fail silently when ConfigService.get() returns undefined, or work locally while breaking in Docker or Kubernetes due to misaligned Secret keys or missing validation. Generic debugging prompts do not follow a repeatable NestJS-specific diagnostic process.

    What This Skill Does

    • Executes a 14-point diagnostic matrix across ConfigModule, environment files, and deployment configuration
    • Determines configuration health status: BROKEN, MISCONFIGURED, or OK
    • Identifies root cause with file-level evidence and severity-ranked findings
    • Maps environment variables to their usage across the codebase
    • Generates a complete .env.example template from project analysis
    • Validates Docker ENV injection and Kubernetes Secret/ConfigMap key alignment
    • Recommends Joi or Zod startup validation patterns where validation is missing

    Supported Stack

    NestJS 9–11, @nestjs/config, Joi, Zod, Docker, Kubernetes ConfigMap and Secret resources.

    Ideal Use Cases

    • Application fails to start with configuration-related errors
    • ConfigService returns undefined for expected variables
    • Service runs locally but fails in Docker or Kubernetes
    • Startup validation errors from Joi or Zod schemas
    • Generating .env.example for team onboarding or CI/CD pipelines

    Security & Privacy

    This skill operates read-only and never outputs actual secret values from .env files. Sensitive values are redacted in all diagnostic output.

    Known Limitations

    • Scope is limited to configuration and environment setup
    • Does not perform full production-readiness or security audits
    • Does not connect to live clusters, containers, or databases
    • Does not modify source code unless explicitly requested by the user

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    1 install

    Downloaded by developers to date

    Free forever

    No account required to browse

    Trust & safety

    Security scanned

    Verified clean 1 month ago

    • Free to download with an account

    Installs1
    Listed1 month ago

    Creator

    Saeed Gholami

    Saeed Gholami

    Frequently Asked Questions

    Popular in DevOps & Deployment

    Free