What is a Dev Container?
A Dev Container is a Docker-based development environment that runs inside VS Code. It provides:- Consistent environment across all developers
- Zero manual setup - dependencies are pre-installed
- Isolation from your local system
- Reproducibility - same environment every time
What’s Included
The Dev Container includes:Ubuntu
Latest Ubuntu base image
Node.js
Managed via Volta for version consistency
PostgreSQL 18
Pre-configured database instance
Python 3.12
Via pyenv for backend integration examples
Zsh
Oh My Zsh with autosuggestions and syntax highlighting
Git
Pre-installed and configured
Prerequisites
Before using the Dev Container, install:Windows users: Docker Desktop requires WSL 2. Follow the Windows setup guide.
Quick Start
1. Open in Dev Container
In VS Code:- Open the boilerplate repository
- Press
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows/Linux) - Select “Dev Containers: Reopen in Container”
- Wait for the container to build (first time takes ~5 minutes)
2. Install Prerequisites
Once inside the container, run:These commands install the exact Node.js and Python versions specified in the project configuration.
3. Configure Environment
Copy the example environment file:.env to add your Google OAuth credentials:
.env
4. Install and Run
Dev Container Configuration
Docker Compose
The Dev Container uses Docker Compose to run multiple services:.devcontainer/docker-compose.yml
devcontainer.json
Thedevcontainer.json file configures VS Code and the container:
.devcontainer/devcontainer.json
Database Connection
The PostgreSQL instance is accessible within the container:.env
The hostname is
postgres (the service name in Docker Compose), not localhost.Accessing PostgreSQL
Connect to the database using the terminal:Customizing the Dev Container
Add VS Code Extensions
Install extensions automatically when the container starts:.devcontainer/devcontainer.json
Add System Packages
Install additional packages in the Dockerfile:.devcontainer/Dockerfile
Add Node.js Tools
Install global npm packages in the post-create script:.devcontainer/scripts/post-create.sh
Troubleshooting
Container Won’t Start
Problem: Docker fails to start the container. Solution:- Ensure Docker Desktop is running
- Check Docker has enough resources (CPU, memory, disk)
- Rebuild the container:
Cmd+Shift+P→ “Dev Containers: Rebuild Container”
Port Already in Use
Problem: Port 3000 or 5432 is already in use. Solution: Stop the conflicting service on your local machine, or change the port indocker-compose.yml:
Can’t Connect to PostgreSQL
Problem:npm run db:push fails with connection error.
Solution:
- Verify PostgreSQL is running:
docker ps - Check
DATABASE_URLusespostgresas hostname (notlocalhost) - Restart the container:
Cmd+Shift+P→ “Dev Containers: Rebuild Container”
Slow Performance (Mac)
Problem: File system operations are slow on macOS. Solution: The:cached flag in docker-compose.yml improves performance:
node_modules:
Container Runs Out of Disk Space
Problem: Docker runs out of disk space. Solution: Clean up unused Docker resources:Manual Setup (Without Dev Container)
If you prefer not to use the Dev Container:- Install Node.js 22+ and PostgreSQL locally
- Copy
.env.exampleto.env - Update
DATABASE_URLto point to your local PostgreSQL: - Run:
Benefits of Dev Containers
Team Consistency
Team Consistency
All team members use the exact same environment, eliminating “works on my machine” issues.
Onboarding Speed
Onboarding Speed
New developers can start contributing in minutes instead of hours setting up dependencies.
System Isolation
System Isolation
Dependencies are isolated from your local machine, preventing version conflicts.
Reproducibility
Reproducibility
The environment is defined in code, so it can be versioned and shared.
CI/CD Parity
CI/CD Parity
Your local environment matches CI/CD, reducing deployment surprises.
Next Steps
Project Structure
Understand the codebase organization
Database
Learn how to work with Drizzle ORM
Customization
Customize the boilerplate for your app