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

@zod-to-form/core

v0.4.1

Published

Schema walker and processor registry for Zod v4 form generation

Readme

@zod-to-form/core

Schema walker and processor registry for Zod v4 form generation.

@zod-to-form/core is the foundation package in this monorepo. It walks a Zod schema and produces a FormField[] intermediate representation that can be consumed by runtime renderers (like @zod-to-form/react) or code generators (like @zod-to-form/cli).

Installation

pnpm add @zod-to-form/core zod

Requirements

  • Node.js >= 20
  • Zod v4

Quick Start

import { z } from 'zod';
import { walkSchema } from '@zod-to-form/core';

const schema = z.object({
  name: z.string().min(1).describe('Your full name'),
  age: z.number().int().min(0),
  newsletter: z.boolean().default(false)
});

const fields = walkSchema(schema);

console.log(fields.map((f) => ({ key: f.key, component: f.component })));

API

walkSchema(schema, options?)

Converts a top-level z.object(...) schema into ordered form field descriptors.

  • Throws if top-level schema is not z.object(...)
  • Applies built-in processors based on internal Zod def type
  • Supports custom processors and form metadata registry
  • Guards recursion with maxDepth (default: 5)
import { walkSchema } from '@zod-to-form/core';

const fields = walkSchema(schema, {
  maxDepth: 8,
  processors: {
    // override/add processors by zod def.type
  }
});

createProcessors(overrides?)

Returns processor map with built-ins plus optional overrides.

builtinProcessors

Built-in processor registry for core Zod types.

processors

Namespace export of individual processor implementations.

Utility Exports

  • inferLabel(key: string)
  • joinPath(...parts: string[])
  • createBaseField(key: string, zodType: string)

Types

Core public types:

  • FormField
  • FormFieldOption
  • FormFieldConstraints
  • FormMeta
  • FormProcessor
  • FormProcessorContext
  • ProcessParams
  • WalkOptions
  • ZodFormRegistry

Form Metadata via Zod Registry

Attach UI metadata to schemas with a Zod registry and pass it as formRegistry.

import { z } from 'zod';
import { walkSchema } from '@zod-to-form/core';
import type { FormMeta } from '@zod-to-form/core';

const formRegistry = z.registry<FormMeta>();

const schema = z.object({
  bio: z.string(),
  email: z.string().email()
});

formRegistry.add(schema.shape.bio, {
  fieldType: 'textarea',
  order: 1,
  gridColumn: 'span 2'
});

const fields = walkSchema(schema, { formRegistry });

Custom Processor Example

import type { FormProcessor } from '@zod-to-form/core';
import { walkSchema } from '@zod-to-form/core';

const customStringProcessor: FormProcessor = (_schema, _ctx, field) => {
  field.component = 'Input';
  field.props.type = 'text';
  field.props.autoComplete = 'off';
};

const fields = walkSchema(schema, {
  processors: {
    string: customStringProcessor
  }
});

Relationship to Other Packages

  • @zod-to-form/react consumes FormField[] at runtime to render forms.
  • @zod-to-form/cli consumes FormField[] at build time to generate TSX components.

Development

From repository root:

pnpm --filter @zod-to-form/core run build
pnpm --filter @zod-to-form/core run test
pnpm --filter @zod-to-form/core run type-check