Skip to main content

Framework-agnostic adapter for Bisslog. Connects external interfaces to use cases while keeping domain logic isolated and pure.

Project description

bisslog-fastapi

PyPI - Version Tests License

Framework-agnostic adapter for Bisslog. Connects external interfaces to use cases while keeping domain logic isolated and pure.

bisslog-fastapi is the FastAPI adapter for the Bisslog hexagonal architecture framework. It allows you to expose your core business logic (Use Cases) as HTTP/WebSocket endpoints automatically, preserving the Clean Architecture principles.

It acts as a bridge:

  1. Read Metadata: Scans your Bisslog services and triggers.
  2. Adapt: Maps HTTP requests (Path, Query, Body, Headers) to your Use Case input arguments.
  3. Execute: Runs your Use Case (Sync or Async).
  4. Respond: formats the result back to JSON.

Installation

pip install bisslog-fastapi

Usage

You can use bisslog-fastapi in two ways: as a Runtime Runner or as a Code Generator (Builder).

1. Runtime Runner (Recommended for Dev)

Dynamically mounts your use cases at startup without generating extra code files.

bisslog_fastapi run [--metadata-file FILE] [--use-cases-folder-path DIR]
                    [--infra-path DIR] [--encoding ENC]
                    [--host HOST] [--port PORT] [--reload]
                    [--workers WORKERS] [--log-level LEVEL]

Example:

bisslog_fastapi run --metadata-file bisslog.metadata.json --port 8000 --reload

2. Builder Strategy (Production)

Generates a static main.py file with all routes hardcoded. This is useful for inspection or performance optimization.

bisslog_fastapi build [--metadata-file FILE] [--use-cases-folder-path DIR]
                      [--infra-path DIR] [--encoding ENC]
                      [--target-filename FILE]

Example:

bisslog_fastapi build --target-filename main.py

Then run the generated file normally with uvicorn:

uvicorn main:app --reload

Features

  • Automatic Routing: Uses TriggerHttp metadata to register routes.
  • Smart Mapping:
    • path_query.* → URL Path parameters.
    • body.* → JSON Body fields.
    • params.* → Query parameters.
    • headers.* → HTTP Headers.
  • Async Support: Native support for asynchronous Use Cases.
  • OpenAPI Integration: Automatically generates Swagger UI for your domain logic with correct signatures.
  • CORS: Configurable per-trigger via metadata.

License

This project is licensed under the MIT License.
See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bisslog_fastapi-0.0.1.tar.gz (44.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bisslog_fastapi-0.0.1-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file bisslog_fastapi-0.0.1.tar.gz.

File metadata

  • Download URL: bisslog_fastapi-0.0.1.tar.gz
  • Upload date:
  • Size: 44.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for bisslog_fastapi-0.0.1.tar.gz
Algorithm Hash digest
SHA256 76e5eeaf6f3049271fec7e6dcf114c1badd702759aa85883c769dd2addcdf4f6
MD5 97e355d0e46750ed03b7ff8818bb3520
BLAKE2b-256 d01ef6e9dd183d8416f11a40fc32abfff8eb1094e12e8ef83fda54cad6d3980b

See more details on using hashes here.

File details

Details for the file bisslog_fastapi-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bisslog_fastapi-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1cf0c6c517a48d09035480900ae97484f4577caf4ee422089e89c14f4148f33a
MD5 79b25f5da9920f22118618855b9afed0
BLAKE2b-256 fdbcfe7f8dc5e41c8f79c12526a72367a3c161198fc7b1d304b7c5bf29754814

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page