@nsgx/api
v1.2.0
Published
NSG Studio API client for JavaScript/TypeScript
Readme
@nsgx/api
NSG Studio API client for JavaScript/TypeScript. Use server-side to talk to the NSG Studio API.
Install
pnpm add @nsgx/api
# or
npm install @nsgx/apiGet an API Key
Sign in at nsgx.io and go to Settings → API Keys to generate a key.
Usage
// Server-side only — never expose NSG_API_KEY to the browser
import { NSGClient } from "@nsgx/api"
const client = new NSGClient({
apiKey: process.env.NSG_API_KEY!,
})
// List your graphs
const graphs = await client.listGraphs()
// Fetch a specific graph
const graph = await client.getGraph(graphId)
// Issue a license for client-side rendering
const { license } = await client.issueLicense()Two-Key Model
| Key | Where | Purpose |
| ------------------ | --------------- | --------------------------------- |
| NSG_API_KEY | Server only | Proves your identity |
| licenseKey | Client-safe | Proves your tier (from issueLicense()) |
Never expose NSG_API_KEY to the browser. Use it only in server components, API routes, or server actions.
License
MIT
