How alejandrotejero/webbuilder-tfg works
Purpose and entry points
WebBuilder is a Django 5.1 platform that turns a public JSON/XML/CSV API into a generated, deployable Django website. HTTP routing begins in project/urls.py and app routes in WebBuilder/urls.py; deployment entry points are manage.py, project/wsgi.py, and project/asgi.py.
Core Django application
The WebBuilder app owns user-facing workflows, persistence, and server-rendered UI. Domain records likely cover API analyses, generated sites, versions, logs, users, and profiles, as reflected in WebBuilder/models.py and the cumulative migrations under WebBuilder/migrations/. Views are divided by workflow: assistant, editing, site rendering, history, metrics, authentication, and internal endpoints in WebBuilder/views/.
Assisted API-to-plan pipeline
The generation assistant accepts an API URL, fetches and safely parses source data, then produces an editable structured plan. Ingestion supports URL reading and JSON/XML/CSV parsing through WebBuilder/utils/ingest/url_reader.py and WebBuilder/utils/ingest/parsers.py. Dataset analysis—including detection, field-role inference, and plan construction—is separated under WebBuilder/utils/analysis/builder.py, WebBuilder/utils/analysis/detection.py, and WebBuilder/utils/analysis/field_roles.py.
LLM abstraction and planning
LLM calls are centralized behind an OpenAI-compatible client, allowing providers such as Groq, OpenRouter, or OpenAI. Planning, prompt enrichment, field extraction, design presets, and output consistency checking are distinct stages in WebBuilder/utils/llm/client.py, WebBuilder/utils/llm/planner.py, and WebBuilder/utils/llm/consistency_checker.py. User-specific API keys are an important security boundary, with encrypted-field support described by configuration and persistence.
Project generation and versioning
After plan approval, the generator creates a standalone Django project: code, templates, static assets, migrations, data-loading support, and packaging/deployment artifacts. The main orchestration and generated-project assembly live in WebBuilder/utils/generator/project_generator.py, with migration/static-file generation in WebBuilder/utils/generator/migrations_generator.py and WebBuilder/utils/generator/static_files.py. Generated-site versions enable review, editing, restoration, download, and AI-assisted file refinement through WebBuilder/views/edit.py and WebBuilder/views/site.py.
Web interface and operational views
The product is server-rendered Django HTML with page-specific JavaScript/CSS, not a separate SPA. The guided assistant is rooted at WebBuilder/templates/WebBuilder/assistant.html, with staged partials under WebBuilder/templates/WebBuilder/partials/assistant/; browser orchestration is in WebBuilder/static/js/assistant.js. History, code editor, public site preview, and metrics have dedicated views/templates under WebBuilder/views/ and WebBuilder/templates/WebBuilder/.
Runtime, deployment, and integrations
Production infrastructure is Docker Compose with Django/Gunicorn, PostgreSQL, Nginx, and n8n. Definitions reside in deploy/docker-compose.yml, deploy/Dockerfile, and deploy/nginx/nginx.conf. Django invokes n8n webhooks for generated-site deployment, notifications, health checks, and automatic shutdown; n8n has Docker-host access to build and run generated projects. Authentication uses django-allauth with optional Google/GitHub OAuth; localization is maintained under locale/.
Main entry points: project_generator.py Project generator · planner.py LLM planner · urls.py Django entry points · edit.py Generated site versions
Components 18
Django WebBuilder
Server-rendered product workflows and persistence.
- Django entry points · HTTP routing and WSGI/ASGI deployment entry points.
project/urls.py - WebBuilder routes
WebBuilder/urls.py - Workflow views · Assistant, editing, preview, history, metrics, auth, and internal endpoints.
- Domain records · Stores analyses, sites, versions, logs, users, profiles, and encrypted key material.
WebBuilder/models.py - Assistant UI · Guided plan-creation interface with staged partials.
WebBuilder/templates/WebBuilder/assistant.html - Assistant browser flow
WebBuilder/static/js/assistant.js
API-to-Plan Pipeline
Ingests public data and produces editable plans.
- URL ingestion · Fetches API sources and safely parses JSON, XML, or CSV.
WebBuilder/utils/ingest/url_reader.py - Dataset analysis · Detects datasets, infers field roles, and constructs plans.
WebBuilder/utils/analysis/builder.py
LLM Planning
Provider-neutral AI planning and validation.
- OpenAI-compatible client · Central provider abstraction for Groq, OpenRouter, and OpenAI.
WebBuilder/utils/llm/client.py - LLM planner · Enriches prompts, extracts fields, and applies design presets.
WebBuilder/utils/llm/planner.py - Plan consistency check
WebBuilder/utils/llm/consistency_checker.py
Site Generation
Builds and versions standalone Django sites.
- Project generator · Assembles a standalone Django project and deployment package.
WebBuilder/utils/generator/project_generator.py - Generated migrations
WebBuilder/utils/generator/migrations_generator.py - Generated static assets
WebBuilder/utils/generator/static_files.py - Generated site versions · Supports review, editing, restoration, download, and AI refinement.
WebBuilder/views/edit.py
Deployment & Integrations
Production stack and deployment automation.
- Production Compose stack · Runs Django/Gunicorn, PostgreSQL, Nginx, and n8n.
deploy/docker-compose.yml - Nginx proxy
deploy/nginx/nginx.conf - n8n automation · Deploys generated sites and handles notifications, health checks, and shutdown.
Connections 20
- Django entry points → WebBuilder routes: dispatches
- WebBuilder routes → Workflow views: routes requests
- Workflow views → Domain records: reads and writes
- Assistant UI → Assistant browser flow: drives
- Assistant browser flow → Workflow views: assistant requests
- Workflow views → URL ingestion: submits API URL
- URL ingestion → Dataset analysis: parsed dataset
- Dataset analysis → LLM planner: analysis and draft plan
- LLM planner → OpenAI-compatible client: provider calls
- LLM planner → Plan consistency check: validates output
- Plan consistency check → Workflow views: editable plan
- Workflow views → Project generator: approved plan
- Project generator → Generated migrations: generates schema
- Project generator → Generated static assets: generates assets
- Project generator → Generated site versions: creates version
- Generated site versions → Domain records: version metadata
- Production Compose stack → Django entry points: runs application
- Nginx proxy → Django entry points: proxies HTTP
- Workflow views → n8n automation: deployment webhooks
- n8n automation → Generated site versions: builds and runs sites