How nautobot/nautobot-app-design-builder works
Project Type and Purpose
• This is a Nautobot App (a Django‐based plugin) named “Nautobot Design Builder.”
• Purpose: Provide a design-oriented Source of Truth within Nautobot by reading Jinja2-based design templates (from disk or Git), rendering them into Nautobot objects (via Django models/ORM), and managing the full lifecycle (create/update/decommission) through REST/API, UI, and background jobs.
Main Components
A. User & Client Tier
• Browser (Admin/UI users)
• CLI/Invoke tasks for local development & management commands
• REST API clients (curl, scripts)
B. Nautobot Core (Django)
• HTTP server / URL router
• Authentication & permissions
• Plugin loader
C. Design Builder Plugin
1. Web/UI Layer
– Django views & templates (templates/nautobot_design_builder/*.html)
– Templatetags & filters for rendering design pages
2. API Layer
– Django REST Framework serializers, views, URLs under api/
3. Model Layer
– Django models & migrations (models.py + migrations/)
– ChangeRecord, ChangeSet, Deployment models to track lifecycle
4. Job / Task Layer
– Nautobot Jobs (design_job.py)
– Management commands (build_design.py, install_demo_designs.py)
– Background queue (Redis broker)
5. Templating & Rendering
– Jinja2 integration (jinja2.py, jinja_filters.py)
– Loading design templates from local disk or external Git
6. Utilities & Integrations
– Git integration (git.py) for cloning/pulling design repos
– Custom validators, filters, helpers, context builders
D. Persistence & External Services
• SQL Database (PostgreSQL/MySQL) for Nautobot + plugin models
• Redis (cache, broker for async tasks)
• Filesystem (design template directory)
• External Git repositories (design files source)
Relationships & Data Flow
1. UI Request Flow
[Browser] --(HTTPS)--> [Nautobot Core / Plugin Views]
[Plugin Views] --> ORM --> [SQL Database]
[Views] render Jinja2 templates (from disk/Git) into HTML pages
2. REST API Flow
[Client] --(HTTPS/JSON)--> [API Endpoints]
[API Views] --(deserialize/serialize)--> [Models/DB]
3. Design Build Lifecycle
[User triggers build] via UI or CLI --> [Management Command / Job]
[Job Scheduler] enqueues task in Redis --> [Worker]
[Worker] loads templates + input data --> [Jinja2 Engine] --> produces object definitions
[Worker] applies creations/updates/decommissions via ORM --> [DB]
[Worker] records ChangeRecords/ChangeSets in DB
4. Git Integration
[Plugin Git module] <--(Git clone/pull)-- [External Git Repo]
Local template files updated on disk --> used by Jinja2 Engine
Architectural Patterns & Principles
• MVC/MVT (Django) separation: templates, views, models
• Plugin modularization: clear API, UI, job, and model sub-packages
• Asynchronous job queue for long-running design builds
• Template-based code generation (Jinja2)
• External Source of Truth via Git integration