---
title: 'Installation and quick start'
description: 'Install the forms package and the Radiant renderer, create the engine, check a form loaded as JSON and render it.'
order: 2
---

# Installation and quick start

This page builds a contact form: an engine with the elements of a renderer, a form config loaded as JSON, the issues a bad config reports, and the form drawn on the page with its values handed to your code. It renders with [Forms Radiant](/docs/forms-radiant/overview). The same engine and config render with [Forms React](/docs/forms-react/getting-started) once you register elements that draw with React.

## Install

```bash
pnpm add @schema-engine/forms @schema-engine/forms-radiant @schema-engine/layout @schema-engine/registry @ecopages/radiant-ui @ecopages/radiant @ecopages/jsx @ecopages/signals zod
```

Zod provides the `zod/mini` entry point the first-party schemas use. Registrations may use any [Standard Schema](https://standardschema.dev/) validator. Radiant renders with its own JSX runtime and three stylesheets: [Forms Radiant](/docs/forms-radiant/getting-started) sets them up. The [React quick start](/docs/forms-react/getting-started) has the equivalent setup for React.

## 1. Create the engine

`createFormEngine` builds an engine from lists of registrations: the elements a form may use, the recipes that frame it, the actions it may run and the validation rules. A renderer supplies the elements that draw. `createRadiantFormEngine` is `createFormEngine` with the Radiant elements and view recipes registered, and `schemaFormRegistrations` is the list of elements. To write an element of your own, see [Engine and registrations](/docs/forms/engine).

```ts title="engine.ts"
import { createRadiantFormEngine, schemaFormRegistrations } from '@schema-engine/forms-radiant';

export const engine = createRadiantFormEngine({ elements: schemaFormRegistrations });
```

## 2. Check a form loaded as JSON

A form config is data, so it can come from a file or a server. `engine.validateForm` checks it and returns a frozen `NormalizedFormConfig`, or throws a `FormValidationError`. `engine.safeValidateForm` returns `{ success, data }` or `{ success: false, issues }` instead. Each issue has a `message` and the `path` of the config key it is about. See [Form configuration errors](/docs/forms/engine#form-configuration-errors).

```ts title="contact.ts"
import { engine } from './engine';

const contactJson = `{
	"id": "contact",
	"steps": [
		{
			"id": "details",
			"title": "Your details",
			"elements": [
				{ "$type": "input", "id": "name", "name": "name", "label": "Name", "rules": [{ "$type": "required" }] },
				{
					"$type": "input",
					"id": "email",
					"name": "email",
					"label": "Email",
					"inputType": "email",
					"rules": [{ "$type": "required" }, { "$type": "email" }]
				},
				{ "$type": "submit", "id": "send", "name": "send", "label": "Send" }
			]
		}
	]
}`;

export const contact = engine.validateForm(JSON.parse(contactJson));
```

A config with mistakes is reported, not thrown, by `safeValidateForm`. This one names an element type nobody registered and leaves out a field's required `name`:

```ts title="broken.ts"
import { formatIssuePath } from '@schema-engine/registry';
import { engine } from './engine';

const brokenJson = `{
	"id": "contact",
	"steps": [
		{
			"id": "details",
			"title": "Your details",
			"elements": [
				{ "$type": "phone", "id": "phone", "name": "phone" },
				{ "$type": "input", "id": "name" }
			]
		}
	]
}`;

const result = engine.safeValidateForm(JSON.parse(brokenJson));
if (!result.success) {
	for (const { path, message } of result.issues) console.log(`${formatIssuePath(path)}: ${message}`);
}
```

```text
steps[0].elements[0].$type: No registration for $type 'phone'. Register it with createFormEngine({ elements: [...] }).
steps[0].elements[1].name: Invalid input: expected string, received undefined
```

Both problems are reported at once, each with the position of the key to fix.

## 3. Render it

The renderer draws the config and owns the form's state. `FormRenderer` validates the config, renders it and calls `onSubmit` with the values that passed validation:

```tsx title="render.tsx"
import type { FormValues } from '@schema-engine/forms';
import { FormRenderer } from '@schema-engine/forms-radiant';
import { contact } from './contact';
import { engine } from './engine';

export function ContactForm({ onSubmit }: { onSubmit: (values: FormValues) => void }) {
	return <FormRenderer engine={engine} config={contact} onSubmit={onSubmit} />;
}
```

With both fields empty, a submit shows the `required` messages and `onSubmit` is not called. Once the visitor fills them in, `onSubmit` receives `{ name: 'Ada Lovelace', email: 'ada@example.com' }`. Send the values with the `fetch` that `onSubmit` is given, or name a [`submit` action](/docs/forms/actions) in the config and let the engine post them. [Forms Radiant](/docs/forms-radiant/getting-started#4-render-a-form) covers the styles, the server-side rendering and the controls.

## Where to go next

- [Engine and registrations](/docs/forms/engine): authoring modes, configuration errors, view recipes.
- [Forms React](/docs/forms-react/getting-started) or [Forms Radiant](/docs/forms-radiant/getting-started): draw this form with the renderer you use.
- [Validation](/docs/forms/validation): the 27 rules and your own.
- [Actions](/docs/forms/actions): the actions a form ships.
