New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Framework-agnostic utilities that traverse json-render specs and generate code for custom exporters.

skills.sh installs
8.9K
GitHub stars
19.8K
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers tree traversal, prop serialization, string escaping, and types for building code generators from UI specs
  • Includes traverseSpec, collectUsedComponents, collectStatePaths, collectActions, and serializeProps for extracting components, state paths, and actions
  • Provides SerializeOptions for choosing single or double quotes and indentation when emitting code
  • Designed for developers building custom exporters for Next.js, Remix, or other frameworks

Install

$ npx -y skills add vercel-labs/json-render --skill codegen -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

@json-render/codegen

Framework-agnostic utilities for generating code from json-render UI trees. Use these to build custom code exporters for Next.js, Remix, or other frameworks.

Installation

npm install @json-render/codegen

Tree Traversal

import {
  traverseSpec,
  collectUsedComponents,
  collectStatePaths,
  collectActions,
} from "@json-render/codegen";

// Walk the spec depth-first
traverseSpec(spec, (element, key, depth, parent) => {
  console.log(`${" ".repeat(depth * 2)}${key}: ${element.type}`);
});

// Get all component types used
const components = collectUsedComponents(spec);
// Set { "Card", "Metric", "Button" }

// Get all state paths referenced
const statePaths = collectStatePaths(spec);
// Set { "analytics/revenue", "user/name" }

// Get all action names
const actions = collectActions(spec);
// Set { "submit_form", "refresh_data" }

Serialization

import {
  serializePropValue,
  serializeProps,
  escapeString,
  type SerializeOptions,
} from "@json-render/codegen";

// Serialize a single value
serializePropValue("hello");
// { value: '"hello"', needsBraces: true }

Details

Repository
github.com/vercel-labs/json-render
Categories
Frontend & UI Code, Skill & Plugin Building
First seen
May 16, 2026

More from vercel-labs/json-render

All 30

Similar to Codegen

More Frontend & UI Code