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

getsyntux

v0.5.0

Published

The declarative generative-UI library.

Readme


https://github.com/user-attachments/assets/694d4646-c36d-4c19-a111-86e546484101

  • Streamable - display UI as you generate.
  • 🎨 Custom Components - use your own React components.
  • 💾 Cacheable - reuse generated UIs with new values.

How does it work? syntux generates a JSON-DSL to represent the UI, known as the React Interface Schema. The specifics are in the FAQ below.


API

syntux is built for React and Next.js.

One component is all you need:

const valueToDisplay = {
    "username": "John",
    "email": "[email protected]",
    "age": 22
}

<GeneratedUI
    model={anthropic('claude-sonnet-4-5')}
    value={valueToDisplay}
    hint="UI should look like..."   
/>

syntux takes the value into consideration and designs a UI to best display it. value can be anything; an object, array or primitive.

[!TIP] If you are passing in a large array as a value, or an object with untrusted input, use the skeletonize property. See the explanation.

Installation

In the root of your project:

$ npx getsyntux@latest

This will automatically install the required components in the lib/getsyntux folder.

We use the Vercel AI SDK to provide support for all LLM providers. To install the model providers:

$ npm i ai
$ npm i @ai-sdk/anthropic (if you're using Claude)

Examples

Basic Example

Generate a simple UI with a hint:

import { GeneratedUI } from "@/lib/getsyntux/GeneratedUI";
import { createAnthropic } from "@ai-sdk/anthropic";

/* this example uses Claude, but all models are supported! */
const anthropic = createAnthropic({ apiKey: ... })

export default function Home(){
    const valueToDisplay = { ... };
    return <GeneratedUI model={anthropic("claude-sonnet-4-5")} value={valueToDisplay} hint="UI should look like..." />
}

Caching

Cache generated UI based on a user ID:

const cache: Map<number, string> = new Map();
export default function Home(){
    const userID = 10;
    const valueToDisplay = { ... };
    return <GeneratedUI cached={cache.get(userID)} onGenerate={(result) => {
        cache.set(userID, result)
    }} model={anthropic("claude-sonnet-4-5")} value={valueToDisplay} />
}

Custom components

Use your own components, or someone else's (a library):

import { CustomOne, CustomTwo } from '@/my_components'
export default function Home(){
   const valueToDisplay = { ... };

   <GeneratedUI components={[
    { name: 'Button', props: "{ color: string, text: string }", component: CustomOne },
    { name: 'Input', props: "{ initial: string, disabled: boolean }", component: CustomTwo, context: "Creates an input field with an (initial) value. Can be disabled." }
   ]} />
}

Note: the components array above can be generated automatically with npx getsyntux generate-defs <component.tsx>. See the documentation.

Custom actions

Perform server actions, attached automatically to component events:

import { defineTool } from "getsyntux";

export default function Home(){
   const valueToDisplay = { ... };

   <GeneratedUI actions = {{
    "delete": defineTool(async (id: string) => { "use server"; /* ... */ }, "id: string", "deletes post with id"),
    "refresh": defineTool(async () => { "use server"; /* ... */})
   }} />
}

The name of the action should specify its purpose (it is seen by the LLM).

Use defineTool to add further context to actions. See the documentation.


FAQ

syntux is highly optimized to save tokens. See here for a cost estimation table and an explanation.

Generated UIs must be secure, reusable and cacheable.

As such, syntux does not generate source code. It generates a schema for the UI, known as a "React Interface Schema" (RIS). See the question below to get a better understanding.

This schema is tailored to the value that you provide. It is then hydrated by syntux and rendered.

The generated UI is determined by the React Interface Schema (see the above question).

Thus, if the same schema is provided, the same UI will be generated.

For simplicity, the schema is simply a string. It is up to you how you wish to store it; in memory, in a file, in a database etc,.

Use the onGenerate and cached properties to retrieve/provide a cached schema respectively.

Generating state is an anti-pattern and leads to poorly performing, insecure applications.

If you need to handle state, wrap non-stateful components in stateful ones, then pass those as custom components to syntux.

It's a list of JSON objects, each delimited by a newline. Each object contains information about the element/component, props, and an id and parentId.

The RIS does not hardcode values. It binds to properties of the value and has built-in iterators (with the type field), making it reusable and token-efficient (for arrays).

Originally (pre-v0.2.x), the schema was a deep JSON tree. However, post-v0.2.x it was switched to a flat JSON list, as this allows for the UI to be built progressively (streamed).

As such, the id and parentId fields are used to construct the tree as-you-go.

Below is an example:

{"id":"loop_1", "parentId":"root", "type":"__ForEach__", "props":{"source":"authors"}}
{"id":"card_1", "parentId":"loop_1", "type":"div", "props":{"className":"card"}, "content": {"$bind": "$item.name"}}

To get a better understanding, or to implement your own parser, see the spec.


syntux is open source software, licensed under the MIT license.