{"id":28446476,"url":"https://github.com/phmatray/FormCraft","last_synced_at":"2025-06-30T01:31:44.080Z","repository":{"id":297596007,"uuid":"997249091","full_name":"phmatray/FormCraft","owner":"phmatray","description":"Build type-safe, dynamic forms in Blazor with an elegant fluent   API. FormCraft simplifies complex form creation with automatic   field rendering, validation, and dependency management. Features   include customizable field renderers, async validation,   conditional visibility, and seamless MudBlazor integration. ","archived":false,"fork":false,"pushed_at":"2025-06-16T08:46:29.000Z","size":2337,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T09:56:30.818Z","etag":null,"topics":["blazor-components","blazor-forms","blazor-library","dotnet","dynamic-forms","fluent-api","form-builder","form-validation","mudblazor","nuget"],"latest_commit_sha":null,"homepage":"https://phmatray.github.io/FormCraft/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phmatray.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-06T07:52:08.000Z","updated_at":"2025-06-16T08:46:06.000Z","dependencies_parsed_at":"2025-06-07T22:37:07.809Z","dependency_job_id":null,"html_url":"https://github.com/phmatray/FormCraft","commit_stats":null,"previous_names":["phmatray/dynamicformblazor","phmatray/formcraft"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/phmatray/FormCraft","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FFormCraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FFormCraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FFormCraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FFormCraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phmatray","download_url":"https://codeload.github.com/phmatray/FormCraft/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FFormCraft/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260829229,"owners_count":23069246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blazor-components","blazor-forms","blazor-library","dotnet","dynamic-forms","fluent-api","form-builder","form-validation","mudblazor","nuget"],"created_at":"2025-06-06T10:41:39.799Z","updated_at":"2025-06-30T01:31:44.067Z","avatar_url":"https://github.com/phmatray.png","language":"C#","readme":"# FormCraft 🎨\n\n\u003cdiv align=\"center\"\u003e\n\n[![NuGet Version](https://img.shields.io/nuget/v/FormCraft.svg?style=flat-square)](https://www.nuget.org/packages/FormCraft/)\n[![NuGet Downloads](https://img.shields.io/nuget/dt/FormCraft.svg?style=flat-square)](https://www.nuget.org/packages/FormCraft/)\n[![MudBlazor Version](https://img.shields.io/nuget/v/FormCraft.ForMudBlazor.svg?style=flat-square\u0026label=FormCraft.ForMudBlazor)](https://www.nuget.org/packages/FormCraft.ForMudBlazor/)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/phmatray/FormCraft/continuous.yml?branch=main\u0026style=flat-square)](https://github.com/phmatray/FormCraft/actions)\n[![License](https://img.shields.io/github/license/phmatray/FormCraft?style=flat-square)](https://github.com/phmatray/FormCraft/blob/main/LICENSE)\n[![Stars](https://img.shields.io/github/stars/phmatray/FormCraft?style=flat-square)](https://github.com/phmatray/FormCraft/stargazers)\n\n**Build type-safe, dynamic forms in Blazor with ease** ✨\n\n[Get Started](#-quick-start) • [Live Demo](https://phmatray.github.io/FormCraft/) • [Documentation](https://phmatray.github.io/FormCraft/docs/getting-started) • [Examples](#-examples) • [Contributing](CONTRIBUTING.md)\n\n\u003c/div\u003e\n\n---\n\n## 🌐 Live Demo\n\nExperience FormCraft in action! Visit our [interactive demo](https://phmatray.github.io/FormCraft/) to see:\n\n- 🎯 Various form layouts and configurations\n- 🔄 Dynamic field dependencies\n- ✨ Custom field renderers\n- 📤 File upload capabilities\n- 🎨 Real-time form generation\n\n## 🎉 What's New in v2.0.0\n\nFormCraft v2.0.0 brings exciting new features and improvements:\n\n### 🔒 Security Features\n- **Field-level encryption** for sensitive data protection\n- **CSRF protection** with built-in anti-forgery tokens\n- **Rate limiting** to prevent form spam\n- **Audit logging** to track all form interactions\n\n### 📦 Modular Architecture\n- **Separate UI framework packages** - Use only what you need\n- **FormCraft.ForMudBlazor** - MudBlazor implementation package\n- **Improved extensibility** - Easier to add custom UI frameworks\n\n### 🚀 Other Improvements\n- **Enhanced performance** with optimized rendering\n- **Better type safety** with improved generic constraints\n- **Comprehensive documentation** with live examples\n- **400+ unit tests** ensuring reliability\n\n## 🚀 Why FormCraft?\n\nFormCraft revolutionizes form building in Blazor applications by providing a **fluent, type-safe API** that makes complex forms simple. Say goodbye to repetitive form markup and hello to elegant, maintainable code.\n\n### ✨ Key Features\n\n- 🔒 **Type-Safe** - Full IntelliSense support with compile-time validation\n- 🎯 **Fluent API** - Intuitive method chaining for readable form configuration\n- 🎨 **MudBlazor Integration** - Beautiful Material Design components out of the box\n- 🔄 **Dynamic Forms** - Create forms that adapt based on user input\n- ✅ **Advanced Validation** - Built-in, custom, and async validators\n- 🔗 **Field Dependencies** - Link fields together with reactive updates\n- 📐 **Flexible Layouts** - Multiple layout options to fit your design\n- 🚀 **High Performance** - Optimized rendering with minimal overhead\n- 🧪 **Fully Tested** - 400+ unit tests ensuring reliability\n\n## 📦 Installation\n\n### FormCraft Core\n```bash\ndotnet add package FormCraft\n```\n\n### FormCraft for MudBlazor\n```bash\ndotnet add package FormCraft.ForMudBlazor\n```\n\n\u003e **Note**: FormCraft.ForMudBlazor includes FormCraft as a dependency, so you only need to install the MudBlazor package if you're using MudBlazor components.\n\n## 🎯 Quick Start\n\n### 1. Register Services\n\n```csharp\n// Program.cs\nbuilder.Services.AddFormCraft();\n```\n\n### 2. Create Your Model\n\n```csharp\npublic class UserRegistration\n{\n    public string FirstName { get; set; }\n    public string LastName { get; set; }\n    public string Email { get; set; }\n    public int Age { get; set; }\n    public string Country { get; set; }\n    public bool AcceptTerms { get; set; }\n}\n```\n\n### 3. Build Your Form\n\n```csharp\n@page \"/register\"\n@using FormCraft\n@using FormCraft.ForMudBlazor\n\n\u003ch3\u003eUser Registration\u003c/h3\u003e\n\n\u003cFormCraftComponent TModel=\"UserRegistration\" \n                   Model=\"@model\" \n                   Configuration=\"@formConfig\"\n                   OnValidSubmit=\"@HandleSubmit\"\n                   ShowSubmitButton=\"true\" /\u003e\n\n@code {\n    private UserRegistration model = new();\n    private IFormConfiguration\u003cUserRegistration\u003e formConfig;\n\n    protected override void OnInitialized()\n    {\n        formConfig = FormBuilder\u003cUserRegistration\u003e.Create()\n            .AddRequiredTextField(x =\u003e x.FirstName, \"First Name\")\n            .AddRequiredTextField(x =\u003e x.LastName, \"Last Name\")\n            .AddEmailField(x =\u003e x.Email)\n            .AddNumericField(x =\u003e x.Age, \"Age\", min: 18, max: 120)\n            .AddSelectField(x =\u003e x.Country, \"Country\", GetCountries())\n            .AddCheckboxField(x =\u003e x.AcceptTerms, \"I accept the terms and conditions\")\n                .IsRequired(\"You must accept the terms\")\n            .Build();\n    }\n\n    private async Task HandleSubmit(UserRegistration model)\n    {\n        // Handle form submission\n        await UserService.RegisterAsync(model);\n    }\n\n    private List\u003cSelectOption\u003cstring\u003e\u003e GetCountries() =\u003e new()\n    {\n        new(\"us\", \"United States\"),\n        new(\"uk\", \"United Kingdom\"),\n        new(\"ca\", \"Canada\"),\n        new(\"au\", \"Australia\")\n    };\n}\n```\n\n## 🎨 Examples\n\n### Dynamic Field Dependencies\n\nCreate forms where fields react to each other:\n\n```csharp\nvar formConfig = FormBuilder\u003cOrderForm\u003e.Create()\n    .AddSelectField(x =\u003e x.ProductType, \"Product Type\", productOptions)\n    .AddSelectField(x =\u003e x.ProductModel, \"Model\", \n        dependsOn: x =\u003e x.ProductType,\n        optionsProvider: (productType) =\u003e GetModelsForType(productType))\n    .AddNumericField(x =\u003e x.Quantity, \"Quantity\", min: 1)\n    .AddField(x =\u003e x.TotalPrice, \"Total Price\")\n        .IsReadOnly()\n        .DependsOn(x =\u003e x.ProductModel, x =\u003e x.Quantity)\n        .WithValueProvider((model, _) =\u003e CalculatePrice(model))\n    .Build();\n```\n\n### Custom Validation\n\nAdd complex validation logic with ease:\n\n```csharp\n.AddField(x =\u003e x.Username)\n    .WithValidator(new CustomValidator\u003cUser, string\u003e(\n        username =\u003e !forbiddenUsernames.Contains(username.ToLower()),\n        \"This username is not available\"))\n    .WithAsyncValidator(async (username, services) =\u003e\n    {\n        var userService = services.GetRequiredService\u003cIUserService\u003e();\n        return await userService.IsUsernameAvailableAsync(username);\n    }, \"Username is already taken\")\n```\n\n### Multiple Layouts\n\nChoose the layout that fits your design:\n\n```csharp\n// Vertical Layout (default)\n.WithLayout(FormLayout.Vertical)\n\n// Horizontal Layout\n.WithLayout(FormLayout.Horizontal)\n\n// Grid Layout\n.WithLayout(FormLayout.Grid, columns: 2)\n\n// Inline Layout\n.WithLayout(FormLayout.Inline)\n```\n\n### Advanced Field Types\n\n```csharp\n// Password field with confirmation\n.AddPasswordField(x =\u003e x.Password, \"Password\")\n    .WithHelpText(\"Must be at least 8 characters\")\n.AddPasswordField(x =\u003e x.ConfirmPassword, \"Confirm Password\")\n    .MustMatch(x =\u003e x.Password, \"Passwords do not match\")\n\n// Date picker with constraints\n.AddDateField(x =\u003e x.BirthDate, \"Date of Birth\")\n    .WithMaxDate(DateTime.Today.AddYears(-18))\n    .WithHelpText(\"Must be 18 or older\")\n\n// Multi-line text with character limit\n.AddTextAreaField(x =\u003e x.Description, \"Description\", rows: 5)\n    .WithMaxLength(500)\n    .WithHelpText(\"Maximum 500 characters\")\n\n// File upload\n.AddFileUploadField(x =\u003e x.Resume, \"Upload Resume\",\n    acceptedFileTypes: new[] { \".pdf\", \".doc\", \".docx\" },\n    maxFileSize: 5 * 1024 * 1024) // 5MB\n    \n// Multiple file upload\n.AddMultipleFileUploadField(x =\u003e x.Documents, \"Upload Documents\",\n    maxFiles: 3,\n    acceptedFileTypes: new[] { \".pdf\", \".jpg\", \".png\" },\n    maxFileSize: 10 * 1024 * 1024) // 10MB per file\n```\n\n## 🛠️ Advanced Features\n\n### Conditional Fields\n\nShow/hide fields based on conditions:\n\n```csharp\n.AddField(x =\u003e x.CompanyName)\n    .VisibleWhen(model =\u003e model.UserType == UserType.Business)\n    \n.AddField(x =\u003e x.TaxId)\n    .RequiredWhen(model =\u003e model.Country == \"US\")\n```\n\n### Field Groups\n\nOrganize related fields into groups with customizable layouts:\n\n```csharp\nvar formConfig = FormBuilder\u003cUserModel\u003e\n    .Create()\n    .AddFieldGroup(group =\u003e group\n        .WithGroupName(\"Personal Information\")\n        .WithColumns(2)  // Two-column layout\n        .ShowInCard(2)   // Show in card with elevation 2\n        .AddField(x =\u003e x.FirstName, field =\u003e field\n            .WithLabel(\"First Name\")\n            .Required())\n        .AddField(x =\u003e x.LastName, field =\u003e field\n            .WithLabel(\"Last Name\")\n            .Required())\n        .AddField(x =\u003e x.DateOfBirth))\n    .AddFieldGroup(group =\u003e group\n        .WithGroupName(\"Contact Information\")\n        .WithColumns(3)  // Three-column layout\n        .ShowInCard()    // Default elevation 1\n        .AddField(x =\u003e x.Email)\n        .AddField(x =\u003e x.Phone)\n        .AddField(x =\u003e x.Address))\n    .Build();\n```\n\n### Security Features (v2.0.0+)\n\nProtect your forms with built-in security features:\n\n```csharp\nvar formConfig = FormBuilder\u003cSecureForm\u003e.Create()\n    .WithSecurity(security =\u003e security\n        .EncryptField(x =\u003e x.SSN)           // Encrypt sensitive fields\n        .EncryptField(x =\u003e x.CreditCard)\n        .EnableCsrfProtection()             // Enable anti-forgery tokens\n        .WithRateLimit(5, TimeSpan.FromMinutes(1))  // Max 5 submissions per minute\n        .EnableAuditLogging())              // Log all form interactions\n    .AddField(x =\u003e x.SSN, field =\u003e field\n        .WithLabel(\"Social Security Number\")\n        .WithMask(\"000-00-0000\"))\n    .AddField(x =\u003e x.CreditCard, field =\u003e field\n        .WithLabel(\"Credit Card\")\n        .WithMask(\"0000 0000 0000 0000\"))\n    .Build();\n```\n\n### Custom Field Renderers\n\nCreate specialized input controls for specific field types:\n\n```csharp\n// Create a custom renderer\npublic class ColorPickerRenderer : CustomFieldRendererBase\u003cstring\u003e\n{\n    public override RenderFragment Render(IFieldRenderContext context)\n    {\n        return builder =\u003e\n        {\n            var value = GetValue(context) ?? \"#000000\";\n            \n            builder.OpenElement(0, \"input\");\n            builder.AddAttribute(1, \"type\", \"color\");\n            builder.AddAttribute(2, \"value\", value);\n            builder.AddAttribute(3, \"onchange\", EventCallback.Factory.CreateBinder\u003cstring\u003e(\n                this, async (newValue) =\u003e await SetValue(context, newValue), value));\n            builder.CloseElement();\n        };\n    }\n}\n\n// Use in your form configuration\n.AddField(x =\u003e x.Color, field =\u003e field\n    .WithLabel(\"Product Color\")\n    .WithCustomRenderer\u003cProductModel, string, ColorPickerRenderer\u003e()\n    .WithHelpText(\"Select the primary color\"))\n\n// Register custom renderers (optional for DI)\nservices.AddScoped\u003cColorPickerRenderer\u003e();\nservices.AddScoped\u003cRatingRenderer\u003e();\n```\n\nBuilt-in example renderers:\n- **ColorPickerRenderer** - Visual color selection with hex input\n- **RatingRenderer** - Star-based rating control using MudBlazor\n\n## 📊 Performance\n\nFormCraft is designed for optimal performance:\n\n- ⚡ Minimal re-renders using field-level change detection\n- 🎯 Targeted validation execution\n- 🔄 Efficient dependency tracking\n- 📦 Small bundle size (~50KB gzipped)\n\n## 🧪 Testing\n\nFormCraft is extensively tested with over 400 unit tests covering:\n\n- ✅ All field types and renderers\n- ✅ Validation scenarios\n- ✅ Field dependencies\n- ✅ Edge cases and error handling\n- ✅ Integration scenarios\n\n## 🤝 Contributing\n\nWe love contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n### Quick Start for Contributors\n\n```bash\n# Clone the repository\ngit clone https://github.com/phmatray/FormCraft.git\n\n# Build the project\ndotnet build\n\n# Run tests\ndotnet test\n\n# Create a local NuGet package\n./pack-local.sh  # or pack-local.ps1 on Windows\n```\n\n## 📖 Documentation\n\n📚 **[Complete Documentation](https://phmatray.github.io/FormCraft/docs/getting-started)** - Interactive docs with live examples\n\n- [Getting Started Guide](https://phmatray.github.io/FormCraft/docs/getting-started)\n- [API Reference](https://phmatray.github.io/FormCraft/docs/api-reference)\n- [Examples](https://phmatray.github.io/FormCraft/docs/examples)\n- [Customization](https://phmatray.github.io/FormCraft/docs/customization)\n- [Troubleshooting](https://phmatray.github.io/FormCraft/docs/troubleshooting)\n\n## 🗺️ Roadmap\n\n### ✅ Completed\n- [x] File upload field type\n- [x] Security features (encryption, CSRF, rate limiting, audit logging)\n- [x] Modular UI framework architecture\n\n### 🚧 In Progress\n- [ ] Import/Export forms as JSON\n- [ ] Rich text editor field\n\n### 📋 Planned\n- [x] Wizard/stepper forms\n- [ ] Drag-and-drop form builder UI\n- [ ] Form templates library\n- [ ] Localization support\n- [ ] More layout options\n- [ ] Integration with popular CSS frameworks\n- [ ] Form state persistence\n\n## 💬 Community\n\n- **Discussions**: [GitHub Discussions](https://github.com/phmatray/FormCraft/discussions)\n- **Issues**: [GitHub Issues](https://github.com/phmatray/FormCraft/issues)\n- **Twitter**: [@phmatray](https://twitter.com/phmatray)\n\n## 📄 License\n\nFormCraft is licensed under the [MIT License](LICENSE).\n\n## 🙏 Acknowledgments\n\n- [MudBlazor](https://mudblazor.com/) for the amazing component library\n- [FluentValidation](https://fluentvalidation.net/) for validation inspiration\n- The Blazor community for feedback and support\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**If you find FormCraft useful, please consider giving it a ⭐ on GitHub!**\n\nMade with ❤️ by [phmatray](https://github.com/phmatray)\n\n\u003c/div\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphmatray%2FFormCraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphmatray%2FFormCraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphmatray%2FFormCraft/lists"}