node-vault is a JavaScript client library for interacting with HashiCorp's Vault HTTP API, primarily designed for Node.js environments. The current stable version is 0.12.0, requiring Node.js 18.0.0 or higher. The project demonstrates a consistent release cadence with several minor and patch releases in the past year, indicating active maintenance. It provides a comprehensive wrapper around the Vault API, simplifying operations such as secret management (read, write, update, delete, list), authentication (e.g., Kubernetes Auth, token-based), and server lifecycle management (init, unseal). A key differentiator is its direct support for TypeScript with included definitions and its focus on being a reliable, actively developed client for Node.js users needing to integrate with Vault. It also allows configuration via environment variables for common Vault settings.
npm install node-vaultVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the node-vault client, write, read, list, update, and delete a secret using environment variables for configuration. It includes basic error handling.
Upgrade your Node.js environment to version 18.0.0 or higher, then upgrade `node-vault` to `v0.11.0` or later (current stable is 0.12.0).
Ensure `endpoint` values like `http://127.0.0.1:8200/` are provided as `http://127.0.0.1:8200`.
Be aware that `update` will merge fields. If a complete overwrite is needed, `vault.write()` should be used instead, though `write` can also merge depending on the Vault secret engine and path.
Always use valid, trusted SSL certificates for your Vault server and ensure that `VAULT_SKIP_VERIFY` is not set in production. Configure your Node.js environment with appropriate CA certificates if necessary.
For development, set the `VAULT_SKIP_VERIFY=true` environment variable (NOT recommended for production). For production, ensure your Vault instance uses a trusted certificate and your Node.js environment is configured to trust the issuing CA.
Verify the Vault token being used has the appropriate policies attached. Use `vault token capabilities <token> <path>` or check Vault audit logs to debug policy issues.
Ensure you call the imported `node-vault` function to get a client instance: `const vaultClient = require('node-vault')({ /* options */ });` or `import createVaultClient from 'node-vault'; const vaultClient = createVaultClient({ /* options */ });`Verify that your Vault server is running and accessible at the configured `endpoint` (or `VAULT_ADDR` environment variable). Check Vault's listener configuration.
No dependency data recorded yet.