htmx flask
via PatrickJS/awesome-cursorrules
HTMX and Flask integration patterns for dynamic server-rendered web applications.
What is htmx flask?
This rule provides best practices for building interactive web applications using HTMX with Flask. Use it when developing dynamic, server-rendered UIs that leverage HTMX attributes for seamless partial page updates without full page reloads.
- Server-side rendering with Flask's render_template and Jinja2 templating
- Form handling with Flask-WTF including CSRF protection
- URL generation with Flask's url_for for HTMX requests
- JSON responses via Flask's jsonify for AJAX endpoints
- Database operations with Flask-SQLAlchemy and Flask-Migrate
- Modular application structure using Flask Blueprints
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
Senior full-stack TypeScript, React, Node.js guidance with clean architecture, testing, and WHY-oriented reasoning.
Quantitative factor research skills for designing, evaluating, and mining alpha factors in equities markets.
Android development with Jetpack Compose, clean architecture, and Material Design 3.
Angular development with Novo Elements UI library using standalone components.
Expert Angular 18 + TypeScript development with Jest, emphasizing clean code and performance.
Manage Kubernetes clusters, add-ons, stacks, and credentials via the Ankra CLI platform.