Codespaces

Developing BookNest in a Codespace

A codespace is a container on a GitHub-hosted virtual machine, opened in the browser version of VS Code 550 or from a desktop editor, with the repository already cloned. What goes in the container comes from the open Dev Container specification (https://containers.dev 263,639 ): a .devcontainer/devcontainer.json, which VS Code's Dev Containers 263,639 extension, JetBrains IDEs, DevPod and the devcontainers CLI read as well. Pull request #31 added one to BookNest:

.devcontainer/devcontainer.jsonJSON
{
  "name": "BookNest",
  "image": "mcr.microsoft.com/devcontainers/javascript-node:24",
  "features": {
    "ghcr.io/devcontainers/features/docker-in-docker:2": {},
    "ghcr.io/devcontainers/features/github-cli:1": {}
  },
  "forwardPorts": [3000],
  "portsAttributes": {"3000": {"label": "BookNest API"}},
  "postCreateCommand": "npm ci",
  "postStartCommand": "docker compose up -d",
  "hostRequirements": {"cpus": 2},
  "customizations": {
    "vscode": {"extensions": ["dbaeumer.vscode-eslint"]}
  }
}

The image brings Node.js 24 2,131 ; features add Docker 514 (for PostgreSQL 1,289 via docker compose) and gh 29 ; port 3000 is forwarded to a private HTTPS URL. The reference CLI checks the file without starting anything:

Validating the configuration with the Dev Container CLIShell
npx -y @devcontainers/cli@0.89.0 read-configuration --workspace-folder . 2>/dev/null \
  | jq '{name: .configuration.name, image: .configuration.image,
         workspace: .workspace.workspaceFolder}'
Output
{
  "name": "BookNest",
  "image": "mcr.microsoft.com/devcontainers/javascript-node:24",
  "workspace": "/workspaces/booknest"
}

Launching it (Code > Codespaces 29 > Create codespace on main, or gh codespace create) is not run here. Personal accounts get a monthly allowance: 120 core-hours and 15 GB-months of storage on Free, 180 core-hours and 20 GB-months on Pro. A 2-core machine uses two core-hours an hour, so Free covers 60 hours of BookNest work. Beyond that, compute costs $0.18 an hour for 2 cores, doubling per size to $2.88 for 32, and storage $0.07 per GB-month; stopped codespaces still use storage, so delete them.