GitHub Codespaces can feel like magic for cloud development, but the real surprise is how much less local setup you actually need.
Let’s see it in action. Imagine you’re starting a new Python project.
# On your local machine, you'd normally:
# git clone git@github.com:your-org/your-repo.git
# cd your-repo
# python -m venv venv
# source venv/bin/activate
# pip install -r requirements.txt
# ...and so on.
With Codespaces, you just navigate to your repository on GitHub. Click the green "Code" button, then select "Codespaces" and "Create new codespace."

GitHub spins up a cloud-hosted virtual machine pre-configured with your chosen environment (or a default if you don’t specify). It pulls your code, installs your dependencies (if you’ve defined them in a devcontainer.json file), and gives you a VS Code-like editor running in your browser.
Your codespace is essentially a fully provisioned development environment in the cloud. It’s not just a remote server; it’s a development environment. This means it comes with pre-installed tools, extensions, and configurations tailored for your project. You can select from various machine types (CPU, RAM, storage) depending on your workload.
The core of this is the devcontainer.json file. This JSON configuration lives in your repository, usually at .devcontainer/devcontainer.json. It tells Codespaces exactly how to build your development environment.
Here’s a simple example for a Python project:
// .devcontainer/devcontainer.json
{
"name": "Python 3.10",
"image": "mcr.microsoft.com/devcontainers/python:3.10",
"features": {
"ghcr.io/devcontainers/features/node:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
]
}
},
"postCreateCommand": "pip install --user -r requirements.txt"
}
"name": A human-readable name for your codespace."image": A Docker image to use as the base for your codespace. This example uses a Microsoft-provided Python 3.10 image."features": Pre-defined sets of tools and configurations you can easily add. Here, we’re adding Node.js."customizations": Settings specific to IDEs like VS Code. We’re telling it to install the official Python extension."postCreateCommand": A command to run after the container is created but before you connect. This is perfect for installing project dependencies.
This devcontainer.json file acts as your infrastructure-as-code for development environments. Anyone cloning your repo can spin up an identical, fully functional environment with a few clicks. This eliminates the "it works on my machine" problem by making everyone’s machine identical in the cloud.
You can also connect to a running codespace from your local VS Code desktop client. This gives you the full VS Code experience with local shortcuts and performance, but the heavy lifting (compilation, running tests, debugging) happens on the cloud VM.
When you’re done, you can shut down your codespace. GitHub keeps your files and environment configuration saved, so you can resume exactly where you left off later, often picking up with a different machine type if needed.
The "secret sauce" for performance in Codespaces is that the environment is built on a powerful cloud VM, not your laptop. This means you can run demanding tasks like large test suites, complex builds, or data processing without bogging down your local machine. You’re essentially renting a high-performance workstation on demand.
The next step is to explore the rich ecosystem of dev container features and learn how to customize them for your specific tech stack.