π Fleting Framework for Flet Python
Build cross-platform applications with Python, Flet, and MVC β faster than ever.
πΊπΈ English | π§π· PortuguΓͺs | πͺπΈ EspaΓ±ol
What is Fleting?
Fleting is a lightweight, opinionated micro-framework built on top of Flet. It brings the power of MVC architecture, clean code organization, and rapid development to Python developers building cross-platform applications.
Whether you're creating a mobile app, a desktop tool, or a tablet-friendly dashboard β Fleting gives you the structure and tools to ship faster.
β¨ Key Highlights
- β‘οΈ MVC Architecture β Clear separation of concerns
- π± Mobile-First β Automatically adapts to mobile, tablet, and desktop
- π Built-in i18n β Multi-language support out of the box
- π οΈ Productive CLI β Generate pages, models, controllers, and more
- ποΈ Multi-Database Support β SQLite and MySQL (PostgreSQL & SQL Server coming soon)
- π¨ Decoupled Layouts β Reusable, responsive UI components
- π¦ Simple Routing β Clean, declarative route definitions
- π§ͺ Built-in ORM β Lightweight model layer with relationships
π― Who is Fleting for?
| π¨βπ» Solo Developers | π’ Teams | π Students |
|---|---|---|
| Build apps fast without over-engineering | Standardized project structure | Learn MVC in Python |
| One framework for mobile + desktop | Easy onboarding for new members | Practice real-world architecture |
β οΈ Important change to the Fleting foundation
Version Fleting 1.2.3 was originally built upon Flet 0.8.x.
As of this update, the project now uses Flet 1.0.5 as its foundation. In other words:
- Before: Fleting 1.2.3 + Flet 0.8.x
- Now: Fleting 1.2.3 + Flet 1.0.5
This update incorporates the stability, performance, and API improvements found in Flet 1.0, but it also introduces breaking changes compared to Flet 0.8.x. If you have existing code written for the older Flet API, please review the points below before migrating:
- Services are now asynchronous and independent of the
pageobject (e.g.,await ft.SharedPreferences()instead ofpage.client_storage). - Most explicit calls to
page.update()are no longer required. UserControlhas been removed; custom components now inherit directly from controls (e.g.,ft.Row, etc.).- Some controls have been renamed (e.g.,
ElevatedButtonβButton).
Please refer to the official Flet migration guide for further details.
π Quick Start
Get your first Fleting app running in under 3 minutes:
1. Create an isolated virtual environment
Choose your preferred tool:
π¦ Using uv (Recommended)
# Install uv if you don't have it
pip install uv
# Create a new project with uv
uv init myapp
cd myapp
# Create and activate virtual environment
uv venv
# Activate on Linux/macOS
source .venv/bin/activate
# Activate on Windows (PowerShell)
.venv\Scripts\activate
# Install dependencies
uv pip install flet fleting
π Using venv (Standard)
# Create virtual environment
python -m venv venv
# Activate on Linux/macOS
source venv/bin/activate
# Activate on Windows (PowerShell)
venv\Scripts\activate
# Activate on Windows (CMD)
venv\Scripts\activate.bat
# Install dependencies
pip install flet fleting
π Using Poetry
# Install Poetry
pip install poetry
# Create new project
poetry new myapp
cd myapp
# Add dependencies
poetry add flet fleting
# Activate environment
poetry shell
2. Create a new project
pip install flet fleting
fleting init myapp
cd myapp
3. Run your app
fleting run
That's it! π You now have a working cross-platform application with:
β Multi-language support (English, Portuguese, Spanish)
β Responsive layout (mobile, tablet, desktop)
β MVC architecture
β SQLite database ready
π§ͺ Want MySQL or MariaDB instead?
pip install "fleting[mysql]" # MySQL
pip install "fleting[mariadb]" # MariaDB (PyMySQL)
fleting init myapp --mysql
- Databases guide: configuration, environment variables, Docker, migrations, ORM, shell
- Step-by-step examples: every CLI command in practice
π οΈ Fleting CLI Commands
π¦ Project Commands
| Command | Description |
|---|---|
fleting init <app_name> |
Initialize a new Fleting project |
fleting init <app_name> --mysql |
Initialize a new Fleting project with MySQL / MariaDB |
fleting info |
Show version and system information |
fleting run |
Run the application |
fleting doctor |
Check the project for common problems |
β Create Commands
| Command | Description |
|---|---|
fleting create page <name> |
Create a page (model + controller + view) |
fleting create view <name> |
Create a new view |
fleting create model <name> |
Create a new model |
fleting create controller <name> |
Create a new controller |
ποΈ Delete Commands
| Command | Description |
|---|---|
fleting delete page <name> |
Delete an existing page |
fleting delete view <name> |
Delete a view |
fleting delete model <name> |
Delete a model |
fleting delete controller <name> |
Delete a controller |
π List Commands
| Command | Description |
|---|---|
fleting list pages |
List all pages |
fleting list controllers |
List all controllers |
fleting list views |
List all views |
fleting list models |
List all models |
fleting list routes |
List all routes |
ποΈ Database Commands
| Command | Description |
|---|---|
fleting db init |
Initialize the database (SQLite by default) |
fleting db init --mysql |
Switch the project to MySQL / MariaDB (with .bak backups) |
fleting db init --sqlite |
Switch the project back to SQLite |
fleting db migrate |
Run database migrations |
fleting db seed |
Seed the database with initial data |
fleting db make <name> |
Create a new migration |
fleting db rollback |
Rollback the last migration |
fleting db status |
Show current database migration status |
ποΈ Database / Models Commands
| Command | Description |
|---|---|
fleting db model pull |
Generate models from the database schema |
fleting db model pull <table> |
Generate model for a specific table |
fleting db model pull <table> --force |
Overwrite existing model files |
π§© Console Commands
| Command | Description |
|---|---|
fleting shell |
Open interactive database shell (SQLite, MySQL / MariaDB) |
π Command Categories Summary
| Category | Commands |
|---|---|
| Project | init, info, run, doctor |
| Create | create page, create view, create model, create controller |
| Delete | delete page, delete view, delete model, delete controller |
| List | list pages, list controllers, list views, list models, list routes |
| Database | db init, db migrate, db seed, db make, db rollback, db status |
| Models | db model pull |
| Console | shell |
π± Built for the Real World
Mobile-First by Design Fleting automatically detects the device type and adapts layouts accordingly:
from core.state import AppState
if AppState.device == "mobile":
# Show mobile-optimized UI
elif AppState.device == "tablet":
# Show tablet-optimized UI
else:
# Show desktop-optimized UI
Built-in Internationalization
Support multiple languages with simple JSON files:
{
"app": {
"name": "MyApp"
},
"home": {
"title": "Welcome to MyApp"
}
}
from core.i18n import I18n
# Display translated text
I18n.t("home.title") # "Welcome to MyApp" in English
I18n.t("home.title") # "Bem-vindo ao MyApp" in Portuguese
I18n.t("home.title") # "Bienvenido a MyApp" in Spanish
Database Support
| Engine | Status | Use Case |
|---|---|---|
| SQLite | β Stable | Development, embedded apps |
| MySQL | β Stable | Production, web applications |
| MariaDB | β Stable | Production (PyMySQL driver recommended) |
| PostgreSQL | π Coming Soon | Enterprise applications |
| SQL Server | π Coming Soon | Enterprise integrations |
π Project Structure
Fleting generates a clean, organized project structure:
myapp/
βββ app/
β βββ controllers/ # Business logic
β βββ models/ # Data layer
β βββ views/ # UI components
β βββ layouts/ # Reusable layouts
β βββ pages/ # Page views
βββ configs/ # Configuration files
β βββ app_config.py
β βββ routes.py
β βββ languages/ # i18n translations
βββ core/ # Framework core
β βββ app.py
β βββ router.py
β βββ database.py
β βββ i18n.py
β βββ migrations.py
βββ migrations/ # Database migrations
βββ seeds/ # Seed data
βββ main.py # Application entry point
π Learning Resources
| Resource | Description | Link |
|---|---|---|
| π Fleting Documentation | Complete framework documentation | |
| π Fleting Course | Step-by-step video course | |
| π Flet Documentation | Underlying Flet framework | |
| π€ FLAI β Local AI Framework for Fleting | Local AI for Fleting apps |
π― Philosophy
Fleting was built on clear principles:
1οΈβ£ Simplicity Above All
- No unnecessary abstractions
- Explicit, readable code
- Predictable architecture
2οΈβ£ Separation of Responsibilities
- View β Pure UI (Flet)
- Layout β Reusable visual structure
- Controller β Business logic
- Model β Data layer
- Router β Navigation
- Core β Framework infrastructure
3οΈβ£ Mobile-First
- Automatic device detection
- Dynamic layout adaptation
- Touch-friendly components
4οΈβ£ Native Internationalization
- Simple JSON translations
- Real-time language switching
- Accessible anywhere in the app
5οΈβ£ CLI as a First-Class Citizen
- Standardized code generation
- Reduced boilerplate
- Convention over Configuration
π€ Contributing
We welcome contributions! Whether it's:
-
π Bug reports β Open an issue
-
π‘ Feature ideas β Start a discussion
-
π Documentation β Improve our docs
-
π§ Code β Submit a pull request
- For those who want to contribute to Fleting on GitHub.
Check out our Contributing Guide to get started.
π License
MIT License β Use it freely in personal and commercial projects.
π¬ Get Help
- π Read the Docs
- π Report Issues
- π¬ Contact the Author
βοΈ Star us on GitHub β it helps!
```
Fleting Framework