Reusable integration framework for external service connectors (shops, couriers, payments, messaging, storage)
Project description
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 | EuPlatesc, LibraPay, Netopia, Stripe | 4 |
| Messaging | GoIP, RoboSMS, SMTP Email, Telegram, WhatsApp | 5 |
| 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 |
| Total | 37 |
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 syncCourierPort— AWB generation, tracking, shipment managementPaymentPort— checkout sessions, payment status, refundsMessagingPort— send messages (SMS, email, WhatsApp, Telegram), reply to inboundStoragePort— 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 updatesWebhookCapability— signature verification, webhook parsingOAuthCapability— OAuth2 flow (authorize, exchange, refresh)InvoiceAttachmentCapability— attach invoices to ordersProductFeedCapability— generate product feedsEmbeddingCapability— text embeddings for RAG/searchTranscriptionCapability— audio-to-text (Whisper)StreamingCapability— streaming LLM responsesImageGenerationCapability— AI image generation
Feature discovery: adapter.supports(BulkUpdateCapability)
Normalized DTOs
All providers return the same data types:
Order,OrderItem,OrderStatus,PaymentStatusProduct,ProductUpdate,ProductCategoryShipment,AWBLabel,TrackingEventCheckoutSession,PaymentResult,RefundOutboundMessage,InboundMessage,DeliveryReportChatMessage,LLMResponse,TokenUsage,ModelInfo,ToolCallEmbeddingResult,TranscriptionResult,ImageResultContact,AddressPaginatedResult[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
- Provider Development Guide — How to add a new provider or create a new family
- Django Integration Guide — How to use the Django package
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/ # EuPlatesc, LibraPay, Netopia, Stripe
│ ├── messaging/ # GoIP, RoboSMS, SMTP Email, 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
<!-- 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
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 bapp_connectors-0.3.0.tar.gz.
File metadata
- Download URL: bapp_connectors-0.3.0.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fd9b47c18335b2a989a5391dadee0ccab530c214c3ecb209e622e6c989c9d89
|
|
| MD5 |
362c07be43797e35939f6f1ef2527583
|
|
| BLAKE2b-256 |
7115aaa2441177ca614563626b2ddad0aec7919cd0e96698b1a664c1f2abc52f
|
Provenance
The following attestation bundles were made for bapp_connectors-0.3.0.tar.gz:
Publisher:
publish.yml on bapp-open/bapp-connectors
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bapp_connectors-0.3.0.tar.gz -
Subject digest:
6fd9b47c18335b2a989a5391dadee0ccab530c214c3ecb209e622e6c989c9d89 - Sigstore transparency entry: 1197250036
- Sigstore integration time:
-
Permalink:
bapp-open/bapp-connectors@3adde69964b4394c35e03fc7bffa3c763bd95b30 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/bapp-open
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3adde69964b4394c35e03fc7bffa3c763bd95b30 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bapp_connectors-0.3.0-py3-none-any.whl.
File metadata
- Download URL: bapp_connectors-0.3.0-py3-none-any.whl
- Upload date:
- Size: 445.6 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 |
71f43e58a1e08599c2bbdec7bc0f3b7d516b41e0fe3046782070464821204c78
|
|
| MD5 |
f942aac009e845d6c9ea46ef77ccafb7
|
|
| BLAKE2b-256 |
043e688c0758caea154e784899c0f000574ed0ed7c58d34dcd8d43693f7bd7f1
|
Provenance
The following attestation bundles were made for bapp_connectors-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on bapp-open/bapp-connectors
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bapp_connectors-0.3.0-py3-none-any.whl -
Subject digest:
71f43e58a1e08599c2bbdec7bc0f3b7d516b41e0fe3046782070464821204c78 - Sigstore transparency entry: 1197250049
- Sigstore integration time:
-
Permalink:
bapp-open/bapp-connectors@3adde69964b4394c35e03fc7bffa3c763bd95b30 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/bapp-open
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3adde69964b4394c35e03fc7bffa3c763bd95b30 -
Trigger Event:
push
-
Statement type: