{"id":18864,"library":"topaz-node","title":"Topaz Node SDK","description":"The official Node.js SDK for Topaz, a modern authorization service. Version 0.0.10 provides early-stage client bindings for managing users, roles, and permissions via the Topaz API. It ships with TypeScript definitions and supports both ESM and CommonJS. As a very early release (pre-1.0), the API is subject to rapid change. Key differentiators include native TypeScript support and a promise-based interface, but users should be cautious about stability and expect breaking changes between minor versions.","status":"active","version":"0.0.10","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install topaz-node","lang":"bash","label":"npm"},{"cmd":"yarn add topaz-node","lang":"bash","label":"yarn"},{"cmd":"pnpm add topaz-node","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export only; CJS users can use Topaz = require('topaz-node').default","wrong":"const Topaz = require('topaz-node')","symbol":"default","correct":"import Topaz from 'topaz-node'"},{"note":"Named export Topaz is available; default export is same object.","wrong":"import Topaz from 'topaz-node'","symbol":"Topaz","correct":"import { Topaz } from 'topaz-node'"},{"note":"User is a named type/class export.","wrong":"import User from 'topaz-node'","symbol":"User","correct":"import { User } from 'topaz-node'"},{"note":"TypeScript type for the client instance.","wrong":"","symbol":"TopazClient","correct":"import { TopazClient } from 'topaz-node'"}],"quickstart":{"code":"import Topaz, { User } from 'topaz-node';\nimport 'dotenv/config';\n\nconst client = new Topaz({\n  apiKey: process.env.TOPAZ_API_KEY ?? '',\n  baseUrl: process.env.TOPAZ_BASE_URL ?? 'https://api.topaz.sh'\n});\n\nasync function main() {\n  const user = await client.users.get('user123');\n  console.log(user.name);\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Initializes the Topaz client with environment variables and fetches a user by ID."},"warnings":[{"fix":"Pin to exact version and review changelog before upgrading.","message":"The SDK is pre-1.0 (v0.0.10) – expect frequent breaking changes between minor versions.","severity":"breaking","affected_versions":">=0.0.1 <1.0.0"},{"fix":"Use object parameter: client.users.create({ name: '...', email: '...' })","message":"The `createUser` method signature changed in v0.0.9; old signature with positional arguments is deprecated.","severity":"deprecated","affected_versions":"<0.0.9"},{"fix":"Use dynamic import or bundler that handles ESM.","message":"ESM-only environments (like Deno) require explicit import of 'topaz-node' due to missing CJS compat in some build outputs.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Do not use in browser; intended for Node.js only.","message":"The SDK uses `node-fetch` under the hood, which may cause issues in browser environments.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install topaz-node@0.0.10' and verify node_modules.","cause":"Package not installed or import path incorrect.","error":"Cannot find module 'topaz-node'"},{"fix":"Use: const Topaz = require('topaz-node').default;","cause":"Using default import in CJS without .default.","error":"Topaz is not a constructor"},{"fix":"Upgrade to v0.0.10: npm install topaz-node@0.0.10","cause":"Using older version before method was renamed.","error":"TypeError: client.users.get is not a function"},{"fix":"Set environment variable or pass apiKey option in constructor.","cause":"Missing or empty TOPAZ_API_KEY environment variable.","error":"Error: API key is required"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}