# bisslog-flask
[](https://pypi.org/project/bisslog-flask/)
[](LICENSE)
**bisslog-flask** is an extension of the Bisslog library to support processes with Flask.
It enables dynamic HTTP and WebSocket route registration from use case metadata, allowing developers to build clean, modular, and metadata-driven APIs with minimal boilerplate.
Part of the Bisslog ecosystem, it is designed to work seamlessly with domain-centric architectures like Hexagonal or Clean Architecture.
---
## โจ Features
- ๐ Dynamic route registration for HTTP and WebSocket triggers
- ๐ง Metadata-driven setup โ use YAML or JSON to declare your use cases
- ๐ Automatic CORS per endpoint using `flask-cors`
- ๐ Extensible resolver pattern โ plug in your own processor
- โ๏ธ Mapper integration โ maps HTTP request parts to domain function arguments
---
## ๐ฆ Installation
```bash
pip install bisslog-flask
```
---
## ๐ Quickstart
### Programmatically
Use this approach if you want to configure the app before Bisslog touches it:
```python
from flask import Flask
from bisslog_flask import BisslogFlask
app = Flask(__name__)
BisslogFlask(
metadata_file="metadata.yml",
use_cases_folder_path="src/domain/use_cases",
app=app
)
if __name__ == "__main__":
app.run(debug=True)
```
Or use the factory version:
```python
from bisslog_flask import BisslogFlask
app = BisslogFlask(
metadata_file="metadata.yml",
use_cases_folder_path="src/domain/use_cases"
)
if __name__ == "__main__":
app.run(debug=True)
```
---
## ๐ฅ๏ธ CLI Usage
You can also use the `bisslog_flask` CLI to run or generate a Flask app.
```bash
bisslog_flask run [--metadata-file FILE] [--use-cases-folder-path DIR]
[--infra-folder-path DIR] [--encoding ENC]
[--secret-key KEY] [--jwt-secret-key KEY]
bisslog_flask build [--metadata-file FILE] [--use-cases-folder-path DIR]
[--infra-folder-path DIR] [--encoding ENC]
[--target-filename FILE]
```
- `run`: Launches the Flask application from metadata.
- `build`: Generates a boilerplate Flask file (`flask_app.py` by default).
All options are optional. You can override defaults via CLI flags.
---
## ๐ CORS Handling
CORS is applied only when `allow_cors: true` is specified in the trigger.
Fully dynamic: works even with Flask dynamic routes like `/users/<id>`.
Powered by `@cross_origin` from `flask-cors`.
---
## โ
Requirements
- Python โฅ 3.7
- Flask โฅ 2.0
- bisslog-schema โฅ 0.0.3
- flask-cors
- (Optional) flask-sock if using WebSocket triggers
---
## ๐งช Testing Tip
You can test the generated Flask app directly with `app.test_client()` if using the programmatic interface:
```python
from bisslog_flask import BisslogFlask
def test_user_create():
app = BisslogFlask(
metadata_file="metadata.yml",
use_cases_folder_path="src/use_cases"
)
client = app.test_client()
response = client.post("/user", json={"name": "Ana", "email": "ana@example.com"})
assert response.status_code == 200
```
If you're generating the code (boilerplate), you just need to test your use cases.
---
## ๐ License
This project is licensed under the MIT License.
See the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "bisslog-flask",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "hexagonal, adapters, bisslog, flask",
"author": null,
"author_email": "Darwin Stiven Herrera Cartagena <darwinsherrerac@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/24/e8/5f461559ccabd1ce5e1d4b286ea67b332c857c7668870820618e9134b961/bisslog_flask-0.0.3.tar.gz",
"platform": null,
"description": "# bisslog-flask\n\n[](https://pypi.org/project/bisslog-flask/)\n[](LICENSE)\n\n**bisslog-flask** is an extension of the Bisslog library to support processes with Flask. \nIt enables dynamic HTTP and WebSocket route registration from use case metadata, allowing developers to build clean, modular, and metadata-driven APIs with minimal boilerplate.\n\nPart of the Bisslog ecosystem, it is designed to work seamlessly with domain-centric architectures like Hexagonal or Clean Architecture.\n\n---\n\n## \u2728 Features\n\n- \ud83d\udd01 Dynamic route registration for HTTP and WebSocket triggers\n- \ud83e\udde0 Metadata-driven setup \u2013 use YAML or JSON to declare your use cases\n- \ud83d\udd12 Automatic CORS per endpoint using `flask-cors`\n- \ud83d\udd0c Extensible resolver pattern \u2013 plug in your own processor\n- \u2699\ufe0f Mapper integration \u2013 maps HTTP request parts to domain function arguments\n\n---\n\n## \ud83d\udce6 Installation\n\n```bash\npip install bisslog-flask\n```\n\n---\n\n## \ud83d\ude80 Quickstart\n\n### Programmatically\n\nUse this approach if you want to configure the app before Bisslog touches it:\n\n```python\nfrom flask import Flask\nfrom bisslog_flask import BisslogFlask\n\napp = Flask(__name__)\nBisslogFlask(\n metadata_file=\"metadata.yml\",\n use_cases_folder_path=\"src/domain/use_cases\",\n app=app\n)\n\nif __name__ == \"__main__\":\n app.run(debug=True)\n```\n\nOr use the factory version:\n\n```python\nfrom bisslog_flask import BisslogFlask\n\napp = BisslogFlask(\n metadata_file=\"metadata.yml\",\n use_cases_folder_path=\"src/domain/use_cases\"\n)\n\nif __name__ == \"__main__\":\n app.run(debug=True)\n```\n\n---\n\n## \ud83d\udda5\ufe0f CLI Usage\n\nYou can also use the `bisslog_flask` CLI to run or generate a Flask app.\n\n```bash\nbisslog_flask run [--metadata-file FILE] [--use-cases-folder-path DIR]\n [--infra-folder-path DIR] [--encoding ENC]\n [--secret-key KEY] [--jwt-secret-key KEY]\n\nbisslog_flask build [--metadata-file FILE] [--use-cases-folder-path DIR]\n [--infra-folder-path DIR] [--encoding ENC]\n [--target-filename FILE]\n```\n\n- `run`: Launches the Flask application from metadata.\n- `build`: Generates a boilerplate Flask file (`flask_app.py` by default).\n\nAll options are optional. You can override defaults via CLI flags.\n\n---\n\n## \ud83d\udd10 CORS Handling\n\nCORS is applied only when `allow_cors: true` is specified in the trigger.\n\nFully dynamic: works even with Flask dynamic routes like `/users/<id>`.\n\nPowered by `@cross_origin` from `flask-cors`.\n\n---\n\n## \u2705 Requirements\n\n- Python \u2265 3.7\n- Flask \u2265 2.0\n- bisslog-schema \u2265 0.0.3\n- flask-cors\n- (Optional) flask-sock if using WebSocket triggers\n\n---\n\n## \ud83e\uddea Testing Tip\n\nYou can test the generated Flask app directly with `app.test_client()` if using the programmatic interface:\n\n```python\nfrom bisslog_flask import BisslogFlask\n\ndef test_user_create():\n app = BisslogFlask(\n metadata_file=\"metadata.yml\",\n use_cases_folder_path=\"src/use_cases\"\n )\n client = app.test_client()\n response = client.post(\"/user\", json={\"name\": \"Ana\", \"email\": \"ana@example.com\"})\n assert response.status_code == 200\n```\n\nIf you're generating the code (boilerplate), you just need to test your use cases.\n\n---\n\n## \ud83d\udcdc License\n\nThis project is licensed under the MIT License. \nSee the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": null,
"summary": "It is an extension of the bisslog library to support processes with flask",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/darwinhc/bisslog-flask"
},
"split_keywords": [
"hexagonal",
" adapters",
" bisslog",
" flask"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "879418566d4285fa6024a4f6c898f434d9f1933af73e77957dac65e11d525f61",
"md5": "a95389c2653b332a0790aae494d2085b",
"sha256": "9b07032287ddb177d2cf888175ca894faaf1faa67977d2ce6201701c778a0d10"
},
"downloads": -1,
"filename": "bisslog_flask-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a95389c2653b332a0790aae494d2085b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 21922,
"upload_time": "2025-10-14T01:28:51",
"upload_time_iso_8601": "2025-10-14T01:28:51.320241Z",
"url": "https://files.pythonhosted.org/packages/87/94/18566d4285fa6024a4f6c898f434d9f1933af73e77957dac65e11d525f61/bisslog_flask-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "24e85f461559ccabd1ce5e1d4b286ea67b332c857c7668870820618e9134b961",
"md5": "d599e9b09ca7fd75bb3df9a7f73847f9",
"sha256": "2277e1f263eadbe749998d30c953fd90725bb21da6b0cd098cc1c19c347a99a4"
},
"downloads": -1,
"filename": "bisslog_flask-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "d599e9b09ca7fd75bb3df9a7f73847f9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 33682,
"upload_time": "2025-10-14T01:28:52",
"upload_time_iso_8601": "2025-10-14T01:28:52.147963Z",
"url": "https://files.pythonhosted.org/packages/24/e8/5f461559ccabd1ce5e1d4b286ea67b332c857c7668870820618e9134b961/bisslog_flask-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-14 01:28:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "darwinhc",
"github_project": "bisslog-flask",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "bisslog",
"specs": [
[
">=",
"0.0.7"
]
]
},
{
"name": "bisslog-schema",
"specs": [
[
">=",
"0.0.9"
]
]
},
{
"name": "flask",
"specs": []
}
],
"lcname": "bisslog-flask"
}