flask-route-bridge
Flask integration for route-bridge.
Define your Flask routes with metadata, emit a shared manifest, and generate a typed TypeScript frontend client automatically.
Install
pip install flask-route-bridge
Quick start
from flask import Flask
from flask_route_bridge import RouteBridge
app = Flask(__name__)
rb = RouteBridge(app, manifest_path="./route-bridge.manifest.json", url_prefix="/api")
@rb.route(
name="createUser",
method="POST",
path="/users",
body={"name": "string", "email": "string"},
response={"id": "string", "name": "string"},
)
def create_user(body, query, params, request):
return {"id": "abc", "name": body["name"]}
if __name__ == "__main__":
rb.write_manifest() # writes route-bridge.manifest.json
app.run(port=3001)
Then generate the TypeScript client:
npx route-bridge generate \
--manifest ./route-bridge.manifest.json \
--output ../frontend/src/generated
API
RouteBridge(app?, *, manifest_path, logging, url_prefix)
| Param | Type | Default | Description |
|---|---|---|---|
app |
Flask |
None |
Flask app (or pass later via init_app) |
manifest_path |
str |
./route-bridge.manifest.json |
Where to write the manifest |
logging |
bool |
True in debug mode |
Enable request logging |
url_prefix |
str |
"" |
URL prefix for all routes |
@rb.route(name, method, path, body?, query?, params?, response?, description?)
Decorator that registers a Flask route and records its metadata.
Handler signature: fn(body, query, params, request) -> dict
rb.write_manifest()
Writes the manifest to manifest_path. Call at startup.
rb.init_app(app)
Attach to a Flask app after construction (application factory pattern).
License
MIT
Metadata
Release files for flask-route-bridge 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flask_route_bridge-0.1.0.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flask_route_bridge-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.6 kB
Release files / flask_route_bridge-0.1.0.tar.gz
| Download URL | flask_route_bridge-0.1.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6361f3e844c25176e50444efaf61aea8a9eadd862ec2ef08e2e60b834cd70405
|
|
BLAKE2b-256 checksum How to use checksums |
31cbad92fb3e999dbaf7c2136b903860df57122a3168ea3a0a119b7eb2f36b9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / flask_route_bridge-0.1.0-py3-none-any.whl
| Download URL | flask_route_bridge-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff4052ebb24f902dbeb9880131cc9db995f997896b5207018aea19959b47182b
|
|
BLAKE2b-256 checksum How to use checksums |
524b4109db589f57721129f856f03dd14ffc5b1bd4270e2fd2e0df6015a7b601
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|