Skip to main content

Overview

This example demonstrates how to configure envcheck for a typical Node.js application. It validates Node.js and npm versions, required environment variables, port availability, and essential project files.

Configuration

.envcheck.yaml

What This Checks

Tools

  • node >=18.0.0: Ensures you’re running a modern LTS version of Node.js with the latest features and security patches
  • npm >=9.0.0: Validates you have a compatible npm version with improved workspace support
  • git: Confirms git is installed for version control operations

Environment Variables

  • NODE_ENV (optional): Standard Node.js environment variable for development/production modes
  • DATABASE_URL (required): Connection string for database access - critical for application functionality

Ports

  • 3000: Default development server port for most Node.js frameworks (Express, Next.js, etc.)
  • 5432: PostgreSQL database port - ensures no conflicts with local database

Files

  • .env: Local environment configuration file must exist
  • package.json: Project manifest is required for dependency management

Expected Output

Tips for Node.js Projects

Use .env.example as a template file committed to git, and create your local .env from it. Add .env to your .gitignore to prevent committing secrets.
If port 3000 is in use, you may have another dev server running. Use lsof -i :3000 on macOS/Linux or netstat -ano | findstr :3000 on Windows to find the process.
For monorepo setups with multiple Node.js services, create separate .envcheck.yaml files in each package directory with service-specific configurations.

Common Variations

TypeScript Projects

Add TypeScript compiler checks:

Next.js Applications

Check for Next.js-specific requirements:

Microservices

Validate additional service dependencies:

Learn More