# GitHub Codespaces GitHub Codespaces is [[GitHub]]'s hosted [[Cloud Development Environment (CDE)|cloud development environment]]. A Codespace is a containerized Linux dev environment that boots from a `.devcontainer/devcontainer.json` configuration, attaches to either VS Code in the browser, the VS Code desktop app, or any IDE that speaks the Dev Containers spec, and gives you a full editor + terminal + port-forwarding loop on a remote machine. Generally available since 2021, it is the most mainstream answer to "the new contributor's `npm install` fails ; let's just give them a working environment in one click." ## What You Actually Get - **A virtual machine** (2 / 4 / 8 / 16 / 32-core options), not just a container ; the dev container runs *on* the VM - **A working tree** auto-cloned from the repo - **Port forwarding** for any local web server, with sharable preview URLs - **VS Code extensions** restored from your settings sync - **Persistent storage** between stops/starts; auto-deleted after a configurable idle period - **Prebuilds**: warm pool of pre-initialized Codespaces so the first one is fast ## Configuration The contract is the [Dev Containers spec](https://containers.dev/) ; same `devcontainer.json` works in Codespaces, VS Code Dev Containers locally, JetBrains Gateway, and other implementations. Typical fields: `image`, `features` (composable add-ons like Node, Python, AWS CLI), `forwardPorts`, `postCreateCommand`, `customizations.vscode.extensions`. ## Pricing Model Per-hour compute + per-GB storage. Free tier: 120 core-hours/month for personal accounts (varies). Stopped Codespaces still bill for storage. The cost discipline is to *stop* aggressively or rely on the auto-suspend. ## When It's the Right Choice - **Onboarding friction**: contributor opens a PR review in seconds, no local setup - **Conference workshops, classrooms**: one URL, identical environment for everyone - **Working from a Chromebook / iPad / borrowed laptop**: full dev box without local install - **Reviewing dependency upgrades** without polluting your local toolchain ## When It Isn't - **Heavy AI workloads / GPUs**: limited GPU options, expensive ; consider [[Crabbox]] (own cloud), Vercel Sandboxes, or Codex Cloud - **You hate latency**: even fast SSH/WS round-trips feel different from local - **Air-gapped or strict data residency**: Codespaces runs on Microsoft Azure ; not always allowed ## Codespaces vs Adjacent Tools - **vs [[DevBox]]**: stays local, no per-hour cost, but no remote compute lift - **vs Gitpod**: equivalent class of product; Codespaces is GitHub-native, Gitpod is more cloud-agnostic and supports self-hosting - **vs [[Crabbox]]**: Codespaces is editor-first (you live inside it); Crabbox is execution-first (your editor stays local, only the run is remote) ## References - Documentation: https://docs.github.com/codespaces - Dev Containers spec: https://containers.dev/ - Pricing: https://docs.github.com/billing/managing-billing-for-github-codespaces ## Related - [[GitHub]] - [[GitHub Actions]] - [[Cloud Development Environment (CDE)]] - [[DevBox]] - [[Crabbox]] - [[Ephemeral Environments]]