Skip to main content

Project Structure

Blueprints

Enferno uses a three-blueprint architecture for better organization and security:

1. Portal Blueprint (portal/)

Usually contains protected routes that require authentication. Enferno uses a pattern of protecting all routes in this blueprint automatically using before_request:
This pattern ensures that all routes within the portal blueprint require authentication without needing to decorate each route individually.

2. User Blueprint (user/)

Handles user management, authentication, and profile-related routes:

3. Public Blueprint (public/)

Contains routes that are publicly accessible without authentication:

Database Operations

Enferno uses SQLAlchemy 2.x with the Flask-SQLAlchemy extension. The db instance is available from enferno.extensions.

Model Definition

Database Operations

Background Tasks (Optional)

Celery is available when you need async job processing. First, install the full extras:
Define tasks in enferno/tasks/__init__.py:
Call tasks asynchronously:
Run Celery worker:

API Development

Add API endpoints to your blueprints:

Development Server

Security Best Practices

  1. Input Validation
  2. CSRF Protection
  3. Authentication

Debugging

Enferno includes several debugging tools:
  1. Flask Debug Toolbar
  2. Logging
  3. Database Debugging