{"id":30206717,"url":"https://github.com/phmatray/minimalhtmx","last_synced_at":"2025-08-13T15:50:33.414Z","repository":{"id":305833229,"uuid":"883242710","full_name":"phmatray/MinimalHtmx","owner":"phmatray","description":"A minimal .NET template for creating HTMX-based Blazor projects","archived":false,"fork":false,"pushed_at":"2025-04-17T16:05:24.000Z","size":209,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-01T00:53:15.612Z","etag":null,"topics":["blazor","dotnet","htmx","template"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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":null,"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":"2024-11-04T16:11:41.000Z","updated_at":"2024-12-10T16:26:38.000Z","dependencies_parsed_at":"2025-07-22T09:07:55.826Z","dependency_job_id":null,"html_url":"https://github.com/phmatray/MinimalHtmx","commit_stats":null,"previous_names":["phmatray/minimalhtmx"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phmatray/MinimalHtmx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FMinimalHtmx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FMinimalHtmx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FMinimalHtmx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FMinimalHtmx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phmatray","download_url":"https://codeload.github.com/phmatray/MinimalHtmx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FMinimalHtmx/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270268722,"owners_count":24555643,"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","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","dotnet","htmx","template"],"created_at":"2025-08-13T15:50:30.708Z","updated_at":"2025-08-13T15:50:33.383Z","avatar_url":"https://github.com/phmatray.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MinimalHtmx Template 📦🚀\n\nA minimal .NET template for creating HTMX-based Blazor projects, leveraging Carter for routing and component-based architectures. This template provides a foundation for building interactive, server-driven web applications with Blazor and HTMX.\n\n## Table of Contents 📋\n\n\u003c!-- TOC --\u003e\n* [MinimalHtmx Template 📦🚀](#minimalhtmx-template-)\n  * [Table of Contents 📋](#table-of-contents-)\n  * [Overview 🌐](#overview-)\n  * [Features ✨](#features-)\n  * [Installation ⚙️](#installation-)\n  * [Usage 📑](#usage-)\n    * [Running the Project ▶️](#running-the-project-)\n  * [Project Structure 🏗️](#project-structure-)\n  * [Customization ✏️](#customization-)\n    * [Adding New Routes ➕](#adding-new-routes-)\n    * [Modifying Components 🛠️](#modifying-components-)\n    * [Using AppState 💾](#using-appstate-)\n  * [Contributing 🤝](#contributing-)\n  * [License 📜](#license-)\n  * [About ℹ️](#about-ℹ)\n* [Quick Start Guide 🚀](#quick-start-guide-)\n\u003c!-- TOC --\u003e\n\n## Overview 🌐\n\nThis template includes:\n\n- 2 Blazor components (`PageCounter` and `PageContact`) with HTMX integration for building dynamic, server-side pages.\n- Carter-based routing to handle minimal APIs seamlessly.\n- Pre-configured HTMX components (`HxCounter`, `HxContact` and `HxContactEdit`) to handle server-side rendering and interactivity.\n- A clean, minimal structure that supports server-side HTML updates without JavaScript.\n\n## Features ✨\n\n- **HTMX Integration**: Use HTMX to enable dynamic HTML updates without JavaScript, leveraging server-side interactions.\n- **Carter Routing**: Minimal API routing using Carter makes defining API routes simple and clean.\n- **Blazor Components**: Blazor components are used to encapsulate the UI, supporting easy reuse and testing.\n- **.NET 8 Support**: Built to target .NET 8.0, ensuring compatibility with the latest features and enhancements.\n- **Form Handling**: Use `hx-put` and `hx-get` to enable form binding and server-side state management.\n\n## Installation ⚙️\n\nInstall the template using the `dotnet new` command:\n\n```bash\ndotnet new install Atypical.MinimalHtmx.Templates\n```\n\n## Usage 📑\n\nCreate a new project using the template:\n\n```bash\ndotnet new minimalhtmx -n YourProjectName\n```\n\nThis command creates a new directory named `YourProjectName` with the template contents.\n\n### Running the Project ▶️\n\nOnce the project is created, navigate to the directory and run the application:\n\n```bash\ncd YourProjectName\ndotnet run\n```\n\nThe project will be available at `https://localhost:{PORT}` by default.\n\n## Project Structure 🏗️\n\n- `Pages/Counter/PageCounter.razor`: Main Blazor component to display a counter.\n- `Pages/Counter/PageCounter.razor.cs`: Defines API endpoints using Carter to handle GET and POST requests for counter data.\n- `Pages/Counter/HxCounter.razor`: HTMX-enabled component that displays a counter.\n- `Pages/Contact/PageContact.razor`: Main Blazor component to display a contact.\n- `Pages/Contact/PageContact.razor.cs`: Defines API endpoints using Carter to handle GET and PUT requests for contact data.\n- `Pages/Contact/HxContact.razor`: HTMX-enabled component that displays a contact's details.\n- `Pages/Contact/HxContactEdit.razor`: HTMX-enabled edit form for contacts.\n- `Store/AppState.cs`: Stores the state of the application, including contact details.\n\n## Customization ✏️\n\n### Adding New Routes ➕\n\nTo add new routes, modify the `AddRoutes` method in `PageContact.cs`. You can define new GET, POST, PUT, or DELETE endpoints using Carter's fluent routing API.\n\n```csharp\npublic void AddRoutes(IEndpointRouteBuilder app)\n{\n    var group = app.MapGroup(\"htmx/contact\");\n    group.MapGet(\"/{Id:int}\", HandleGet);\n    group.MapPut(\"/{Id:int}\", HandlePut);\n    group.MapPost(\"/new\", HandleCreateNew);\n}\n```\n\n### Modifying Components 🛠️\n\nComponents are located by feature in the `Pages` folder. You can edit `HxContact.razor` and `HxContactEdit.razor` to change the UI and behavior of the contact display and edit functionality.\n\n### Using AppState 💾\n\n`AppState.cs` is used to store the state of your application, such as contact details. You can extend `AppState` to hold more data as your application grows.\n\n## Contributing 🤝\n\nContributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request to the repository.\n\n## License 📜\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## About ℹ️\n\nDeveloped by Philippe Matray, this template is aimed at developers looking for a minimal yet effective way to combine Blazor with HTMX and Carter, enabling interactive, server-driven web applications without relying on complex JavaScript frameworks.\n\n---\n\n# Quick Start Guide 🚀\n\n1. **Install the Template**\n\n   ```bash\n   dotnet new install Atypical.MinimalHtmx.Templates\n   ```\n\n2. **Create a New Solution**\n\n   ```bash\n   mkdir HtmxDemo\n   cd HtmxDemo\n   dotnet new sln -n MyHtmxSolution\n   ```\n\n3. **Create a New MinimalHtmx Project**\n\n   ```bash\n   dotnet new minimalhtmx -n MyHtmxApp\n   dotnet sln add MyHtmxApp\n   ```\n\n4. **Run the Application** ▶️\n\n   Navigate to the project folder and run it:\n\n   ```bash\n   cd MyHtmxApp\n   dotnet run\n   ```\n\n   You should see the application running at `https://localhost:{PORT}`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphmatray%2Fminimalhtmx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphmatray%2Fminimalhtmx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphmatray%2Fminimalhtmx/lists"}