Skip to main content

Project Structure

The full code patterns, with complete examples, live in the enferno-dev skill. This page covers the essentials.

Blueprints

Each feature is a blueprint registered in register_blueprints() in enferno/app.py. Protect a whole blueprint in before_request:
Admin blueprints add @roles_required("admin") under @auth_required("session").

Models and Migrations

Models use BaseMixin and implement to_dict() and from_dict():
After changing a model, draft a migration, read it, then apply it:
The test suite fails if a model and the migrations disagree.

Queries

SQLAlchemy 2.x style, through Flask-SQLAlchemy:

Admin APIs

Lists return {"items": [...], "total": n, "perPage": n}. Create and update take {"item": {...}}. Record admin changes in the activity log:

Pages

Pages extend layout.html, mount their own Vue app with layoutMixin, and use ${ } for Vue expressions, since {{ }} is Jinja. The frontend is Vue 3 and Vuetify 4 with no build step:
  • Icons are Tabler only (ti-*); mdi-* icons render blank.
  • Use Material Design 3 type classes such as text-headline-small and text-body-medium. Vuetify 3 names like text-h5 and text-caption no longer exist.
  • Icon-only buttons need an aria-label.
  • Pass server data with <script type="application/json">{{ data|tojson|safe }}</script>.

Background Tasks (Optional)

enferno.tasks.celery is None when Celery is not installed or configured.

Checks

The suite checks that every protected route rejects anonymous users and non-admins, that models match migrations, CSRF, the auth flows and setup.sh. For UI changes, also click through /dashboard/ and /users/ as an admin.

Debugging

The Flask Debug Toolbar is wired in; enable it with DEBUG_TB_ENABLED=1 in .env. To log SQL: