SDK for Node.js

Quickstart

Connect an Express app to secure-cloud in five minutes. You need Node.js 20.19 or newer and a workspace in the dashboard.

The SDK gives your server three things: calling outside APIs (like a payment provider) without ever holding their keys, storing files encrypted, and signing your own users in. It runs on your server only, because it uses your app's API key.

1. Create an API key

In the dashboard, open your workspace, then API keys, then Create API key. Name it after your app, for example my-shop-server. Copy the key now: it is shown only once.

2. Install the SDK

Start a new project (or use your own), then install Express and the SDK. The SDK is a file you get from the platform's repository with pnpm sdk:pack (it lands in .local/); copy it into your project first.

Terminal
mkdir my-app && cd my-app
npm init -y
npm install express ./secure-cloud-sdk-0.1.0.tgz

3. Put your key in a .env file

The SDK reads two settings from the environment, so the key never sits in your code.

.env
SECURE_CLOUD_API_KEY=paste_your_key_here
SECURE_CLOUD_URL=http://localhost:8080

4. Write server.js

server.js
const express = require("express");
const { SecureCloud, errorHandler } = require("@secure-cloud/sdk");

const app = express();
app.use(express.json());

// Reads SECURE_CLOUD_API_KEY and SECURE_CLOUD_URL from the environment.
const cloud = new SecureCloud();

// List the files stored in your workspace.
app.get("/files", async (req, res) => {
  const files = await cloud.files.list();
  res.json(files);
});

// Turns SDK errors into clean JSON answers. Keep it after your routes.
app.use(errorHandler());

app.listen(3000, () => {
  console.log("Listening on http://localhost:3000");
});

5. Run it

Terminal
node --env-file=.env server.js
curl http://localhost:3000/files

You should see [], or your files if you uploaded some in the dashboard. That's it: your app is talking to secure-cloud.

Using import instead of require

If your project uses ES modules ("type": "module" in package.json), import the same names:

server.js
import express from "express";
import { SecureCloud, errorHandler } from "@secure-cloud/sdk";

TypeScript works out of the box: the SDK ships its own types, so your editor completes every function and shows what it returns.

NextCalling outside APIs →