Chapter 11 - Feature Flag Transformation

Current Implementation

USE_CLEAN_ARCHITECTURE = {{ use_clean_arch|title }}

{% if use_clean_arch %}

✅ Using Clean Architecture implementation with proper domain entities, use cases, and repositories.

{% else %}

⚠️ Using Legacy implementation with tangled dependencies and architectural violations.

{% endif %}
Create Order ({{ 'Clean Architecture' if use_clean_arch else 'Legacy' }} Implementation)
Available Products
{% for product in products %}
{{ product.name }}
${{ product.price }} | Stock: {{ product.stock }}
{% endfor %}
How to Toggle Feature Flag

Stop the server (Ctrl+C) and restart with:

# Legacy: python main.py
# Clean:  USE_CLEAN_ARCHITECTURE=true python main.py
Recent Orders
Auto-refreshes after order creation
{% if orders %} {% for order in orders %}
{{ order.id[:8] }}...
Customer: {{ order.customer_id[:8] }}...
{{ order.item_count }} item(s) • ${{ order.total_price }}
{{ order.status }}
{{ order.created_at }}
{% endfor %} {% else %}

No orders yet. Create your first order!

{% endif %}