โ ๏ธ BuilderUI is under active development. Features, structure, and APIs may change frequently.
BuilderUI is a dynamic UI builder that empowers developers to design, preview, and manage Windows Forms entirely through structured JSON definitions. With an intuitive visual editor and real-time rendering, it simplifies the creation of complex forms without manual coding.
Key capabilities include:
- ๐ง Visual Design Tools: inspection and live form preview
- ๐ JSON-Driven UI: Define entire form structures and components declaratively via JSON
- ๐ Multi-Platform Export: Export your forms to Delphi, Lazarus, C# (.NET 9), and Java (Swing/AWT)
- ๐งฉ Component Customization: Full control over properties, styles, and layout
- ๐ Modern Architecture: Clean structure using patterns like Factory, Strategy, SRP, and Adapter
Whether you're prototyping UIs or building full applications, BuilderUI offers flexibility, portability, and extensibility โ all powered by JSON.
-
JSON-Based Form Creation
- Create forms dynamically using JSON definitions
- Real-time form preview
- Component property customization
- Nested control support
-
Multi-Platform Export
- Delphi Forms 100%
- Lazarus Forms 100%
- C# Windows Forms - dotnet 9 : 100%
- Java Swing/AWT
-
Visual Design Tools
- Ruler
- Component palette
- Property inspector (TreeView)
- Explore property
- Visual form designer
- Multi-select support X not
- Drag and drop functionality X not
-
Advanced Features
- Component tree view
- JSON validation
- Real-time preview
- Grid alignment system
- Component search functionality
- Syntax Highlighting with SynEdit
BuilderUI applies several classic and modern design patterns to maintain a clean, scalable, and maintainable architecture. The system is modular and organized into well-defined layers, each with a specific responsibility, embracing SOLID principles.
๐ง Applied Patterns
| Pattern | Description | Examples / Files |
|---|---|---|
| Factory Pattern | Encapsulates the instantiation of code generators per platform. | Factory.ICodeGenerator, Factory.CodeGeneratorFactory, Factory.CodeGenerator.Delphi/CSharp/Lazarus |
| Strategy Pattern | Decouples export logic into swappable algorithms per target platform. | Strategy.IExport, Strategy.Export.Delphi, Strategy.Export.CSharp, Strategy.Export.Lazarus |
| Builder Pattern | Builds complex form structures from JSON definitions step by step. | Builder.UIBuilderEngine, Core.IUIBuilder |
| Adapter Pattern | Adapts third-party or incompatible APIs like TreeView and SynEdit into the system. | Adapter.TreeViewAdapter, Adapter.SynEditAdapter |
| Service Layer | Isolates business logic into independent services. | Service.Zoom, Service.Export, Service.Json.Validation, Service.Component.Search, Service.StatusBar.Manager |
| Singleton (manual) | Provides a single shared instance for user configuration or global settings. | Builder.UI.UserPreferences |
| Decorator (implicit) | Enhances or extends component behavior through wrapping or helpers. | Applied via class helpers and component managers |
| Observer (partial) | Used in form lifecycle handling (e.g., OnClose) and UI updates (e.g., zoom display). |
FormBuilderMain, Service.Forms.Manager, Service.StatusBar.Manager |
| Facade (technical) | Central point of coordination between services, forms, adapters, and UI. | FormBuilderMain acts as the entry point and orchestrator |
Defines interfaces and base contracts
Core.IUIBuilder
Main engine to create forms
Builder.UIBuilderEngineBuilder.UI.UserPreferences
Integrates third-party or GUI systems
Adapter.TreeViewAdapterAdapter.SynEditAdapter
Independent business logic and tools
Service.ZoomService.ExportService.Forms.ManagerService.Json.ValidationService.StatusBar.Manager- (and others)
Shared helpers and tools
Util.JSONUtil.Form.ArrangerUtil.JSONValidatorEnum.Utils
Platform-specific form generators
Factory.CodeGenerator.DelphiFactory.CodeGenerator.CSharpFactory.CodeGenerator.Lazarus
Export logic for each platform
Strategy.Export.DelphiStrategy.Export.CSharpStrategy.Export.Lazarus
Application interface and screens
View.Builder.MainView.Export.FormsView.Menu.Context.WindowsView.Window.Json
{
"Type": "TForm",
"Name": "FrmMainForm",
"Caption": "Sample Form",
"Width": 800,
"Height": 600,
"Children": [
{
"Type": "TPanel",
"Name": "Panel1",
"Left": 10,
"Top": 10,
"Width": 200,
"Height": 100,
"Color": "#FFFFFF"
}
]
}You can leverage GitHub Copilot in Visual Studio Code to quickly generate and edit JSON files for BuilderUI:
- Open your project folder in VS Code.
- Open or create a
.jsonfile inside the/src/Jsondirectory (e.g.,MyForm.json). - Use Copilot Chat or inline suggestions to request or modify JSON structures.
- For example, type a comment like:
// Generate a JSON for a login form with user, password fields and a login button based in BuilderUI pattern. - Or ask in Copilot Chat:
Generate a product registration form with name, price, category (combobox), and save/cancel buttons based in BuilderUI pattern.
- For example, type a comment like:
- Accept Copilot's suggestion or edit as needed.
- Save the file. Having your forms as
.jsonfiles makes it much easier to edit, refactor, and reuse them with Copilot's help.
- Saving your JSON files allows Copilot to provide better context and more accurate suggestions.
- You can easily modify, extend, or refactor your forms by editing the JSON and letting Copilot assist with repetitive or boilerplate structures.
- Use the provided JSON examples as templates for your own screens.
- Advanced JSON converter and formatter. Transforms data into a structured, precise JSON format. Also exports JSON in a CSV file.
You can Using https://chatgpt.com/g/g-bIMOi37Fy-json
Open or create a .json file inside the /src/Json directory (e.g., MyForm.json), send a context and later the question
The idea is to use an integrated chat to assist users in generating, editing, and refactoring JSON UI definitions. This chat-based AI can help automate repetitive tasks, provide instant suggestions, and accelerate the UI design process directly within your development environment. Coming soon, need help.
BuilderUI uses DUnitX, a modern and extensible unit testing framework for Delphi, to ensure the correctness of core logic like JSON validation, export behavior, and form structure rules.
Tests are located in the /tests folder and follow the standard DUnitX pattern using [TestFixture] and [Test] attributes.
unit Test.Service.Json.Validation;
interface
uses
DUnitX.TestFramework,
TestFramework, // DUnit compatibility
Service.Json.Validation, // Class under test
System.SysUtils;
type
[TestFixture]
TestTBuilderUIValidatorService = class(TTestCase)
published
[Test]
procedure TestValidJSON;
[Test]
procedure TestInvalidJSON;
[Test]
procedure TestJSONWithDuplicateNames;
end;
implementation
procedure TestTBuilderUIValidatorService.TestValidJSON;
var
JSON: string;
Result: TBuilderUIValidationResult;
begin
JSON := '{ "Forms": [ { "Type": "TForm", "Name": "MainForm", "Caption": "Test" } ] }';
Result := TBuilderUIValidatorService.Validate(JSON);
CheckTrue(Result.IsValid, 'Expected JSON to be valid');
end;
procedure TestTBuilderUIValidatorService.TestInvalidJSON;
var
JSON: string;
Result: TBuilderUIValidationResult;
begin
JSON := '{ invalid json... ';
Result := TBuilderUIValidatorService.Validate(JSON);
CheckFalse(Result.IsValid, 'Expected invalid JSON');
end;
procedure TestTBuilderUIValidatorService.TestJSONWithDuplicateNames;
var
JSON: string;
Result: TBuilderUIValidationResult;
begin
JSON := '{ "Forms": [ { "Type": "TForm", "Name": "Form1", "Children": [ ' +
'{ "Type": "TEdit", "Name": "Edit1" }, { "Type": "TEdit", "Name": "Edit1" } ] } ] }';
Result := TBuilderUIValidatorService.Validate(JSON);
CheckFalse(Result.IsValid, 'Expected failure due to duplicate component names');
end;
initialization
RegisterTest(TestTBuilderUIValidatorService.Suite);
end.๐
..\src\Service; ..\src\Utils; $(DUnitX)
DUnitX command-line runner (optional)
Future: CI integration
- Clone the repository
- Open the project in Delphi
- Build and run the application
- Use the JSON editor to create your form
- Preview the results in real-time
- Export to your desired platform
- Delphi IDE (Recent versions)
- Windows Operating System
- Skia4Delphi components
- Synedit
Contributions are welcome! Please feel free to submit pull requests, create issues or suggest improvements.
This project is open source and available under the GNU License.
Note: This README provides an overview of the BuilderUI project. For detailed documentation and examples, please refer to the project documentation.

