New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@ouicu/sdk

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ouicu/sdk

Share a port on your computer at a public link, or put a built site up, from Node.

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
15
7.14%
Maintainers
1
Weekly downloads
 
Created
Source

@ouicu/sdk

ouicu from Node: share a port on your computer at a public link, put a built site up, and see your shares, your sites, who opened them and the month's data.

npm install @ouicu/sdk

Node 20 or later. No other dependencies.

Logging in

The SDK uses the same key as the ouicu CLI. In order, it takes:

  • the apiKey option,
  • OUICU_API_KEY,
  • the key ouicu login saved (~/.config/ouicu/credentials.json on Linux, ~/Library/Application Support/ouicu/credentials.json on a Mac).

Make a key under Account on ouicu.com for CI. To log in from a script the way ouicu login does:

import { Ouicu } from "@ouicu/sdk";

const ouicu = new Ouicu();
await ouicu.login({
  onCode: ({ userCode, verificationUrl }) =>
    console.log(`Approve ${userCode} at ${verificationUrl}`),
});

The key is saved where the CLI keeps it, so the CLI is logged in too.

Put a built site up

const site = await ouicu.deploy("./dist", {
  name: "studio", // one of your sites to replace, or a reserved name
  spa: true, // unknown paths get index.html
  onProgress: ({ sent, total }) => console.log(`${sent} of ${total}`),
});
console.log(site.url); // https://studio.ouicu.app

It works as ouicu deploy does: only files ouicu does not have yet are uploaded, six at a time. Dot files (but .well-known), node_modules and links are left out, and so is anything that is not part of a web page; site.skipped says what and why. Free sites go a week after their last upload (site.expiresAt).

Share a port

const live = await ouicu.share(3000, {
  onRequest: ({ method, path, status }) => console.log(method, path, status),
});
console.log(live.url); // https://quiet-otter.ouicu.app

// later
await live.stop();

This runs the ouicu CLI (ouicu share 3000 --json), which has to be installed, version 0.1.7 or later:

curl -fsSL https://ouicu.com/install.sh | sh

share() resolves once the link works and rejects with the CLI's words if it is refused (a name taken, a plan limit). live.closed settles when the share ends, however it ends, with the reason. Shares still running when your process exits are stopped. On the Free plan, people opening the link in a browser see a short notice from ouicu first (live.notice).

A password (Hobby and Pro) goes to the CLI through its environment, never its arguments: ouicu.share(3000, { password: "..." }).

Shares, sites and the month's data

await ouicu.whoami(); // { email, name, plan, key }
await ouicu.usage(); // { plan, month, bytes, requests, allowanceBytes, resetsAt, over }

await ouicu.shares.list(); // live ones first, then the latest ended
await ouicu.shares.stop(id);
await ouicu.shares.requests(id); // { available, visitors, requests }

await ouicu.sites.list();
await ouicu.sites.delete(id);
await ouicu.sites.requests(id);

Errors

Everything ouicu refuses throws an OuicuError with ouicu's own words and the HTTP status: 401 a key that does not work (or none), 403 not on your plan or a suspended account, 404, 409 a name taken, 413 too large, 429 too many or over the month's data. status is 0 when ouicu never answered, a folder could not be read, or the CLI failed.

import { OuicuError } from "@ouicu/sdk";

try {
  await ouicu.deploy("./dist");
} catch (err) {
  if (err instanceof OuicuError && err.status === 429) console.log(err.message);
  else throw err;
}

Settings

OptionEnvironmentDefault
apiKeyOUICU_API_KEYthe key ouicu login saved
apiOUICU_APIhttps://ouicu.com
tunnelOUICU_TUNNELthe CLI's own
binOUICU_BINouicu on the PATH

License

MIT

Keywords

ouicu

FAQs

Package last updated on 03 Oct 2026

Related posts