Skip to main content

dbbasic-forms: Git-Native Form Builder

PyPI version Python 3.8+ License: MIT

A simple, git-friendly form builder that stores everything in TSV files. Build forms, collect responses, export to CSV—all without a database.

Why This Exists

Form builders shouldn't cost $29/month. Your data shouldn't be locked in a SaaS platform. Forms are just tables, and tables are just TSV files.

Features

  • Visual Form Builder: Drag-drop interface for creating forms
  • TSV Storage: All data in human-readable text files
  • Git-Friendly: Version control your forms and responses
  • Admin Interface: Auto-discovered by dbbasic-admin
  • CSV Export: One-click export to spreadsheet
  • Zero Setup: No database, no configuration, just works

Installation

pip install dbbasic-forms

Requires Python 3.8+ and dbbasic-tsv.

Quick Start

Create a Form

from dbbasic_forms import FormBuilder

builder = FormBuilder()

contact_form = builder.create_form(
    form_id="contact",
    name="Contact Form",
    description="Get in touch with us",
    fields=[
        {
            "name": "name",
            "type": "text",
            "label": "Name",
            "required": True
        },
        {
            "name": "email",
            "type": "email",
            "label": "Email",
            "required": True
        },
        {
            "name": "message",
            "type": "textarea",
            "label": "Message"
        }
    ]
)

Submit Responses

# From your web handler
form = builder.get_form("contact")
response_id = form.submit_response({
    "name": "Alice Johnson",
    "email": "alice@example.com",
    "message": "Love your product!"
})

View Responses

# Get all responses
responses = form.get_responses(limit=10)

for response in responses:
    print(f"{response['submitted_at']}: {response['email']}")

# Export to CSV
csv_data = form.export_responses_csv()
with open("responses.csv", "w") as f:
    f.write(csv_data)

Data Format

Your forms and responses are stored in TSV files:

$ cat data/forms.tsv
id      name            description             fields                  created_at
contact Contact Form    Get in touch with us    [{"name":"email"...}]  2024-01-15T10:30:00

$ cat data/responses_contact.tsv
id                  submitted_at            name            email               message
resp_20240115...    2024-01-15T14:22:00    Alice Johnson   alice@example.com   Love your product!

This means you can:

  • Debug with tail -f data/responses_contact.tsv
  • Search with grep alice data/responses_contact.tsv
  • Edit in Excel, Google Sheets, or vim
  • Track changes in Git with meaningful diffs

Field Types

  • text - Single-line text input
  • email - Email with validation
  • textarea - Multi-line text
  • number - Numeric input
  • date - Date picker
  • select - Dropdown menu
  • radio - Radio buttons (single choice)
  • checkbox - Checkboxes (multiple choice)
  • file - File upload (coming soon)

Admin Interface

dbbasic-forms integrates with dbbasic-admin for visual management.

The admin interface includes:

  • Form builder with drag-drop fields
  • Response viewer with filtering
  • CSV export
  • Form analytics

Install dbbasic-admin:

pip install dbbasic-admin

The forms interface is auto-discovered at /admin/forms.

Web Framework Integration

Flask Example

from flask import Flask, request, jsonify
from dbbasic_forms import FormBuilder

app = Flask(__name__)
builder = FormBuilder()

@app.route('/api/forms/<form_id>/submit', methods=['POST'])
def submit_form(form_id):
    form = builder.get_form(form_id)
    if not form:
        return jsonify({"error": "Form not found"}), 404

    response_id = form.submit_response(request.json)
    return jsonify({
        "success": True,
        "response_id": response_id,
        "message": form.settings["success_message"]
    })

FastAPI Example

from fastapi import FastAPI, HTTPException
from dbbasic_forms import FormBuilder

app = FastAPI()
builder = FormBuilder()

@app.post("/api/forms/{form_id}/submit")
async def submit_form(form_id: str, data: dict):
    form = builder.get_form(form_id)
    if not form:
        raise HTTPException(status_code=404, detail="Form not found")

    response_id = form.submit_response(data)
    return {
        "success": True,
        "response_id": response_id,
        "message": form.settings["success_message"]
    }

API Reference

FormBuilder

builder = FormBuilder(data_dir="data")

Methods:

  • create_form(form_id, name, description, fields, settings) → Form
  • get_form(form_id) → Form | None
  • list_forms() → List[Dict]
  • delete_form(form_id) → bool

Form

form = builder.get_form("contact")

Methods:

  • submit_response(response_data) → str (response_id)
  • get_responses(limit, offset) → List[Dict]
  • count_responses() → int
  • get_response(response_id) → Dict | None
  • delete_response(response_id) → bool
  • update_form(name, description, fields, settings) → bool
  • export_responses_csv() → str
  • to_dict() → Dict

When to Use This

✅ Perfect for:

  • Contact forms on static sites
  • Feedback forms
  • Event registrations
  • Surveys and polls
  • Internal tools (HR forms, IT requests)
  • Prototypes and MVPs

❌ Not suitable for:

  • High-volume transactional forms (>1K submissions/day)
  • Payment forms (use Stripe Checkout)
  • Multi-tenant SaaS applications
  • Real-time collaboration

Rule of thumb: If your form responses can safely live in Git (because they're content, not transactions), use dbbasic-forms.

Deployment

Development

pip install dbbasic-forms
# Data is stored in ./data directory
# Commit to git: git add data/ && git commit -m "Add form data"

Production (Git-Based)

git clone https://github.com/yourorg/yourapp.git
cd yourapp
pip install -r requirements.txt

# Data is in the repo
# New responses append to TSV files
# Push updates: git add data/ && git commit && git push

Performance

  • Form Creation: <1ms
  • Response Submission: <5ms
  • Query 10K Responses: ~100ms
  • CSV Export (10K rows): ~200ms

Limits:

  • Responses per form: 100K recommended, 1M maximum
  • Fields per form: 50 recommended

Comparison

Feature dbbasic-forms Google Forms Typeform
Cost Free Free/Limited $25+/mo
Data Ownership ✅ ❌ ❌
Git-Friendly ✅ ❌ ❌
Self-Hosted ✅ ❌ ❌
Visual Builder ✅ ✅ ✅
File Uploads 🚧 ✅ ✅

Documentation

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE for details.

Credits

Created by the AskRobots team as part of the dbbasic ecosystem.

Inspired by the philosophy that forms shouldn't require infrastructure.


Remember: The best form builder is the one you control.

Release files for dbbasic-forms 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbbasic-forms 1.0.1
File Size Uploaded
dbbasic_forms-1.0.1.tar.gz 24.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dbbasic-forms 1.0.1
File Interpreter ABI Platform
dbbasic_forms-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 45.2 kB

Release files / dbbasic_forms-1.0.1.tar.gz

Download URL dbbasic_forms-1.0.1.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a26ef927ad6109e7253046ca3811c105186784725282128541c440b5696f8433
BLAKE2b-256 checksum
How to use checksums
e9a3eef8c8e656e75fa9ccca684034276cfdebf2cae439e73f2bf58ef854a4e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.1

Release files / dbbasic_forms-1.0.1-py3-none-any.whl

Download URL dbbasic_forms-1.0.1-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bf83cfe24599b12cd9a763a9824f0cf559defecdbf1d89e57b1edd8e2a9563e
BLAKE2b-256 checksum
How to use checksums
57238edcae7fca746710ec87324b2cb9532da73fe9c256513724e403525b6b10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.1

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page