Flaskion
Flaskion is a lightweight MVC micro-framework for Flask, providing developers with a structured foundation for scalable, maintainable applications. Inspired by Laravel, Flaskion introduces clean architecture, modular scaffolding, and a developer-first CLI to streamline your Flask workflow.
🚀 Features
✅ MVC Architecture – Clean separation of controllers
, models
, and templates
✅ Built-in CLI – Scaffold full resources, controllers, models, and authentication with ease
✅ Web & API Routing – Clean route structure split between HTML and JSON endpoints
✅ DB Choice at Setup – Use SQLite, MySQL, or Postgres with built-in .env
generation
✅ Flask-Migrate Ready – Migrations are set up and ready to run on first build
✅ Authentication Scaffolding – Generate full auth (login/register/logout/dashboard) with one command
📁 Project Structure
flaskion/
├── app/
│ ├── __init__.py # Application factory
│ ├── routes/ # Web + API routes
│ │ ├── web_routes.py
│ │ └── api_routes.py
│ ├── controllers/ # View logic
│ ├── models/ # SQLAlchemy models
│ ├── schemas/ # Marshmallow schemas
│ ├── templates/ # Jinja2 templates
│ ├── static/ # CSS, JS, images
│ └── config.py # App configuration
├── migrations/ # Auto-generated with Flask-Migrate
├── run.py # Entry point
├── requirements.txt # Dependencies
├── .env.example # Example environment file
└── README.md # This doc
🧪 Installation & Setup
1. Install the CLI
pipx install flaskion-cli
pip install flaskion-cli
2. Create a New Project
flaskion make:new myproject --db=sqlite
3. Enter the project & activate venv
cd myproject
source venv/bin/activate
⚙️ CLI Commands
flaskion make:new <name> | Create a new project scaffold |
flaskion make:model | Create a SQLAlchemy model |
flaskion make:schema | Create a Marshmallow schema |
flaskion make:controller | Create a controller with CRUD methods |
flaskion make:resource | Generate model + controller + schema + routes |
flaskion make:auth | Generate full login/register/logout system |
Add --api
to make:resource
for API route generation instead of web views.
🛣️ Managing Routes
Flaskion separates routes for HTML views and API endpoints:
- Web Routes:
app/routes/web_routes.py
- API Routes:
app/routes/api_routes.py
Both are registered in app/__init__.py
:
from app.routes.api_routes import api_routes
from app.routes.web_routes import web_routes
def register_routes(app):
app.register_blueprint(api_routes)
app.register_blueprint(web_routes)
🧬 Database Migrations
Flaskion uses Flask-Migrate out of the box:
flask db init
flask db migrate -m "Initial"
flask db upgrade
🔐 Authentication
Generate full login/register/logout and dashboard flow:
flaskion make:auth
- HTML templates auto-created under
templates/auth/
- Session-based login using Flask sessions
- Routes for
/login
, /register
, /dashboard
, and /logout
▶️ Running the App
flask run
Then visit: http://127.0.0.1:5000
📚 Documentation
Coming soon at: https://flaskion.dev (in progress)