htmx flask
via PatrickJS/awesome-cursorrules
HTMX development with Flask integration best practices and patterns.
What is htmx flask?
This rule provides guidance for building interactive web applications using HTMX with Flask. It covers server-side rendering, form handling, database operations, and project structure to streamline HTMX-Flask development workflows.
- Use Flask's render_template for server-side rendering with HTMX attributes
- Implement Flask-WTF for secure form handling and CSRF protection
- Utilize Flask's url_for for dynamic URL generation in templates
- Use Flask-SQLAlchemy for database operations and Flask-Migrate for migrations
- Organize code with Flask Blueprints for modular, scalable applications
- Apply Jinja2 templating with HTMX attributes and proper error handling
Applies to
File patterns this rule matches.
Rule definition (reference)
Source of truth, from the repository.
// HTMX with Flask .cursorrules
// HTMX and Flask best practices
const htmxFlaskBestPractices = [ "Use Flask's render_template for server-side rendering", "Implement Flask-WTF for form handling", "Utilize Flask's url_for for generating URLs", "Use Flask's jsonify for JSON responses", "Implement Flask-SQLAlchemy for database operations", "Utilize Flask's Blueprint for modular applications", ];
// Folder structure
const folderStructure = app/ templates/ static/ css/ js/ models/ routes/ __init__.py config.py run.py;
// Additional instructions
const additionalInstructions = `
- Use Jinja2 templating with HTMX attributes
- Implement proper CSRF protection with Flask-WTF
- Utilize Flask's request object for handling HTMX requests
- Use Flask-Migrate for database migrations
- Implement proper error handling and logging
- Follow Flask's application factory pattern
- Use environment variables for configuration `;
Related rules
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.
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.
