← Back to all products
$19
Form Template Library
21 ready-to-use form templates from contact forms to checkout flows in pure Python.
PythonMarkdownJSON
Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
Interactive Reader (Free Preview) ⚙ Try Demo Tools Download Free SampleFile Structure 15 files
form-template-library/
├── LICENSE
├── README.md
├── examples/
│ └── template_usage.json
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_cli-reference.md
│ ├── 03_programmatic-usage.md
│ └── 04_file-structure.md
├── index.html
├── interactive.html
├── src/
│ ├── __pycache__/
│ │ └── form_template_library.cpython-312.pyc
│ └── form_template_library.py
└── tests/
├── __pycache__/
│ └── test_form_template_library.cpython-312-pytest-9.0.2.pyc
└── test_form_template_library.py
Documentation Preview README excerpt
Form Template Library
21 ready-to-use form templates — from contact forms to checkout flows. Render to HTML or export as JSON. Pure Python, zero dependencies.
Part of the [Form Forge](https://form-forge.codevault.dev) toolkit by CodeVault.
Features
- 21 built-in templates: contact, registration, login, checkout, feedback, newsletter, support ticket, job application, event registration, survey, password reset, profile edit, booking, referral, quote request, bug report, waitlist, donation, shipping address, invite, settings
- HTML rendering: generate complete, styled HTML forms ready to embed
- JSON export: export template definitions for integration with other tools
- Batch export: export all templates to a directory at once
- Customizable: templates are data structures you can modify before rendering
- Python 3.10+ stdlib only — no pip installs required
Quick Start
# List all available templates
python src/form_template_library.py --list
# Render a template to HTML
python src/form_template_library.py --render contact
# Export a template as JSON
python src/form_template_library.py --json registration
# Render to file
python src/form_template_library.py --render checkout --output checkout.html
# Export all templates to a directory
python src/form_template_library.py --export-all ./exported_templates/
CLI Reference
| Flag | Description |
|---|---|
--list | List all available template names |
--render TEMPLATE | Render a template to HTML |
--json TEMPLATE | Export a template definition as JSON |
--export-all DIR | Export all templates as JSON to a directory |
--output FILE | Write output to a file instead of stdout |
Available Templates
| Template | Description | Fields |
|---|---|---|
contact | Basic contact form | name, email, subject, message |
registration | User sign-up | username, email, password, confirm_password |
login | Sign-in form | email, password, remember_me |
checkout | Payment/order form | name, email, card_number, expiry, cvv, address |
feedback | Product/service feedback | name, email, rating, category, comments |
newsletter | Email subscription | email, first_name, interests |
support_ticket | Customer support | name, email, priority, category, description |
job_application | Employment application | name, email, phone, position, resume, cover_letter |
event_registration | Event sign-up | name, email, event, ticket_type, dietary |
survey_basic | Simple survey form | name, satisfaction, recommend, comments |
password_reset | Password recovery | |
profile_edit | Profile settings | display_name, email, bio, avatar, website |
... continues with setup instructions, usage examples, and more.
Code Sample .py preview
src/form_template_library.py
#!/usr/bin/env python3
"""
Form Template Library — 20+ Ready-to-Use Form Templates
=========================================================
A collection of production-ready form templates covering the most
common use cases: contact, registration, checkout, feedback,
application, survey, and more. Each template includes field
definitions, validation rules, and sample HTML output.
Part of the Form Forge toolkit by DataNest.
License: MIT
"""
from __future__ import annotations
import argparse
import html
import json
import logging
import os
import sys
from dataclasses import dataclass, field
from typing import Any
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
logger = logging.getLogger(__name__)
# ---------------------------------------------------------------------------
# Template registry
# ---------------------------------------------------------------------------
TEMPLATES: dict[str, dict[str, Any]] = {
"contact": {
"name": "Contact Form",
"description": "Simple contact form with name, email, subject, and message.",
"fields": [
{"name": "name", "type": "text", "label": "Full Name", "required": True, "autocomplete": "name"},
{"name": "email", "type": "email", "label": "Email Address", "required": True, "autocomplete": "email"},
{"name": "subject", "type": "text", "label": "Subject", "maxLength": 120},
{"name": "message", "type": "textarea", "label": "Message", "required": True, "minLength": 10, "maxLength": 2000},
],
},
"registration": {
"name": "User Registration",
"description": "Account signup with username, email, password, and terms acceptance.",
"fields": [
{"name": "username", "type": "text", "label": "Username", "required": True, "minLength": 3, "maxLength": 30, "pattern": "^[a-zA-Z0-9_-]+$"},
{"name": "email", "type": "email", "label": "Email", "required": True, "autocomplete": "email"},
{"name": "password", "type": "password", "label": "Password", "required": True, "minLength": 8},
{"name": "confirm_password", "type": "password", "label": "Confirm Password", "required": True},
{"name": "terms", "type": "checkbox", "label": "I agree to the Terms of Service", "required": True},
# ... 438 more lines ...