Node SDK and UX Updates

Saturday, February 8, 2025

node sdk cover

We're happy to announce the release of our Node.js SDK with full secrets management support including end-to-end encryption, secret referencing, personal override support and more! We've also updated the Console with a suite of UX and DX improvements to make common workflows around things like Integrations, Service Accounts and the CLI require fewer clicks and be more seamless.


Node.js SDK

The Node.js SDK allows you to securely manage secrets in your applications, from simple scripts to complex systems. Here's a basic overview of how to include the SDK in your app and use it to manage secrets. For more detailed information on how to work with the SDK, check out the documentation.

Install

The Node.js SDK is distributed via npm. You can install it using the following command for your preferred package manager.

npm i @phase.dev/phase-node or yarn add @phase.dev/phase-node

Import

Import the SDK in your application with:

const Phase = require("@phase.dev/phase-node");

Initialize

Initialize the SDK with your PAT or service account token:

const token = 'pss_service...'

const phase = new Phase(token)

Then you can use the get, create, update and delete methods to manage secrets:

Get Secrets

Get all secrets in an environment:

const getOptions: GetSecretOptions = {
  appId: "3b7443aa-3a7c-4791-849a-42aafc9cbe66",
  envName: "Development",
};

const secrets = await phase.get(getOptions);

Get a specific key:

const getOptions: GetSecretOptions = {
  appId: "3b7443aa-3a7c-4791-849a-42aafc9cbe66",
  envName: "Development",
  key: "foo"
};

const secrets = await phase.get(getOptions);

Create Secrets

Create one or more secrets in a specified application and environment:

import { CreateSecretOptions } from "phase";

const createOptions: CreateSecretOptions = {
  appId: "3b7443aa-3a7c-4791-849a-42aafc9cbe66",
  envName: "Development",
  secrets: [
    {
      key: "API_KEY",
      value: "your-api-key",
      comment: 'test key for dev'
    },
    {
      key: "DB_PASSWORD",
      value: "your-db-password",
      path: "/database",
    }
  ]
};

await phase.create(createOptions);

Update Secrets

Update existing secrets in a specified application and environment:

import { UpdateSecretOptions } from "phase";

const updateOptions: UpdateSecretOptions = {
  appId: "3b7443aa-3a7c-4791-849a-42aafc9cbe66",
  envName: "Development",
  secrets: [
    {
      id: "28f5d66e-b006-4d34-8e32-88e1d3478299",
      value: 'newvalue'
    },
  ],
};

await phase.update(updateOptions);

Delete Secrets

Delete one or more secrets from a specified application and environment:

import { DeleteSecretOptions } from "phase";

const secretsToDelete = secrets.map((secret) => secret.id);

const deleteOptions: DeleteSecretOptions = {
  appId: "3b7443aa-3a7c-4791-849a-42aafc9cbe66",
  envName: "Development",
  secretIds: secretsToDelete,
};

await phase.delete(deleteOptions);

Console UX improvements

The Console has received several updates aimed at reducing clicks, making common workflows more seamless, and making useful information more readily available.

Service Accounts

We've made several improvements to the workflows around service accounts, focusing on usability, clarity, and consistency. A new "Add Apps" button allows users to easily associate apps with service accounts via a dropdown. Selecting an app from the dropdown now routes users directly to the correct service account page under the Access tab of the chosen App, pre-filling the relevant service account in the add popup for a smoother workflow.

The apps list UI has been refined — legacy app cards have been replaced with a table-based layout for consistency, and service account pages now display App IDs, encryption status indicators (SSE/E2E), and token UUIDs with one-click copy. Additional enhancements include an improved header section with clearer labels, a refined access tokens table, and various bugfixes and optimizations to network calls.

Syncing and Integrations

We've cleaned up the Integrations screen and made it easier to set up credentials and syncs. Clicking "Add credentials" when setting up a new Sync will now take you straight to the appropriate credentials setup screen.

Misc other updates

Other updates to the Console include a one-click copy button for App IDs in the App page header, more informative UI states when searching secrets or setting up syncs, and various other bugfixes and cleanup.


The Node SDK version 3.0.0 is available on npm, and all the other updates discussed here are live now on Phase Cloud and available in v2.37.1 for self-hosted users.

Reach out on Slack or GitHub for any questions or feedback on this release!

CLOUD

The fastest and easiest way to get started with Phase. Spin up an app in minutes. Hosted in the 🇪🇺

SELF-HOSTED

Run Phase on your own infrastructure and maintain full control. Perfect for customers with strict compliance requirements.