This guide walks you through scanning your first project with Envark, understanding the output, and taking action on discovered issues. You’ll learn both the interactive TUI mode and direct CLI commands.
This quickstart assumes you have Node.js 18+ installed. If not, see the Installation guide first.
After scanning completes (typically under 2 seconds for most projects):
✓ Scan complete (1.2s)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ PROJECT SCAN RESULTS━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━📊 Summary Total Variables: 24 Defined: 20 Used in Code: 22 Missing: 3 ⚠️ Undocumented: 5 Dead (unused): 2🔴 Critical Issues: 2🟡 High Issues: 1🟠 Medium Issues: 5━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Scanned 127 files in /home/user/my-projectCache: MISS (first scan)Next steps: • Run '/risk' to see detailed risk analysis • Run '/missing' to fix critical issues • Run '/validate .env' to check your env file
Critical issues mean variables used in your code are not defined anywhere. These will cause runtime crashes!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ MISSING ENVIRONMENT VARIABLES━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━These variables are used in code but not defined:🔴 STRIPE_SECRET_KEY Used in: src/payments/stripe.ts:12 src/webhooks/stripe.ts:45 Risk: CRITICAL - No default value → Add to .env file immediately🔴 JWT_SECRET Used in: src/auth/jwt.ts:8 Risk: CRITICAL - No default value → Required for authentication🟡 REDIS_URL Used in: src/cache/redis.ts:15 Risk: HIGH - Has fallback to localhost → Will use localhost:6379 in development━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Found 3 missing variables (2 critical, 1 high)⚠️ These will cause runtime errors if not fixed!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ENVIRONMENT VARIABLE RISK ANALYSIS━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━🔴 CRITICAL (2)STRIPE_SECRET_KEY ❌ Used but not defined (no default) 📍 src/payments/stripe.ts:12 💡 Add to .env: STRIPE_SECRET_KEY=your-key-hereJWT_SECRET ❌ Used but not defined (no default) 📍 src/auth/jwt.ts:8 💡 Generate with: openssl rand -hex 32🟡 HIGH (1)API_KEY ⚠️ Secret-like name found in config.js 📍 src/config.js:5 - const API_KEY = "hardcoded" 💡 Move to .env and use process.env.API_KEY🟠 MEDIUM (5)DATABASE_URL ⚠️ Used 8 times across 4 files ⚠️ No default value 📍 src/db/connection.ts, src/migrations/run.ts... 💡 Add default or ensure .env has this value━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Total Issues: 8Run '/missing' for detailed remediation steps
Envark assigns risk levels using src/core/analyzer.ts based on usage patterns, definition status, and secret detection heuristics.
This creates .env.example with all discovered variables:
.env.example
# Auto-generated by Envark# Copy to .env and fill in your values# Database ConfigurationDATABASE_URL=postgresql://user:pass@localhost:5432/dbname# AuthenticationJWT_SECRET=your-secret-here# Payment Processing STRIPE_SECRET_KEY=sk_test_...STRIPE_PUBLIC_KEY=pk_test_...# API ConfigurationAPI_ENDPOINT=https://api.example.comAPI_TIMEOUT=5000# Server SettingsPORT=3000NODE_ENV=development# Redis CacheREDIS_URL=redis://localhost:6379
Commit .env.example to version control so new developers know which variables to configure.
Notice the second request used cache ("cacheHit": true) and completed in 45ms vs 1243ms. Envark caches results in .envark/cache.json until files change.