How lovasoa/jsonjoy-builder works
Project Type and Purpose
• This is a front-end-only, React-based visual JSON Schema editor.
• It runs entirely in the browser, with no custom backend service.
• Key features: visual schema editing, real-time JSON view, schema inference, JSON validation.
File Structure
• src/components/ organizes React components:
• SchemaEditor (visual + JSON tabs)
• SchemaVisualEditor, JsonSchemaVisualizer
• Feature dialogs: SchemaInferencer, JsonValidator
• UI primitives: buttons, inputs, dialogs (ShadCN UI wrappers)
• src/lib/ contains core logic: schema-inference, editor helpers, utilities.
• src/hooks/ holds reusable React hooks (mobile-detection, theme, toast).
• src/utils/ has JSON validator wrapper, example-schema generator.
• No backend folder—pure client app.
• Build/deploy: rsbuild.config.ts, package.json scripts, tailwind configs.
• Tests: lightweight Node.js test runner under test/ and javascript:test/.
README Insights
• Confirms React + TypeScript + Rsbuild + Monaco Editor + Ajv + Zod + ShadCN UI.
• Describes core components and feature capabilities.
• No external APIs—everything runs in-browser.
Main Components
a. User Interface Layer
• React Components (SchemaEditor, SchemaVisualEditor, JsonSchemaVisualizer, SchemaInferencer, JsonValidator)
• UI primitives (buttons, dialogs, sidebar)
• Monaco Editor embedded for JSON view
b. Business-Logic Layer (client-side libraries)
• Schema inference engine (src/lib/schema-inference.ts)
• JSON validation engine (Ajv wrapper in src/utils/jsonValidator.ts)
• In-memory schema state/store (React state + hooks)
c. Utility Layer
• Zod for parsing
• ShadCN UI components
• Tailwind CSS for styling
d. Build & Deployment
• Rsbuild (development server + bundler)
• package.json scripts
• Output: static assets in dist/ served over CDN or static host
e. Testing
• Node.js Test Runner executing tests in test/ and javascript:test/
Relationships and Data Flows
• User actions in the UI trigger React state updates.
• UI dispatches to schema-inference or validation modules.
• Business logic returns results (new schema AST or validation errors).
• React updates the visual or JSON panes.
• Monaco Editor reads/writes JSON through props.
• Build pipeline transforms source → bundle → deploy.
• Test runner imports src/lib and src/utils to verify logic.
Architectural Patterns & Principles
• SPA with unidirectional data flow (React).
• Component-based modularization.
• Clear separation:
• Presentation (UI components)
• Domain logic (schema inference/validation)
• Utilities & third-party libs
• Hooks for cross-cutting concerns (theme, mobile view, toasts).
Final Checklist
• Break the SPA into: UI Layer, Logic Layer, External Dependencies, Build/Deploy, Testing.
• Technologies (React, Ts, Ajv, Zod, Monaco, Rsbuild, Tailwind).