A complete, containerized development environment for Nanocoder - the local-first AI coding assistant.
- Docker Desktop installed and running
- Visual Studio Code with the Dev Containers extension
-
Clone the repository
git clone https://github.com/Nano-Collective/nanocoder.git cd nanocoder -
Open in VS Code
code . -
Reopen in Container
- When VS Code prompts "Reopen in Container", click "Reopen in Container"
- Or press
F1and selectDev Containers: Reopen in Container
-
Wait for Setup
- The container will build on first use (~2-3 minutes)
- Dependencies will be installed automatically
- The project will be built automatically
- You're ready when you see "✨ Development environment ready!" in the terminal
-
Start Development
# Run development mode with hot reload pnpm run dev # Run all tests pnpm test:all # Start the application pnpm run start
| Tool | Version | Purpose |
|---|---|---|
| Node.js | 20.x LTS | JavaScript/TypeScript runtime |
| pnpm | 9.x | Fast, disk-efficient package manager |
| Biome | Latest | Fast formatter and linter |
| Git | Latest | Version control |
| Zsh + Oh My Zsh | Latest | Enhanced shell experience |
The following extensions are pre-installed:
- Biome - Code formatting and linting
- TypeScript - Enhanced TypeScript support
- GitLens - Git supercharged
- Prettier - Code formatting (alternative)
- Biome is set as the default formatter
- Format on save is enabled
- Organize imports on save is enabled
- TypeScript uses the workspace version
- Zsh is configured as the default shell
All dependencies and tools are pre-installed in the container. No manual setup required on your host machine.
Every developer gets the exact same tools and versions, eliminating "works on my machine" issues.
The pnpm store is cached in a named volume, making subsequent pnpm install commands much faster.
Full network access is enabled for:
- Testing MCP servers (HTTP/WebSocket/stdio)
- Fetching AI models via APIs
- Installing dependencies from npm registry
- Git operations work seamlessly inside the container
- Pre-commit hooks (Husky) are configured automatically
- Git credentials can be mounted for authenticated operations
Edit .env or agents.config.json to add your AI provider credentials:
# Edit the example .env file created during setup
nano .env# Example: OpenAI
OPENAI_API_KEY=sk-...
# Example: Anthropic
ANTHROPIC_API_KEY=sk-ant-...
# Example: OpenAI-compatible
OPENAI_COMPATIBLE_API_KEY=your-key
OPENAI_COMPATIBLE_BASE_URL=https://api.example.com/v1Run the application with hot reload:
pnpm run devExecute the complete test suite:
pnpm test:allIndividual test commands:
pnpm test:format # Biome formatting check
pnpm test:types # TypeScript type checking
pnpm test:lint # ESLint
pnpm test:ava # AVA test runner
pnpm test:knip # Unused code detectionpnpm run buildpnpm run startProblem: Container fails to build or start
Solutions:
- Ensure Docker Desktop is running
- Check Docker disk space (Docker > Settings > Resources > Disk image size)
- Try rebuilding:
Dev Containers: Rebuild Containerfrom command palette
Problem: pnpm install fails during post-create setup
Solutions:
- Check network connectivity
- Try manual install:
pnpm install --frozen-lockfile - Clear pnpm cache:
pnpm store prune
Problem: Cannot push/pull from Git
Solutions:
- Configure SSH keys in the container
- Or mount your
.gitconfigwith credential helpers - Uncomment the Git volume mount in
docker-compose.yml
Problem: File operations are slow
Solutions:
- Ensure you're using named volumes (not bind mounts) for pnpm cache
- Check Docker Desktop resource limits
- Use
.dockerignoreto exclude unnecessary files
Problem: Extensions not available in container
Solutions:
- Rebuild the container:
Dev Containers: Rebuild Container - Check
.devcontainer/devcontainer.jsonfor extension list - Install manually:
Extensions: Install Extensionscommand
Edit /home/vscode/.zshrc inside the container to customize your shell:
# Open zsh config in container
code ~/.zshrcTo use your host's Git credentials, uncomment this line in docker-compose.yml:
volumes:
- ${HOME}/.gitconfig:/home/vscode/.gitconfig:roAdd ports to docker-compose.yml:
ports:
- "51820:51820" # VS Code extension
- "3000:3000" # Your custom portAdd custom environment variables in docker-compose.yml:
environment:
NODE_ENV: development
MY_CUSTOM_VAR: "value"To connect to services running on your host machine:
- macOS/Windows: Use
host.docker.internal - Linux: Use
172.17.0.1(default Docker bridge IP)
Example:
# In .env
API_BASE_URL=http://host.docker.internal:3000Open a terminal inside the container:
- VS Code:
Terminal > Create New Terminal - Docker CLI:
docker exec -it nanocoder-dev zsh
Remove the container and volumes to start fresh:
# Stop and remove container
docker-compose down
# Remove pnpm cache volume
docker volume rm nanocoder-pnpm-store
# Rebuild from scratch
# In VS Code: Dev Containers: Rebuild Container- Base:
mcr.microsoft.com/devcontainers/base:ubuntu-22.04 - User: Non-root
vscodeuser for security - Size: ~1.5GB (acceptable for development)
| Mount | Purpose | Persistence |
|---|---|---|
/workspaces/nanocoder |
Project source code | Host filesystem |
nanocoder-pnpm-store |
pnpm package cache | Named volume |
- Mode: Bridge (default)
- Access: Full network access for MCP testing
- Ports: 51820 forwarded to host
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Main README
- Contributing Guide - Overall contribution guidelines
- OpenSpec Proposal - Design and specs
- Main README - Project overview and usage