FlaskSpark is a lightweight and customizable Flask boilerplate designed to ignite your web application development process.
Project description
FlaskSpark
FlaskSpark is a lightweight Flask framework with a clear project structure, automatic class-based view registration, built-in SQLAlchemy + Flask-Migrate wiring, optional OAuth/OIDC login, and an asset pipeline for SCSS/JS.
Features
- App bootstrap with configurable
app_module - Auto-registration of class-based views (
as_view()) - SQLAlchemy + Flask-Migrate integration
- Pluggable login providers (
Default,OAuth) - OAuth/OIDC support via
authlib - Built-in i18n with Flask-Babel
- Static/template fallback (app first, FlaskSpark second)
- Optional SCSS/JS bundling via Flask-Assets
Requirements
- Python 3.8+
- pip
Installation
pip install FlaskSpark
Development (editable):
pip install -e .
Quick Start
from flaskspark import FlaskSpark
app = FlaskSpark(
app_module="app",
config={
"SECRET_KEY": "change-me",
"SQLALCHEMY_DATABASE_URI": "sqlite:///instance/app.db",
"BABEL_SUPPORTED_LOCALES": ["en", "de"],
},
).app
Expected app layout:
app/
__init__.py
views/
home.py
models/
__init__.py
templates/
static/
Class-Based Views
Any class in app.views implementing as_view() is auto-registered.
from flaskspark.views.flaskspark_method_view import FlaskSparkMethodView
from flask import render_template
class HomeView(FlaskSparkMethodView):
url = "/"
endpoint = "home"
def get(self):
return render_template("index.html")
OAuth (OIDC) Login Provider
Enable OAuth provider:
FlaskSpark(login_provider="OAuth")
Required config:
OAUTH_NAME
OAUTH_AUTHORIZE_URL
OAUTH_ACCESS_TOKEN_URL
OAUTH_USERINFO_ENDPOINT
OAUTH_JWKS_URI
OAUTH_CLIENT_ID
OAUTH_CLIENT_SECRET
OAUTH_SCOPE
Optional role mapping:
OAUTH_GROUPS_CLAIM=groups
OAUTH_ROLE_PRIORITY=admins,editors,users
OAUTH_ROLE_MAP=admins:Administrators,editors:Editors,users:Users
Database & Migrations
FLASK_APP=app.py python -m flask db init
FLASK_APP=app.py python -m flask db migrate -m "init"
FLASK_APP=app.py python -m flask db upgrade
Assets (SCSS / JS)
FlaskSpark can build SCSS and JS bundles:
FlaskSpark(
app_module="app",
config={
"ASSETS_ENABLE": True,
"ASSETS_AUTO_BUILD": True,
"ASSETS_BUNDLES": [
{
"name": "dashboard_js",
"type": "js",
"entry": "js/dashboard.js",
"output": "scripts/dashboard.min.js",
"filters": "rjsmin",
},
],
},
)
i18n
FlaskSpark initializes Babel and provides a client-side translation endpoint:
GET /_flaskspark/i18n?keys=Key%201,Key%202
Configuration
Common keys:
SECRET_KEY = "..."
SQLALCHEMY_DATABASE_URI = "sqlite:///instance/app.db"
APP_BIND_HOST = "0.0.0.0"
APP_PORT = 5067
BABEL_DEFAULT_LOCALE = "en"
BABEL_SUPPORTED_LOCALES = ["en", "de"]
License
MIT License. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flaskspark-0.1.0.tar.gz.
File metadata
- Download URL: flaskspark-0.1.0.tar.gz
- Upload date:
- Size: 85.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
894afde222cfee60d6f6de28f1e6848669b7d6188bc9f962161b786e904d158f
|
|
| MD5 |
2f3f1d8ce62d5fec5a8a4fd848a2f489
|
|
| BLAKE2b-256 |
034e386ed5d07faea1b3b877faa555f690c4c69ae35c24272d75e4f94237a257
|
Provenance
The following attestation bundles were made for flaskspark-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on berofa/FlaskSpark
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flaskspark-0.1.0.tar.gz -
Subject digest:
894afde222cfee60d6f6de28f1e6848669b7d6188bc9f962161b786e904d158f - Sigstore transparency entry: 976093600
- Sigstore integration time:
-
Permalink:
berofa/FlaskSpark@c68ff166d35a033384133185339dac6b2333f176 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/berofa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@c68ff166d35a033384133185339dac6b2333f176 -
Trigger Event:
push
-
Statement type:
File details
Details for the file flaskspark-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flaskspark-0.1.0-py3-none-any.whl
- Upload date:
- Size: 91.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
150bd0e6f9ca22798bf5e3c94283ed010500cf91066b6fbf8154008e99367fcc
|
|
| MD5 |
23f264a416827455fc761482baae8286
|
|
| BLAKE2b-256 |
3add6179c573fe897c4cfcba386c49b868d4003fece1a8241cfcffd0370e7f64
|
Provenance
The following attestation bundles were made for flaskspark-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on berofa/FlaskSpark
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flaskspark-0.1.0-py3-none-any.whl -
Subject digest:
150bd0e6f9ca22798bf5e3c94283ed010500cf91066b6fbf8154008e99367fcc - Sigstore transparency entry: 976093603
- Sigstore integration time:
-
Permalink:
berofa/FlaskSpark@c68ff166d35a033384133185339dac6b2333f176 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/berofa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@c68ff166d35a033384133185339dac6b2333f176 -
Trigger Event:
push
-
Statement type: