htmx basic
via PatrickJS/awesome-cursorrules
HTMX development setup with best practices and folder structure guidance.
What is htmx basic?
This rule provides foundational HTMX development practices, including HTTP verb usage, content swapping strategies, and recommended project structure. Use it when building interactive web applications with HTMX attributes and server-side templating.
- Guides HTTP verb selection (hx-get, hx-post) and request handling
- Explains content swapping with hx-swap and hx-target for dynamic updates
- Recommends folder structure separating templates, static assets, and application code
- Covers loading indicators, custom event triggers, and HTMX extensions
- Emphasizes semantic HTML5, CSRF protection, and progressive enhancement
- Suggests server-side templating integration (Jinja2, Handlebars)
Applies to
File patterns this rule matches.
Rule definition (reference)
Source of truth, from the repository.
// HTMX Basic Setup .cursorrules
// HTMX best practices
const htmxBestPractices = [ "Use hx-get for GET requests", "Implement hx-post for POST requests", "Utilize hx-trigger for custom events", "Use hx-swap to control how content is swapped", "Implement hx-target to specify where to swap content", "Utilize hx-indicator for loading indicators", ];
// Folder structure
const folderStructure = src/ templates/ static/ css/ js/ app.py;
// Additional instructions
const additionalInstructions = `
- Use semantic HTML5 elements
- Implement proper CSRF protection
- Utilize HTMX extensions when needed
- Use hx-boost for full page navigation
- Implement proper error handling
- Follow progressive enhancement principles
- Use server-side templating (e.g., Jinja2, Handlebars) `;
Related rules
HTMX development with Django integration best practices and patterns.
HTMX development with Flask integration best practices and patterns.
Go development with HTMX for server-side rendered interactive web applications.
Go Fiber best practices for building HTMX-driven web applications.
Senior Java developer persona with Effective Java principles, SOLID, and functional programming best practices.
Java Spring Boot 3 with JPA/Hibernate development guide following SOLID principles and OWASP best practices.
