# Admin Frontend - Alpine.js/Jinja2 Page Template Guide ## 📋 Overview This guide provides complete templates for creating new admin pages using the established Alpine.js + Jinja2 architecture. Follow these patterns to ensure consistency, proper initialization, and optimal performance across the admin portal. --- ## 🎯 Quick Reference ### File Structure for New Page ``` app/ ├── templates/admin/ │ └── [page-name].html # Jinja2 template ├── static/admin/js/ │ └── [page-name].js # Alpine.js component └── api/v1/admin/ └── pages.py # Route registration ``` ### Checklist for New Page - [ ] Create Jinja2 template extending admin/base.html - [ ] Create Alpine.js JavaScript component - [ ] Use centralized logger (one line!) - [ ] Add ...data() for base inheritance - [ ] Set currentPage identifier - [ ] Add initialization guard - [ ] Use lowercase apiClient - [ ] Register route in pages.py - [ ] Add sidebar navigation link - [ ] Test authentication - [ ] Test dark mode - [ ] Verify no duplicate initialization --- ## 📄 Template Structure ### 1. Jinja2 Template **File:** `app/templates/admin/[page-name].html` ```jinja2 {# app/templates/admin/[page-name].html #} {% extends "admin/base.html" %} {# Page title for browser tab #} {% block title %}[Page Name]{% endblock %} {# ✅ CRITICAL: Alpine.js component name #} {% block alpine_data %}admin[PageName](){% endblock %} {# Page content #} {% block content %}
Loading data...
Error
| Name | Status | Date | Actions |
|---|---|---|---|
|
No items found. |
|||
|
|
|
||
Total Jobs
0
| Job ID | Store | Status | Progress | Created By | Actions |
|---|---|---|---|---|---|
| # |
Error
You haven't triggered any imports yet
Start a new import using the form above
Loading import jobs...