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

noema

v0.0.3

Published

A TypeScript library for AI-powered React component generation using OpenAI

Downloads

7

Readme

Noema

A TypeScript library for AI-powered React component generation and selection. Built with OpenAI, this library helps you generate React components from natural language descriptions or select from existing component libraries.

Features

  • 🤖 AI-Powered: Uses OpenAI's latest models for intelligent component generation and selection
  • 🎨 Component Generation: Generate complete React components from text descriptions
  • 📚 Component Selection: Intelligently select from your existing component library based on requirements
  • 🔒 Type Safe: Built with TypeScript for a great development experience
  • ⚛️ React Ready: Designed for React 18+ applications
  • 🛠️ Flexible: Use your own OpenAI API key and customize generation parameters

Installation

npm install noema

Requirements

  • Node.js >= 20.0.0
  • React >= 18.0.0

Quick Start

Setup

First, create a new NoemaAgent with your OpenAI API key:

import { NoemaAgent, OpenAIAIProvider } from 'noema';

// Basic setup (uses gpt-4o by default)
const agent = new NoemaAgent({
  aiProvider: new OpenAIAIProvider('your-openai-api-key')
});

// Advanced setup with custom model and base URL
const advancedAgent = new NoemaAgent({
  aiProvider: new OpenAIAIProvider(
    'your-openai-api-key',
    'gpt-4-turbo-preview',  // optional: specify different model
    'https://your-proxy.com/v1'  // optional: custom base URL for enterprise/proxy setups
  )
});

Generating Components

Generate a new React component from a text description:

const result = await agent.generateComponent(
  "Create a user profile card",
  "The card should display a user's name, avatar, and bio in a modern design"
);

console.log(result.code);
// Returns TypeScript React component code

Selecting Components

Select from your existing component library based on requirements:

const components = [
  {
    name: 'Button',
    component: Button,
    propsSchema: {
      label: 'string',
      variant: ['primary', 'secondary']
    }
  },
  {
    name: 'Card',
    component: Card,
    propsSchema: {
      title: 'string',
      content: 'string'
    }
  }
];

const result = await agent.chooseComponent(
  "I need a clickable element for form submission",
  components
);

// Returns { component: Button, props: { label: 'Submit', variant: 'primary' } }

Generating Full Pages

Generate complete page layouts with multiple components:

const result = await agent.generatePage(
  "Create a dashboard page",
  "The dashboard should include a header with navigation, a main stats section, and a footer"
);

console.log(result.code);
// Returns TypeScript React page component code

Using React Hooks

The library provides React hooks for easier integration:

import { useGeneratedComponent, useGeneratedPage } from 'noema';

function MyComponent() {
  const { generated, loading, error } = useGeneratedComponent(
    agent,
    "dashboard context",
    "Create a stats display component"
  );

  if (loading) return <div>Generating component...</div>;
  if (error) return <div>Error: {error}</div>;
  if (!generated) return null;

  // Use the generated component code
  return <div>{generated.code}</div>;
}

API Reference

NoemaAgent

The main class for interacting with the AI capabilities:

class NoemaAgent {
  constructor(options: NoemaOptions);
  
  async generateComponent(
    context: string,
    requirement: string,
    componentLibrary?: ComponentDefinition[]
  ): Promise<GeneratedComponent>;

  async generatePage(
    context: string,
    requirement: string,
    componentLibrary?: ComponentDefinition[]
  ): Promise<GeneratedPage>;

  async chooseComponent(
    context: string,
    components: ComponentDefinition[]
  ): Promise<ChosenComponent>;
}

OpenAIAIProvider

The default AI provider using OpenAI:

class OpenAIAIProvider implements AIProvider {
  constructor(
    apiKey: string,
    model?: string,  // defaults to "gpt-4o"
    baseURL?: string // optional base URL for enterprise/proxy setups
  );
  
  async generate(
    prompt: string,
    options?: { max_tokens?: number; temperature?: number }
  ): Promise<string>;
}

React Hooks

function useGeneratedComponent(
  agent: NoemaAgent,
  context: string,
  requirement: string,
  componentLibrary?: ComponentDefinition[]
): {
  generated: GeneratedComponent | null;
  loading: boolean;
  error: string | null;
  regenerate: () => void;
};

function useGeneratedPage(
  agent: NoemaAgent,
  context: string,
  requirement: string,
  componentLibrary?: ComponentDefinition[]
): {
  generated: GeneratedPage | null;
  loading: boolean;
  error: string | null;
  regenerate: () => void;
};

License

MIT License - see the LICENSE file for details.