Skip to main content

Introduction to Framefox

Framefox is a Python web framework that makes development enjoyable and productive. Built on FastAPI’s foundation, it combines speed, type safety, and clean architecture to help you ship fast without sacrificing code quality.
Swift, smart, and a bit foxy! Framefox is designed for developers who want to build modern web applications with Python 3.12+ while maintaining clean, maintainable code.

Why Framefox?

Framefox combines the speed of FastAPI with clean MVC architecture, type-safe SQLModel, robust Pydantic validation, and developer-friendly tooling. It’s built for developers who want to ship fast without sacrificing code quality.

FastAPI Foundation

Built on FastAPI with async/await support out of the box. Get blazing fast performance with modern Python async patterns.

Clean MVC Architecture

Separation of concerns with Controllers, Templates, and Repositories. Your code stays maintainable as your team grows.

Type-Safe Database

SQLModel integration provides type safety with automatic validation. Catch errors before they reach production.

Interactive CLI

Generate components instantly with commands like framefox create controller. Build faster with intelligent scaffolding.

Key Features

Performance & Architecture

  • FastAPI Foundation - Built on FastAPI for exceptional performance
  • Async/Await Support - Modern async patterns throughout the framework
  • MVC Architecture - Clean separation with Controllers, Templates, and Repositories
  • Dependency Injection - Built-in container for managing services
  • Repository Pattern - Clean data access layer for database operations

Security First

  • CSRF Protection - Automatic CSRF token generation and validation
  • XSS Prevention - Secure templating with built-in escaping
  • Session Management - Secure, encrypted session handling
  • Authentication System - Ready-to-use user authentication
  • Role-Based Access Control - Fine-grained permission management

Developer Experience

  • Interactive CLI - Powerful commands for rapid development
  • Component Generators - Create controllers, entities, and full CRUD instantly
  • Hot Reload - Development server with automatic reloading
  • Comprehensive Error Pages - Detailed debugging information
  • Built-in Profiler - Performance monitoring and optimization

Database & ORM

  • SQLModel Integration - Type-safe models with Pydantic validation
  • Entity-Repository Pattern - Clean separation of data and business logic
  • Database Migrations - Built-in Alembic support
  • Query Builder - Fluent interface for complex queries
  • Multi-Database Support - MySQL, PostgreSQL, SQLite, and more

Architecture Overview

Framefox follows a clean, organized project structure that scales:
my-project/
├── src/
│   ├── controllers/     # Handle HTTP requests and business logic
│   ├── entity/          # Database models and entities  
│   ├── form/           # Form types and validation
│   └── repository/     # Data access layer
├── templates/          # Jinja2 templates with inheritance
├── config/             # YAML configuration files
├── public/            # Static assets (CSS, JS, images)
└── main.py            # Application entry point
This clean MVC separation means your code stays maintainable as your team and project grow. Each layer has a clear responsibility and purpose.

Quick Example

Here’s what a simple controller looks like in Framefox:
from framefox.core.routing.decorator.route import Route
from framefox.core.controller.abstract_controller import AbstractController

class UserController(AbstractController):
    
    @Route("/users", "user.index", methods=["GET"])
    async def index(self):
        users = await self.user_repository.find_all()
        return self.render("user/index.html", {"users": users})
    
    @Route("/users/{id}", "user.show", methods=["GET"])
    async def show(self, id: int):
        user = await self.user_repository.find(id)
        return self.render("user/show.html", {"user": user})
And the corresponding Jinja2 template:
<!DOCTYPE html>
<html>
<head>
    <title>Users</title>
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
    <h1>Users</h1>
    
    {% for user in users %}
        <div class="user-card">
            <h3>{{ user.name }}</h3>
            <a href="{{ url_for('user.show', id=user.id) }}">View Profile</a>
        </div>
    {% endfor %}
</body>
</html>

Template System

Framefox uses Jinja2 with powerful built-in functions:
  • {{ url_for('route.name', param=value) }} - Generate URLs from route names
  • {{ asset('path/file.css') }} - Asset management with versioning
  • {{ csrf_token() }} - CSRF protection tokens
  • {{ current_user }} - Access authenticated user
  • {{ get_flash_messages() }} - Session-based notifications

Get Started

Ready to build your first Framefox application? Continue to the next sections:

Installation

Set up Framefox on your system and verify your environment

Quickstart

Build your first application in under 5 minutes

Who’s Behind Framefox?

Framefox is developed and maintained by SOMA Smart, a technology company focused on building innovative development tools. The framework is backed by passionate developers:
  • Rayen BOUMAZA - Framework Architect (LinkedIn)
  • Raphaël LEUROND - Core Developer (LinkedIn)
SOMA Smart is committed to empowering developers with cutting-edge tools and frameworks, with a focus on open-source development and long-term support.
Framefox is open source and licensed under the MIT License. Contributions are welcome!

Build docs developers (and LLMs) love