Skip to main content

Headless Wagtail Advanced Form Builder - Complete REST API for modern frontend frameworks

Project description

Headless Wagtail Advanced Form Builder

Form fields API Form fields CMS

A powerful headless-first Wagtail Advanced Form Builder with complete REST API for modern frontend frameworks like React, Vue, Angular, and mobile applications.

๐Ÿšจ Important: This is a separate package from the original wagtail-advanced-form-builder. Choose headless-wagtail-advanced-form-builder for modern headless/API-first applications, or the original for traditional Wagtail template only usage.

๐Ÿš€ Headless API Features

Complete REST API with Django Ninja - Build modern frontend applications with React, Vue, Angular, or any JavaScript framework using our comprehensive headless API.

API Capabilities

  • ๐Ÿ“‹ Form Retrieval API - Get form schemas with complete field definitions and validation rules
  • ๐Ÿ“ค Form Submission API - Submit forms with automatic validation and processing
  • ๐Ÿ”’ Security Built-in - CSRF protection, reCAPTCHA v2/v3 integration, and rate limiting
  • ๐Ÿ“ง Email Integration - Automatic email sending with Celery background processing
  • ๐Ÿ“– Auto-Generated Documentation - Interactive API docs at /docs endpoint
  • ๐ŸŽฏ Type-Safe Schemas - Complete Pydantic schemas for all form fields and responses

Quick API Example

// Get form schema
const response = await fetch('/api/form_by_path/contact-form/');
const formSchema = await response.json();

// Submit form data
await fetch('/api/form_by_path/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-CSRFToken': csrfToken
  },
  body: JSON.stringify({
    path: 'contact-form',
    form_fields: { name: 'John', email: 'john@example.com' },
    recaptcha_token: recaptchaToken // optional
  })
});

Versions

This package currently only supports Wagtail 6.4 above.

Version 1.0.0

Brand new headless API capabilities for use with Wagtail version 6.4.X

  • ๐ŸŽฏ Complete Headless API with Django Ninja for modern frontend frameworks
  • ๐Ÿ“ Full Schema Models for all form fields and pages with Pydantic validation
  • ๐Ÿ”Œ RESTful APIs for form retrieval, submission, and validation
  • ๐Ÿ”’ Security Features including optional django-recaptcha and CSRF protection
  • โšก Background Processing with Celery for email sending and heavy tasks
  • ๐Ÿ“– Auto-Generated API Documentation with interactive OpenAPI interface
  • ๐ŸŽ›๏ธ Enhanced Conditional Logic with improved rule engine

About

Headless WAF Builder is a comprehensive headless-first extension that enhances Wagtail's built-in Form Builder with:

  • ๐ŸŽ›๏ธ Advanced Conditional Logic - Show/hide fields based on user input with complex rule sets
  • ๐ŸŒ Headless API Support - Complete REST API for frontend frameworks and mobile apps
  • ๐Ÿ“ฑ Modern Field Types - Extended field library including phone, date, and custom validation
  • ๐Ÿ”ง Developer-Friendly - Easy integration, comprehensive documentation, and extensible architecture

๐Ÿค” Why Choose Headless WAF Builder?

Feature Headless WAF Builder Original wagtail-advanced-form-builder
๐ŸŒ REST API โœ… Complete Django Ninja API โŒ No API
๐Ÿ“ฑ Frontend Frameworks โœ… React, Vue, Angular, Mobile โŒ Wagtail templates only
๐Ÿ”’ Modern Security โœ… CSRF, reCAPTCHA, Rate limiting โš ๏ธ Basic
๐Ÿ“– API Documentation โœ… Auto-generated OpenAPI docs โŒ No API docs
โšก Background Processing โœ… Celery integration โŒ Synchronous only
๐ŸŽฏ Type Safety โœ… Pydantic schemas โŒ No schemas
๐Ÿ“Š Headless CMS Ready โœ… Built for decoupled architecture โŒ Traditional Wagtail CMS + Django Templates

Choose headless-waf-builder if you're building:

  • ๐Ÿš€ Modern SPA applications (React, Vue, Angular)
  • ๐Ÿ“ฑ Mobile apps that need form APIs
  • ๐ŸŒ Headless/decoupled Wagtail sites
  • ๐Ÿ”— Multi-channel content delivery
  • ๐ŸŽฏ API-first applications

๐Ÿ› ๏ธ Installation & Setup

Basic Installation

Production Installation

pip install headless-waf-builder

Add to your INSTALLED_APPS:

INSTALLED_APPS = [
    # ... other apps
    'headless_waf_builder',
    # ... 
]

โœจ Modern Architecture: The new headless_waf_builder package follows modern Python packaging standards with src/ layout and pyproject.toml configuration.

