dev-setup

Sets up the development environment on a new workstation. Covers required tools, dependencies, configuration, and common troubleshooting. Use when onboarding to a project or troubleshooting build environment issues.

Dev Environment Setup

Goal: clone → install → build → run in under 15 minutes. If it takes longer, the setup is broken.

Step 1: Check Prerequisites

Detect the project type from the repo and verify:

CheckHow
Runtime version.node-version, .python-version, .tool-versions, rust-toolchain.toml, build.gradle.kts
Package managerpackage-lock.json (npm), yarn.lock (yarn), pnpm-lock.yaml (pnpm), Pipfile.lock, poetry.lock, Cargo.lock, go.sum
Required servicesdocker-compose.yml, README setup section
Environment vars.env.example, .env.template

Step 2: Install Dependencies

# Detect and run the appropriate install command
# npm install / yarn / pnpm install / pip install / cargo build / go mod download

Step 3: Configure Environment

  1. Copy .env.example to .env (if exists)
  2. Fill in required values (API keys, DB connection strings)
  3. Start required services (docker compose up -d if applicable)

Step 4: Verify Build

# Run the project's build command
# Run the project's test suite

Step 5: Verify Dev Server

# Start the dev server and confirm it responds

Git Configuration

git config pull.rebase true          # Clean history
git config push.autoSetupRemote true # Auto-track branches

Common Troubleshooting

ProblemLikely CauseFix
"Module not found"Missing dependenciesRe-run install command
Version mismatchWrong runtime versionCheck version file, use version manager (nvm, pyenv, rustup)
Build failsMissing system dependencyCheck README, install OS-level packages
Port in useAnother processlsof -i :PORT to find and stop it
Permission deniedFile permissionsCheck file ownership, avoid sudo for package installs
Tests fail on fresh cloneMissing env vars or servicesCheck .env.example and docker-compose.yml