Skip to content

Workspaces

Workspaces are isolated container environments for your apps.


What is a Workspace?

A Workspace is a containerized development environment:

  • Belongs to an App (your codebase)
  • Runs in a Docker container
  • Mounts your app's source code directory
  • Has its own image with tools/dependencies
  • Can be customized with different configurations

Think of it as your App running in dev mode.


Creating Workspaces

Basic Workspace

Create a workspace for the active app:

dvm create workspace dev
# or
dvm create ws dev

In a Specific App

dvm create ws dev -a my-api

With Description

dvm create ws dev --description "Main development environment"

With Custom Image Name

dvm create ws dev --image my-custom-image:latest

Default Neovim Configuration

New workspaces automatically get a pre-configured Neovim setup including:

  • Structure: lazyvim framework for modern Neovim
  • Plugin Package: core with 6 essential IDE plugins:
  • nvim-treesitter - Syntax highlighting
  • telescope.nvim - Fuzzy finder
  • which-key.nvim - Keybinding help
  • nvim-lspconfig - Language server support
  • nvim-cmp - Autocompletion
  • gitsigns.nvim - Git integration
  • Theme: Inherits from the theme cascade system

This means you get a fully functional IDE experience immediately—no manual configuration needed.


Managing Workspaces

List Workspaces

dvm get workspaces
# or
dvm get ws

Output:

NAME          APP        IMAGE                           STATUS   CREATED
● dev         my-app     dvm-dev-my-app:20240204-1200    ready    2024-02-04
  test        my-app     dvm-test-my-app:pending         pending  2024-02-04
  feature-x   my-app     dvm-feature-x-my-app:pending    pending  2024-02-04

Get Workspace Details

dvm get workspace dev
dvm get ws dev -o yaml

Delete a Workspace

dvm delete workspace dev
dvm delete ws dev --force

Setting Active Workspace

Set which workspace commands operate on:

dvm use workspace dev
# or
dvm use ws dev

Check current context:

dvm get ctx
# Ecosystem: default
# Domain:    default  
# App:       my-app
# Workspace: dev

Clear active workspace:

dvm use ws none

Multiple Workspaces

Create different workspaces for different purposes:

Development Workspace

Your main coding environment:

dvm create ws dev --description "Daily development"

Testing Workspace

For running test suites:

dvm create ws test --description "Running tests"

Feature Branch Workspaces

Isolated environments for features:

dvm create ws feature-auth --description "Authentication feature"
dvm create ws feature-payments --description "Payment integration"

Debug Workspace

With extra debugging tools:

dvm create ws debug --description "Debugging with extra tools"

Workspace Lifecycle

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   create    │────▶│    build    │────▶│   attach    │
│  workspace  │     │   (image)   │     │ (container) │
└─────────────┘     └─────────────┘     └─────────────┘
                                        ┌─────────────┐
                                        │   detach    │
                                        │   (stop)    │
                                        └─────────────┘
  1. Create - Define the workspace
  2. Build - Build the container image
  3. Attach - Start and enter the container
  4. Detach - Stop the container

Switching Workspaces

# Start with dev
dvm use ws dev
dvm build
dvm attach
# ... work on code ...
# Exit container (Ctrl+D or exit)

# Switch to test
dvm use ws test
dvm build
dvm attach
# ... run tests ...

# Switch to feature branch
dvm use ws feature-auth
dvm build
dvm attach

Image Versioning

Workspace images are tagged with timestamps:

dvm-dev-my-app:20240204-120030

Format: dvm-<workspace>-<app>:<YYYYMMDD-HHMMSS>

When you run dvm attach:

  • If the image changed since last attach, container is recreated
  • Your code changes persist (they're mounted, not in the image)

Best Practices

Use Purpose-Specific Workspaces

# Good
dvm create ws dev
dvm create ws test
dvm create ws staging

# Less ideal - one workspace for everything
dvm create ws main

Add Descriptions

dvm create ws dev --description "Daily development with hot reload"
dvm create ws ci --description "Mimics CI environment"

Clean Up Unused Workspaces

# List all
dvm get ws

# Delete old feature workspaces
dvm delete ws feature-old --force

Next Steps