Skip to content
catapultjsPublic

Repository files navigation

Catapult

npm version node version license

A Capistrano-style deployment tool for Node.js applications, static sites, binaries, and containers. Catapult deploys over SSH with versioned releases, shared directories, a composable task pipeline, and rollback. It requires no Catapult agent on the server.

Full documentation at https://catapultjs.com/

Features

  • SSH-based: transfer files with tar over SSH, Git, or rsync
  • Versioned releases: each release lives in releases/<release> and is activated through the current symlink. Catapult can restore the previous release if deployment fails after publication
  • Composable pipeline: insert, remove or replace any task with a single function call, or rewrite the whole sequence
  • Drop-in recipes: import once, tasks register themselves and wire into the pipeline
  • Multi-host: deploy to one server or several, with per-host configuration
  • Healthcheck: configure an HTTP check to verify the app responds after publication

Quick start

Run init at the root of your project. It lets you choose TypeScript, JavaScript or JSON, creates the matching deploy.config.* file, and installs @catapultjs/deploy as a dev dependency:

npx @catapultjs/deploy init

Edit the generated config to describe your hosts and pick your recipes. This TypeScript example deploys the main branch with the Git recipe:

import { defineConfig } from '@catapultjs/deploy'
import '@catapultjs/deploy/recipes/git'

export default defineConfig({
  hosts: [
    {
      name: 'production',
      ssh: 'deploy@example.com',
      deployPath: '/home/deploy/myapp',
      branch: 'main',
    },
  ],
})

For a fully declarative config, choose JSON. Catapult validates it against the schema shipped with the package and supports built-in recipes, store values, custom task steps and declarative pipeline controls:

{
  "$schema": "https://catapultjs.com/schema/deploy.schema.json",
  "version": 1,
  "recipes": ["git"],
  "config": {
    "hosts": [
      {
        "name": "production",
        "ssh": "deploy@example.com",
        "deployPath": "/home/deploy/myapp",
        "branch": "main"
      }
    ]
  }
}

See the JSON configuration guide for tasks, pipeline customization, supported recipes and the cases that still require TypeScript or JavaScript.

The Git recipe uses the local repository's origin by default. Both machines need access to that repository. Add the build and service recipes your application needs before deploying. See the deployment examples for complete configurations.

Validate the configuration locally, prepare the server once per host, then deploy:

npx cata config:validate
npx cata deploy:setup
npx cata deploy

Server structure

/home/deploy/myapp/
  current/          → symlink to releases/<release>
  previous          → symlink to the release replaced by the last publication
  releases/
    2024-01-15T.../ ← active release
    2024-01-14T.../
  shared/
    .env
    logs/
  .catapult/
    repo/           ← bare git mirror (git recipe)
    revisions.log   ← JSON deployment history
    deploy.lock     ← present during a deployment

Recipes

  • Node.js servers. adonisjs and nextjs support remote, local, and local container builds. astro, nestjs, nuxt, and tanstack cover other server frameworks. Use pm2 or systemd to manage processes.
  • Static sites. astro_static, nextjs_static, nuxt_static, and vitepress build locally and deploy the generated output.
  • Container workloads (experimental). compose deploys a Compose stack, container runs services from one image with Docker or Podman, and quadlet runs Podman containers through systemd. Images can be streamed over SSH, transferred through a registry, or built on the server.
  • Compiled binaries (experimental). laravel_go and laravel_rust deploy compiled applications and run migrations before publication.
  • Infrastructure. git and rsync provide alternative file transfers. caddy, directus, and redis add service-specific tasks.

See the recipe catalog and the container build guide for build and runtime requirements. For upgrades, see the changelog. The adonisjs_local and nextjs_local recipes are deprecated. Use the main recipes with build.location: 'local'.

Requirements

  • Node.js 24 or newer and OpenSSH tools (ssh and scp) on the machine running Catapult
  • SSH access to a remote Bash shell with write access to the deployment path
  • tar with gzip support on both machines for directory uploads
  • Git, rsync, the application runtime, and service tools as required by the selected recipes

Agent skill

The package ships a catapultjs agent skill for Claude Code and SKILL.md-compatible agents, with references covering the deploy config, recipe writing and the programmatic API.

npx skills add catapultjs/deploy

Contributing a recipe

If you've written a recipe that could be useful to others, open a pull request that adds it to the recipes/ directory, with its tests and a documentation page in docs/guide/recipes/.

Inspiration

Inspired by Deployer PHP and Capistrano.

License

MIT

Releases

Packages

Contributors

Languages