npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cubegen-ai

v1.0.4

Published

Official SDK for CubeGen AI - Generate software architecture diagrams from text prompts

Readme

CubeGen AI SDK

The official SDK for integrating CubeGen AI into your applications. Generate beautiful software architecture diagrams from simple text prompts.

Installation

npm install cubegen-ai

Quick Start

import CubeGenAI from 'cubegen-ai';

// Initialize the client with your API key
// Get your API key from your CubeGen AI dashboard after subscribing to a Pro plan
const client = new CubeGenAI('your-api-key');

// Generate a diagram from a text prompt
try {
  const diagram = await client.generateDiagram('A 3-tier web application on AWS with a load balancer, multiple EC2 instances in an auto-scaling group, and an RDS database.');
  console.log('Generated diagram:', diagram);
} catch (error) {
  console.error('Error generating diagram:', error.message);
}

API Reference

Constructor

new CubeGenAI(apiKey[, baseUrl])
  • apiKey (string, required): Your CubeGen AI API key. Get this from your dashboard after subscribing to a Pro plan.
  • baseUrl (string, optional): The base URL for the API. Defaults to the production API.

Methods

generateDiagram(prompt)

Generate a diagram from a text prompt.

  • prompt (string, required): A text description of the architecture you want to generate.
  • Returns: Promise<DiagramData> - A promise that resolves to the generated diagram data.

Example:

const diagram = await client.generateDiagram('A microservice architecture with API Gateway, Lambda functions, and DynamoDB.');

Diagram Data Structure

The generated diagram follows this structure:

interface DiagramData {
  title: string;
  architectureType: string;
  nodes: Array<{
    id: string;
    label: string;
    type: string;
    description: string;
    x: number;
    y: number;
    width: number;
    height: number;
  }>;
  links: Array<{
    id: string;
    source: string;
    target: string;
    label?: string;
  }>;
  containers?: Array<{
    id: string;
    label: string;
    type: string;
    childNodeIds: string[];
    x: number;
    y: number;
    width: number;
    height: number;
  }>;
}

Error Handling

The SDK throws errors for API issues or invalid requests. Catch these errors to handle them appropriately:

try {
  const diagram = await client.generateDiagram(prompt);
} catch (error) {
  console.error('API Error:', error.message);
  // Handle the error appropriately
}

How It Works

The CubeGen AI SDK communicates with our backend service which leverages advanced AI models (including Gemini, GPT, and others) to generate architecture diagrams from natural language descriptions. The backend handles the complex process of:

  • Interpreting architectural descriptions
  • Generating appropriate visual representations
  • Creating node-link diagrams with proper layouts
  • Providing structured JSON data that can be rendered in various formats

Prerequisites

  • A CubeGen AI Pro or Business subscription to generate API keys
  • Node.js version 12 or higher

Support

Need help? Visit our documentation or contact support.

License

MIT