Getting Started
SDKs

From local development to production, Infisical’s language-specific SDKs provide the easiest way for your app to fetch back secrets on demand.

Prerequisites:

Installation

Follow the instructions for your language to install the SDK for it.

  • Node

  • Python

  • Other

Run npm to add infisical-node to your project.

$ npm install infisical-node --save

Configuration

Import the SDK and create a client instance with your Infisical Token.

  • ES6

  • ES5

import InfisicalClient from "infisical-node";

const client = new InfisicalClient({
    token: "your_infisical_token"
});

Get a Secret

const secret = await client.getSecret("API_KEY");
const value = secret.secretValue; // get its value

Basic Usage

import express from "express";
import InfisicalClient from "infisical-node";
const app = express();
const PORT = 3000;

const client = new InfisicalClient({
    token: "YOUR_INFISICAL_TOKEN"
});

app.get("/", async (req, res) => {
    // access value
    const name = await client.getSecret("NAME");
    res.send(`Hello! My name is: ${name.secretValue}`);
});

app.listen(PORT, async () => {
    console.log(`App listening on port ${port}`);
});

This example demonstrates how to use the Infisical Node SDK with an Express application. The application retrieves a secret named “NAME” and responds to requests with a greeting that includes the secret value.

See also: