Skip to main content

bapp-connectors

A ports-and-adapters integration framework for connecting to external services: marketplaces, couriers, payment gateways, messaging providers, and file storage.

Architecture

┌──────────────────────────────────────────────┐
│  Django Layer (django-bapp-connectors)        │
│  Models, Services, Tasks, Circuit Breaker     │
├──────────────────────────────────────────────┤
│  Core Framework (bapp-connectors)             │
│  Ports, DTOs, HTTP Client, Registry, Webhooks │
├──────────────────────────────────────────────┤
│  Provider Adapters                            │
│  Trendyol, eMAG, Sameday, Stripe, ...        │
└──────────────────────────────────────────────┘

Two packages, one monorepo:

Package Purpose Dependencies
bapp-connectors Core framework + all provider adapters requests, pydantic (no Django)
django-bapp-connectors Multi-tenant Django integration django, bapp-connectors, cryptography

Providers

Family Providers Count
Shop CEL.ro, eMAG, Gomag, Magento, Okazii, PrestaShop, Shopify, Trendyol, Vendigo, WooCommerce 10
Courier Colete Online, GLS, Sameday 3
Payment Cardinity, EuPlatesc, LibraPay, Netopia, PayPal, Stripe, Utrust 7
Messaging Discord, GoIP, Instagram DM, Matrix, Facebook Messenger, RoboSMS, Telegram, WhatsApp 8
Storage Dropbox, FTP File Storage, Google Drive, OneDrive, S3 Storage, SFTP, WebDAV 7
LLM Anthropic, Google Gemini, Ollama, OpenAI 4
Feed Compari.ro, Facebook Commerce, Google Merchant Center, Okazii.ro 4
Ads Facebook Ads, Google Ads, LinkedIn Ads, Microsoft Ads, Pinterest Ads, TikTok Ads 6
Email Gmail, Mailchimp Transactional, Amazon SES, SMTP Email 4
Social Facebook Page, Instagram, LinkedIn Page, Pinterest, Threads, TikTok, YouTube Shorts 7
Total 60

Quick Start

Install

uv add bapp-connectors              # core only
uv add django-bapp-connectors       # with Django integration

Use a provider directly

from bapp_connectors.providers.shop.trendyol import TrendyolShopAdapter

adapter = TrendyolShopAdapter(credentials={
    "username": "api_user",
    "password": "api_pass",
    "seller_id": "12345",
    "country": "RO",
})

# Test connection
result = adapter.test_connection()
print(result.success)

# Fetch orders
orders = adapter.get_orders()
for order in orders.items:
    print(order.order_id, order.status, order.total)

# Check capabilities
from bapp_connectors.core.capabilities import BulkUpdateCapability
if adapter.supports(BulkUpdateCapability):
    adapter.bulk_update_products(updates)

Use the registry

from bapp_connectors.core.registry import registry

# Import providers to register them
import bapp_connectors.providers.shop.trendyol

# Create adapter via registry
adapter = registry.create_adapter(
    family="shop",
    provider="trendyol",
    credentials={"username": "...", "password": "...", "seller_id": "..."},
)

# List all registered providers
for manifest in registry.list_providers():
    print(f"{manifest.family}: {manifest.name}")

Django integration

# models.py
from django_bapp_connectors.models import AbstractConnection

class Connection(AbstractConnection):
    company = models.ForeignKey("company.Company", on_delete=models.CASCADE)

# Usage
conn = Connection.objects.create(
    company=company,
    provider_family="shop",
    provider_name="trendyol",
)
conn.credentials = {"username": "...", "password": "...", "seller_id": "..."}
conn.save()

# Get adapter and use it
adapter = conn.get_adapter()
orders = adapter.get_orders()

# Circuit breaker: auto-disables after 3 auth failures
conn.is_operational  # True when is_enabled AND is_connected

Core Concepts

Ports (Interfaces)

Each provider family has a port that defines the common contract:

  • ShopPort — orders, products, stock/price sync
  • CourierPort — AWB generation, tracking, shipment management
  • PaymentPort — checkout sessions, payment status, refunds
  • MessagingPort — send messages (SMS, email, WhatsApp, Telegram), reply to inbound
  • StoragePort — save, open, delete, exists, listdir, size (Django Storage API compatible)
  • LLMPort — chat completion, model listing, tool/function calling

Capabilities (Optional Features)

Adapters can implement optional capabilities beyond their port:

  • BulkUpdateCapability — batch product updates
  • WebhookCapability — signature verification, webhook parsing
  • OAuthCapability — OAuth2 flow (authorize, exchange, refresh)
  • InvoiceAttachmentCapability — attach invoices to orders
  • ProductFeedCapability — generate product feeds
  • EmbeddingCapability — text embeddings for RAG/search
  • TranscriptionCapability — audio-to-text (Whisper)
  • StreamingCapability — streaming LLM responses
  • ImageGenerationCapability — AI image generation

Feature discovery: adapter.supports(BulkUpdateCapability)

Normalized DTOs

All providers return the same data types:

  • Order, OrderItem, OrderStatus, PaymentStatus
  • Product, ProductUpdate, ProductCategory
  • Shipment, AWBLabel, TrackingEvent
  • CheckoutSession, PaymentResult, Refund
  • OutboundMessage, InboundMessage, DeliveryReport
  • ChatMessage, LLMResponse, TokenUsage, ModelInfo, ToolCall
  • EmbeddingResult, TranscriptionResult, ImageResult
  • Contact, Address
  • PaginatedResult[T] — cursor-based pagination

Provider-specific data lives in the extra: dict field and provider_meta.

Resilient HTTP Client

Built-in retry, rate limiting, and observability:

  • Exponential backoff with configurable max retries
  • Token-bucket rate limiting per provider
  • Request/response middleware chain for logging
  • Error classification: retryable vs permanent

Error Hierarchy

ConnectorError
├── AuthenticationError      (401/403, not retryable)
├── ConfigurationError       (bad config, not retryable)
├── ValidationError          (bad request, not retryable)
├── RateLimitError           (429, retryable, has retry_after)
├── ProviderError            (5xx, retryable)
├── PermanentProviderError   (4xx non-auth, not retryable)
├── UnsupportedFeatureError  (capability not supported)
└── WebhookVerificationError (bad signature)

Development

# Setup
cd packages/connectors
uv sync --extra dev

# Run tests
uv run pytest tests/ src/bapp_connectors/providers/shop/trendyol/tests/ -v -p no:django

# Lint
uv run ruff check src/
uv run ruff format src/

Django workspace

cd packages/connectors/packages/django
uv sync --extra dev
uv run pytest tests/ -v

Documentation

Project Structure

packages/connectors/
├── src/bapp_connectors/
│   ├── core/
│   │   ├── ports/          # Port interfaces (contracts)
│   │   ├── capabilities/   # Optional capability interfaces
│   │   ├── dto/            # Normalized data transfer objects
│   │   ├── http/           # Resilient HTTP client + auth + retry + rate limit
│   │   ├── webhooks/       # Webhook dispatcher + signature verification
│   │   ├── errors.py       # Error hierarchy
│   │   ├── types.py        # Enums
│   │   ├── manifest.py     # Provider manifest schema
│   │   └── registry.py     # Provider registry
│   └── providers/
<!-- STRUCTURE:BEGIN -->
│       ├── shop/          # CEL.ro, eMAG, Gomag, Magento, Okazii, PrestaShop, Shopify, Trendyol, Vendigo, WooCommerce
│       ├── courier/       # Colete Online, GLS, Sameday
│       ├── payment/       # Cardinity, EuPlatesc, LibraPay, Netopia, PayPal, Stripe, Utrust
│       ├── messaging/     # Discord, GoIP, Instagram DM, Matrix, Facebook Messenger, RoboSMS, Telegram, WhatsApp
│       ├── storage/       # Dropbox, FTP File Storage, Google Drive, OneDrive, S3 Storage, SFTP, WebDAV
│       ├── llm/           # Anthropic, Google Gemini, Ollama, OpenAI
│       ├── feed/          # Compari.ro, Facebook Commerce, Google Merchant Center, Okazii.ro
│       ├── ads/           # Facebook Ads, Google Ads, LinkedIn Ads, Microsoft Ads, Pinterest Ads, TikTok Ads
│       ├── email/         # Gmail, Mailchimp Transactional, Amazon SES, SMTP Email
│       └── social/        # Facebook Page, Instagram, LinkedIn Page, Pinterest, Threads, TikTok, YouTube Shorts
<!-- STRUCTURE:END -->
├── packages/django/        # Django integration (separate uv workspace)
│   └── src/django_bapp_connectors/
│       ├── models/         # Abstract models (Connection, SyncState, WebhookEvent, ExecutionLog)
│       ├── services/       # Service layer (Connection, Sync, Webhook)
│       ├── webhooks/       # Django views + URL routing
│       ├── tasks.py        # Celery tasks with circuit breaker
│       ├── callbacks.py    # Execution logging middleware
│       ├── encryption.py   # Fernet credential encryption
│       └── admin.py        # Admin mixins
├── tests/                  # Core framework tests
└── docs/                   # Documentation

Download files

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

Source Distribution

bapp_connectors-0.27.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

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

bapp_connectors-0.27.0-py3-none-any.whl (750.7 kB view details)

Uploaded Python 3

File details

Details for the file bapp_connectors-0.27.0.tar.gz.

File metadata

  • Download URL: bapp_connectors-0.27.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bapp_connectors-0.27.0.tar.gz
Algorithm Hash digest
SHA256 ecf312b1ff939c36e6c7c6095076b4afb83a6b86a015b8e38ac336858992e61d
MD5 544a6a9b43ec2260dfb76a69c423cf35
BLAKE2b-256 7ec438f8d8545a57834a3d7c008b72c6cf169a35a5c07334064f9a853f06ef6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bapp_connectors-0.27.0.tar.gz:

Publisher: publish.yml on bapp-open/bapp-connectors

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bapp_connectors-0.27.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bapp_connectors-0.27.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c85914254e31ce41e2c1479e62891c2a03c5ee2592ea46cc4813ed715ecb8ee3
MD5 152c625619e8548adea1aae3b1dfc477
BLAKE2b-256 8f4672cf88a3563d9cc65ce6c14cc6f6995d7312b10769ae4273d2f0ddb3b5c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bapp_connectors-0.27.0-py3-none-any.whl:

Publisher: publish.yml on bapp-open/bapp-connectors

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.29.0

2 files

0.28.3

2 files

0.28.2

2 files

0.28.1

2 files

0.28.0

2 files

0.27.2

2 files

0.27.1

2 files

This release

0.27.0 This release

2 files

0.26.0

2 files

0.25.0

2 files

0.24.0

2 files

0.23.0

2 files

0.22.0

2 files

0.21.0

2 files

0.20.0

2 files

0.19.1

2 files

0.19.0

2 files

0.18.1

2 files

0.18.0

2 files

0.17.0

2 files

0.16.0

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page