Replies: 2 comments
-
|
Honest answer: there's no mature server-rendered RJSF equivalent in the Node world. JSONForms ships a vanilla renderer set but still expects a JS runtime to mount; SurveyJS works but is heavy and opinionated. Most teams converge on what you're already doing — just structure it. Pattern that scales well:
import Ajv from "ajv";
import addFormats from "ajv-formats";
import addErrors from "ajv-errors";
const ajv = new Ajv({ allErrors: true, coerceTypes: true, useDefaults: true });
addFormats(ajv); addErrors(ajv);
export const compile = (schema) => ajv.compile(schema);<%# render-field.ejs %>
<% const w = uiSchema?.[name]?.['ui:widget'] || schema.type %>
<%- include(`widgets/${w}`, { name, schema, value, errors }) %>
If you outgrow this, layer htmx on top — you get RJSF-style dynamic add/remove of array items via server fragments, no frontend framework required. |
Beta Was this translation helpful? Give feedback.
-
|
For server-side form generation in Express with EJS, there are a few solid alternatives to RJSF: 1.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I’m working on an Express.js application (with EJS templates) and I have a requirement to build forms dynamically using JSON schema.
I’m aware of react-jsonschema-form (RJSF), but it’s React-based and not suitable for my current setup since I’m not using a frontend framework.
Currently, I’m generating forms manually by looping through a JSON schema in EJS, but I’m looking for a more structured or library-based approach that can:
Generate form UI from JSON schema
Support basic validation
Work with server-side rendering (Express/EJS)
Ideally reduce manual template logic
Is there any library or approach in the Express ecosystem that provides functionality similar to RJSF?
Or is building a custom solution (schema + EJS + validation like Ajv) the recommended approach?
Would appreciate any suggestions, best practices, or examples.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions