# Configuring VS Code for Zato

Two ways to deploy on save - the blueprint mount for a local install, the plugin for a remote one.

This chapter describes how to deploy services to Zato on save from Visual Studio Code. Pick the tab that matches where your server runs - on the same machine as VS Code, or on a remote one.

Another chapter describes how to [add code completion (IntelliSense)](https://zato.io/docs/dev/ide/code-completion.html) to the IDE.

**Zato local install**

With the Zato container running on the same machine as VS Code, the [project blueprint](https://github.com/zatosource/zato-project-blueprint) is all that is needed.

### Setup {#setup}

- Clone the blueprint and run its provisioning script, `myproject/impl/scripts/run-container.sh`, which starts a new Zato environment with the project mounted into it

- In VS Code, choose **File -> Open Folder** and open the clone - the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python) is the only extension you need for editing

### Deployment {#deployment}

- Open `myproject/impl/src/api/crm.py`, change anything in it and save the file. A moment later the server log confirms the deployment:

```text
Deployed 1 service from `crm.py` -> ['crm.customer.get']
```

- That is the whole workflow - save, wait a second, invoke. To deploy as you pause typing, set `files.autoSave` to `afterDelay` in your settings.

### How it works {#how-it-works}

The provisioning script mounts the project into the container and points the server at it through the `Zato_Project_Root` variable - these two lines are the whole integration:

```bash
echo Zato_Project_Root=$target/$env_name  >> $host_root_dir/config/auto-generated/env.ini
--mount type=bind,source=$zato_project_root,target=$target/$env_name,readonly
```

The server watches the mounted directory, so saving a file on the host deploys it in the container. The [hot deployment](https://zato.io/docs/dev/hot-deploy.html) page explains the layout rules and what else is watched, and the [deployment tutorial](https://zato.io/tutorials/devops/deployment.html) covers the blueprint from end to end.

**Zato remote install**

When the server runs on another machine, the [Zato plugin for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=zatosource.ide-vscode), available from the Visual Studio marketplace, adds a default keybinding along with a toolbar button enabling simplified hot-deployment to your development environment over HTTP.

### Prerequisites {#prerequisites}

To enable hot-deployment from Visual Studio Code, ensure you have first [set the ide\_publisher password](https://zato.io/docs/dev/ide/index.html) that the plugin authenticates with.

### Installation {#installation}

Visit the Extensions Marketplace either [in your browser](https://marketplace.visualstudio.com/items?itemName=zatosource.ide-vscode), or within the application, by pressing `Ctrl+Shift+X` hot-key:

### Configuration {#configuration}

After the installation completes, visit the settings panel via `Ctrl+,` to configure your server connection. The address is the server's `/ide-deploy` channel on port 11223, `http://<host>:11223/ide-deploy`, and the username is `ide_publisher`:

### Deployment {#deployment_1}

- Automatic deployment is triggered on every file save if a Python file contains a special deployment marker within its first 100 lines of source code:

```python
# zato: ide-deploy=True
```

For instance:

```python
# -*- coding: utf-8 -*-
# zato: ide-deploy=True

from zato.server.service import Service

class MyService(Service):
    def handle(self):
        pass
```

- While editing any Python module, you can also deploy to the configured Zato environment by clicking the toolbar icon, or pressing the `Ctrl+Shift+L` hotkey:

## Learn more {#learn-more}

- [IDE integration](https://zato.io/docs/dev/ide/) - Save a file in the blueprint and it deploys, or push it with the plugin
- [Development documentation](https://zato.io/docs/dev/) - The complete reference for writing services
- [In-depth API tutorial](https://zato.io/tutorials/main/01.html) - The full platform tutorial, from installation to production patterns
