# xp-deploy

> Universal automation and deployment tool written in JavaScript.

Latest version **1.3.1** (published 2026-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install xp-deploy
pnpm add xp-deploy
yarn add xp-deploy
bun add xp-deploy
```

Provides the command `xpd`.

## Health

**Score 55/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; has provenance.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2026-01-23 |
| First published | 2018-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 2 |
| Unpacked size | 18.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3 |
| Author | Qurt |
| Maintainers | qurt |
| Keywords | automation, deployment, deploy, ssh |

## Links

- npm: https://www.npmjs.com/package/xp-deploy
- Repository: https://github.com/qurt/xp-deploy
- Homepage: https://github.com/qurt/xp-deploy#readme
- Issues: https://github.com/qurt/xp-deploy/issues
- npm.io page: https://npm.io/package/xp-deploy

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^5.2.0
- [commander](https://npm.io/package/commander.md) ^10.0.0

## Recent versions

- 1.3.1 (latest) — 2026-01-23
- 1.2.3 — 2023-10-05
- 1.2.2 — 2023-03-07
- 1.2.1 — 2023-03-04
- 1.2.0 — 2023-03-04
- 1.1.5 — 2020-08-14
- 1.1.4 — 2020-05-07
- 1.1.3 — 2020-02-17
- 1.1.2 — 2019-12-02
- 1.1.1 — 2019-10-07
- 1.1.0 — 2019-09-26
- 1.0.7 — 2019-09-26
- 1.0.6 — 2019-09-26
- 1.0.6-0 — 2019-08-16
- 1.0.5 — 2019-01-20
- … 5 more at https://npm.io/package/xp-deploy/versions

## README

[![version][version-badge]][package]

## Init

Create an `xpd_config.json` file in the project root or execute `npx xp-deploy init`

```json
{
  "default": {
    "user": "dev",
    "deployTo": "/home/dev/www/test",
    "deployFrom": "./dist",
    "keepReleases": 2,
    "copy": false
  },
  "test": {
    "servers": "test.example.com",
    "preDeploy": {
      "local": ["echo 1", "echo 2"],
      "remote": "echo 3"
    },
    "postDeploy": {
      "local": "echo 1",
      "remote": "echo 2"
    }
  },
  "production": {
    "servers": ["example-01.com", "example-02.com"],
    "preDeploy": {
      "local": ["echo 1", "echo 2"],
      "remote": "echo 3"
    },
    "postDeploy": {
      "local": "echo 1",
      "remote": "echo 2"
    }
  }
}
```

The root key of the configuration is the name of the environment.
In `default' you can specify parameters that will be applied to all default environments. Further use of the parameters overwrites the defaults.

### Options
`user` Username for connection.

`servers` The address of the server to connect. If there are several servers, an array is used.
 
`deployTo` Directory to deploy on server.

`deployFrom` Local directory with dist.

`keepReleases` The number of releases to be left on the server.
 
`preDeploy` An object that contains commands to run before uploading files to the server. `local` to execute local commands, `remote` to execute on the server.

`postDeploy` Similarly to `preDeploy` only commands are executed after files are loaded.

`copy` Indicates whether to copy the previous release before updating the files.

## Run 

### Deploy
`npx xp-deploy deploy to:test`

### Rollback
Rollback to a previous release. This command is only available when `keepReleases` is configured.

By default, rollback to the previous release (1 release back):
```bash
npx xp-deploy rollback to:test
```

Rollback to N releases back:
```bash
npx xp-deploy rollback to:test 3
```

If the specified count exceeds the available number of releases on the server, an error will be thrown.

[version-badge]: https://img.shields.io/npm/v/xp-deploy
[package]: https://www.npmjs.com/package/xp-deploy

---
_Source: https://npm.io/package/xp-deploy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
