htmx go basic
via PatrickJS/awesome-cursorrules
Go development with HTMX for server-side rendered interactive web applications.
What is htmx go basic?
This rule provides best practices and setup guidance for building web applications with Go and HTMX. Use it when creating server-side rendered applications that need interactive UI updates without full page reloads.
- Use html/template for server-side rendering with HTMX attributes
- Implement http.HandlerFunc and gorilla/mux for request routing and HTMX handling
- Structure projects with cmd/, internal/, and static/ directories for maintainability
- Apply semantic HTML5 with HTMX attributes like hx-boost for navigation
- Implement CSRF protection and proper error handling with Go idioms
- Use context for request cancellation and timeouts in handlers
Applies to
File patterns this rule matches.
Rule definition (reference)
Source of truth, from the repository.
// HTMX with Go (Basic Setup) .cursorrules
// HTMX and Go best practices
const htmxGoBestPractices = [ "Use html/template for server-side rendering", "Implement http.HandlerFunc for handling HTMX requests", "Utilize gorilla/mux for routing if needed", "Use encoding/json for JSON responses", "Implement proper error handling and logging", "Utilize context for request cancellation and timeouts", ];
// Folder structure
const folderStructure = cmd/ main.go internal/ handlers/ models/ templates/ static/ css/ js/ go.mod go.sum;
// Additional instructions
const additionalInstructions = `
- Use semantic HTML5 elements with HTMX attributes
- Implement proper CSRF protection
- Utilize HTMX extensions when needed
- Use hx-boost for full page navigation
- Follow Go's idiomatic error handling
- Implement graceful shutdown for the server
- Use Go modules for dependency management `;
Related rules
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.
Expert guidance for building fast, scalable web apps with Astro, JavaScript, and Tailwind CSS.
Expert guidance for Chrome extension development with JavaScript and Chrome APIs.
Senior developer guidelines for clean, maintainable JavaScript and TypeScript code.
