npm.io
1.1.0 • Published 2d ago

@majico/sdk

Licence
MIT
Version
1.1.0
Deps
0
Size
64 kB
Vulns
0
Weekly
0

@majico/sdk

TypeScript client for the Majico.xyz public API.

Install

npm install @majico/sdk

Quickstart

import { MajicoClient } from "@majico/sdk";

const client = new MajicoClient({
  apiKey: process.env.MAJICO_API_KEY!,
  projectId: process.env.MAJICO_PROJECT_ID!,
  baseUrl: "https://api.majico.xyz",
});

const guidelines = await client.guidelines.get();
console.log(guidelines.productName, guidelines.llmPrompt.slice(0, 200));

Resources

Resource Method Description
client.brand get() Brand archetypes and niche intent
client.tokens get() Design tokens (palette, fonts)
client.logo get() Selected logo SVG
client.guidelines get() Full guidelines markdown + LLM prompt
client.designMd get() DESIGN.md for repo drop-in
client.export getManifest(), downloadZip() Export bundle
client.studio get(), patchHtmlFrame() Studio canvas read/write

Errors

import { MajicoClient, MajicoError } from "@majico/sdk";

try {
  await client.guidelines.get();
} catch (err) {
  if (err instanceof MajicoError) {
    console.error(err.status, err.code, err.isRetryable);
  }
}

API reference

Full endpoint and response documentation: docs/api-reference.md.

Publishing

Requires npm login with access to the @majico org:

npm whoami
cd packages/majico-sdk
npm publish --access public

License

MIT

Keywords