Headless API Setup

# urls.py
from headless_waf_builder.api.router import headless_waf_builder_api

urlpatterns = [
    # ... your existing URLs
    path("api/", headless_waf_builder_api.urls),
]

Run migrations:

./manage.py migrate

๐ŸŽ‰ After the migration succeed! Your API will be available at /api/ with documentation at /api/docs


๐Ÿ“‹ Comprehensive Field Support

Core Field Types

  • ๐Ÿ“ Text Fields - Single line, multi-line with validation
  • ๐Ÿ“ง Email Field - Built-in email validation
  • ๐Ÿ”ข Number Field - Numeric input with min/max validation
  • ๐Ÿ“ž Phone Field - International phone number support
  • ๐Ÿ“… Simple Date Field - Date picker with age validation
  • ๐Ÿ”— URL Field - URL validation and formatting
  • ๐Ÿ™ˆ Hidden Field - For tracking and default values

Advanced Input Types

  • ๐Ÿ“‹ Dropdown/Select - Single and multi-select options
  • โœ… Checkbox Fields - Single checkbox and checkbox groups
  • ๐Ÿ”˜ Radio Buttons - Single choice with custom layouts
  • ๐ŸŽจ HTML Field - Rich content and custom markup
  • ๐Ÿ“ฑ Responsive Layouts - Side-by-side and mobile-optimized displays

๐ŸŽฏ Conditional Logic Engine

Create dynamic forms with sophisticated show/hide rules:

  • Comparison Operators: equals, not equals, greater than, less than, contains
  • String Matching: starts with, ends with, is blank, is not blank
  • Multiple Conditions: Combine rules with AND/OR logic
  • Cross-Field Dependencies: Field visibility based on other field values
  • Real-time Updates: Instant field visibility changes as users interact

๐ŸŒ Headless API Reference

Endpoints

GET /api/form_by_path/{path}

Retrieve form schema and configuration

{
  "id": 1,
  "title": "Contact Form",
  "fields": [
    {
      "id": 1,
      "type": "singleline", 
      "name": "full_name",
      "label": "Full Name",
      "required": true,
      "rules": {
        "action": "show",
        "conditions": [...]
      }
    }
  ],
  "use_google_recaptcha": true,
  "google_recaptcha_public_key": "..."
}

POST /api/form_by_path/

Submit form data with validation

{
  "path": "contact-form",
  "form_fields": {
    "full_name": "John Doe",
    "email": "john@example.com"
  },
  "recaptcha_token": "..."
}

GET /api/csrf/

Get CSRF token for secure submissions

{
  "csrftoken": "abc123..."
}

๐Ÿ“š Documentation

The complete documentation is available at here


๐Ÿ†˜ Getting Help

๐Ÿ‘ฅ Authors

  • Richard Blake, Dan Brosnan & Vincent Tran (Octave)

๐Ÿ“„ License

This project is licensed under the BSD License - see the LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

headless_waf_builder-0.0.1b1.tar.gz (222.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

headless_waf_builder-0.0.1b1-py3-none-any.whl (56.3 kB view details)

Uploaded Python 3

File details

Details for the file headless_waf_builder-0.0.1b1.tar.gz.

File metadata

  • Download URL: headless_waf_builder-0.0.1b1.tar.gz
  • Upload date:
  • Size: 222.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for headless_waf_builder-0.0.1b1.tar.gz
Algorithm Hash digest
SHA256 99a631ce5dad4e4f1b5b4561d8589179a044d79c8ca233809132a3e7a50f17a5
MD5 0bf590996272ccaa3293d844b486a410
BLAKE2b-256 72f5ed0f7f42a47078a479c40cbade01aa82dd9d0c163c9945beb7cb0b6d4f98

See more details on using hashes here.

Provenance

The following attestation bundles were made for headless_waf_builder-0.0.1b1.tar.gz:

Publisher: publish-to-pypi.yml on octavenz/headless-wagtail-advanced-form-builder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file headless_waf_builder-0.0.1b1-py3-none-any.whl.

File metadata

File hashes

Hashes for headless_waf_builder-0.0.1b1-py3-none-any.whl
Algorithm Hash digest
SHA256 747c77e30e32c91bdb8420ea8394711f74b4f4d20d053dc5acc64ae3be3b6ac6
MD5 3d8b6f3ec5b62f5cb0c6fb148d9fbbaa
BLAKE2b-256 6aeb3a7434894771c5abeb05c053e39c71292033fc160d696bf9de4af91e9905

See more details on using hashes here.

Provenance

The following attestation bundles were made for headless_waf_builder-0.0.1b1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on octavenz/headless-wagtail-advanced-form-builder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page