# @architect/hydrate

> Architect dependency hydrator and shared file manager

Latest version **6.0.2** (published 2026-06-30) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @architect/hydrate
pnpm add @architect/hydrate
yarn add @architect/hydrate
bun add @architect/hydrate
```

Provides the command `arc-hydrate`.

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 6.0.2 |
| Published | 2026-06-30 |
| First published | 2019-05-30 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=22 |
| Dependencies | 4 |
| Unpacked size | 124.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 4 |
| Author | Brian LeRoux |
| Maintainers | brianleroux, dam, kborchers, ryanblock, architectci, filmaj, macdonst, ryanbethel |

## Links

- npm: https://www.npmjs.com/package/@architect/hydrate
- Repository: https://github.com/architect/hydrate
- Homepage: https://github.com/architect/hydrate#readme
- Issues: https://github.com/architect/hydrate/issues
- npm.io page: https://npm.io/package/@architect/hydrate

## Dependencies (4)

- [esquery](https://npm.io/package/esquery.md) 1.6.0
- [acorn-loose](https://npm.io/package/acorn-loose.md) 8.5.2
- [@architect/utils](https://npm.io/package/@architect/utils.md) ~6.0.0
- [@architect/inventory](https://npm.io/package/@architect/inventory.md) ~6.0.0

## Recent versions

- 6.0.2 (latest) — 2026-06-30
- 5.0.2 (v5-latest) — 2026-03-03
- 5.0.2-RC.0 (RC) — 2025-11-24
- 1.4.3-turbologger-1 (turbologger) — 2019-09-18
- 5.0.2-RC.1 — 2026-03-03
- 6.0.0 — 2025-11-27
- 5.0.1 — 2025-09-26
- 5.0.0 — 2025-09-24
- 4.0.11-RC.0 — 2025-09-22
- 4.0.10 — 2025-09-22
- 4.0.10-RC.0 — 2025-09-22
- 4.0.8 — 2024-08-06
- 4.0.7 — 2024-07-25
- 4.0.6 — 2024-04-29
- 4.0.5 — 2024-04-16
- … 166 more at https://npm.io/package/@architect/hydrate/versions

## README

# `@architect/hydrate` [![GitHub CI status](https://github.com/architect/hydrate/workflows/Node%20CI/badge.svg)](https://github.com/architect/hydrate/actions?query=workflow%3A%22Node+CI%22)

[@architect/hydrate][npm] ensures that all functions managed by Architect have their dependencies installed. Functions containing all required dependencies are considered to be 'hydrated' - thus the name!

[@architect/hydrate][npm] supports dependencies managed in the following languages using the following package managers:

- **Node.js** via `npm` using `package.json` (and optionally `package-lock.json`), or via `yarn` using `package.json` and `yarn.lock`
- **Python** via `pip3` using a `requirements.txt` file
- **Ruby** via `bundle` using `Gemfile` and `Gemfile.lock` files


# Requirements

- **Node.js 22 or later** is required to use `@architect/hydrate` version 6.0.0 and above
- For Node.js 20 support, use `@architect/hydrate` version 5.x


# Installation

    npm install @architect/hydrate


# API

All methods accept an `options` object can include the following properties:

- `autoinstall` - **Boolean** - Enables or disables automated Lambda dependency treeshaking via static code analysis
  - Defaults to `false`
  - Used by `install`
- `basepath` - **String** - Filesystem path in which Hydrate should search for functions
  - Defaults the current working directory
  - Useful if you want to hydrate one function or a subset of functions
  - Used by `install` + `update`
- `copyShared` - **Boolean** - Enables or disables copying of shared code folders (e.g. `src/shared`) into Lambdas
  - Useful to disable if you want to just hydrate external dependencies
  - Defaults to `true`
  - Used by `install` + `update`
- `cwd` - **String** - Root filesystem path of the project Hydrate is working in
  - Defaults to current working directory
  - May be the same or different from `basepath`; if using in conjunction with `basepath`, specify a subset of the project with `basepath`, for example:
    - `{ cwd: '/your/project/', basepath: '/your/project/src/http/' }` runs Hydrate against `/your/project/` (without having to use `process.chdir`) and only hydrates functions within `/your/project/src/http/**`
  - Used by `install` + `update` + `shared`
- `hydrateShared` - **Boolean** - Enables or disables dependency hydration in shared code folders (e.g. `src/shared`)
  - Useful to disable if you want to just hydrate external dependencies
  - Defaults to `true`
  - Used by `install` + `update`
- `inventory` - **Object** - Architect Inventory object; generally used internally
- `local` - **Boolean** - Favor the local platform during installation of dependencies that may be distributed as platform-specific binaries
- `only` - **String** - Specify a subset of possible shared files for `shared` to copy into Lambdas
  - Falsy by default
  - Accepts: `shared`, `views`, or `staticJson`
  - Used by `shared`
- `quiet` - **Boolean** - Disables (most) logging
- `symlink` - **Boolean** - Enables or disables symlinking instead of full directory copying, useful for local development
  - Defaults to `false`
  - Used by `install` + `update` + `shared`
- `timeout` - **Number** - Amount of time in milliseconds to give each package manager process to execute
  - Used by `install` + `update`
- `verbose` - **Boolean** - Enables verbose logging

> **Note on `cwd` vs `basepath`**: `cwd` is necessary for Hydrate to find your project's manifest and key files and folders, while `basepath` scopes hydration to a specific path. When in doubt, include neither parameter, Hydrate will default to process working directory; if you know you need to aim Hydrate at a specific place but aren't sure which parameter to use, use `cwd`.


## `hydrate.install(options[, callback]) → [Promise]`

Installs function dependencies, then invokes [`hydrate.shared()`][shared].

To ensure local development behavior is as close to `staging` and `production` as possible, `hydrate.install()` (and other hydrate functions) uses:

- **Node.js**: `npm ci` if `package-lock.json` is present and `npm i` if not; or `yarn`
- **Python**: `pip3 install`
- **Ruby**: `bundle install`

Note: by default `update` also installs dependencies in shared folders like `src/shared` and `src/views`.


## `hydrate.update(options[, callback]) → [Promise]`

Updates function dependencies, then invokes [`hydrate.shared()`][shared].

`update` is functionally almost identical to [`install`][install], except it will update dependencies to newer versions _if they exist_. This is done via:

- **Node.js**: `npm update` or `yarn upgrade`
- **Python**: `pip3 install -U --upgrade-strategy eager`
- **Ruby**: `bundle update`

Note: by default `update` also updates dependencies in shared folders like `src/shared` and `src/views`.


## `hydrate.shared(options[, callback]) → [Promise]`

Copies shared code (from `src/shared` and `src/views`, or your custom `@shared` + `@views` paths, if any) into all functions.


[shared]: #hydratesharedoptions-callback
[install]: #hydrateinstalloptions-callback
[update]: #hydrateupdateoptions-callback
[npm]: https://www.npmjs.com/package/@architect/hydrate

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