This project is set up for Elixir, Phoenix, and Erlang development using a Dev Container for a fully reproducible and isolated environment. Below you'll find details on the setup, utilities, and how to get started.
The development environment is defined using VS Code Dev Containers, leveraging Docker Compose for service orchestration. This ensures all contributors have a consistent setup, regardless of their local OS.
- Elixir 1.18 and Erlang pre-installed
- Phoenix installed via
mix archive.install
- PostgreSQL 17.5 as the default database
- Zsh with Oh My Zsh for a modern shell experience
- Common utilities:
curl
,git
,inotify-tools
,watchman
, andgh
(GitHub CLI) - Automatic dependency installation and database setup on first run
- Recommended VS Code extensions for Elixir, Phoenix, TailwindCSS, and SQL
-
Open in VS Code
- Use "Open Folder in Container" or the green "><" button in the bottom-left of VS Code.
- VS Code will build the container and set up the environment automatically.
-
Services
elixir
: Main development container, runs Elixir, Phoenix, and your code.postgres
: Database service, automatically initialized and health-checked.
-
Ports
4000
: Phoenix web server (auto-opens in browser)5432
: PostgreSQL (auto-notifies)
-
First-Time Setup
- On first container start, the following commands run automatically:
mix local.hex --force
mix local.rebar --force
mix archive.install hex phx_new $PHOENIX_VERSION --force
mix deps.get && mix ecto.setup
- On first container start, the following commands run automatically:
-
Database
- Default credentials:
postgres
/postgres
, database:boilerplate_dev
- Data is persisted in a Docker volume (
postgres-data
)
- Default credentials:
-
VS Code Extensions
- ElixirLS (language server)
- Phoenix Framework tools
- TailwindCSS IntelliSense
- SQLTools and PostgreSQL driver
-
.vscode/settings.json
- Excludes build and dependency folders from the file explorer
- Enables Emmet for Phoenix templates
- Pre-configures SQLTools for local database access
-
.vscode/launch.json
- Debug and run tasks for
mix phx.server
andmix test
- Debug and run tasks for
- Start Phoenix server:
mix phx.server
- Run tests:
mix test
- Install dependencies:
mix deps.get
- Setup database:
mix ecto.setup
- If you encounter issues with dependencies or the database, try rebuilding the container from the VS Code command palette ("Dev Containers: Rebuild and Reopen in Container").
- Ensure Docker Desktop is running and has enough resources allocated.
- The Dev Container is configured for the
vscode
user with UID/GID 1000. - Environment variable
PHOENIX_VERSION
is set to1.8.0-rc.3
. - All code and data are mounted into
/workspace
inside the container.
For more details, see the following files:
.devcontainer/devcontainer.json
.devcontainer/docker-compose.yml
.vscode/settings.json
.vscode/launch.json
Happy coding!