Skip to main content

Swap providers with zero vendor lock-in. For Django SaaS.

Project description

SwapLayer

The Anti-Vendor-Lock-in Framework for Django

One Interface. Any Provider. Zero Rewrites.


What is SwapLayer?

SwapLayer is a unified infrastructure layer for Django that protects you from vendor lock-in.

Instead of coupling your code directly to Stripe, AWS, or Twilio, you write against one consistent interface and swap providers by changing a single configuration line.

The Problem

# ❌ Tightly coupled - if Stripe fails, you rewrite everything
import stripe
customer = stripe.Customer.create(email='user@example.com')

The Solution

# ✅ Provider-agnostic - swap providers in settings
from swap_layer import get_provider
payments = get_provider('payments')
customer = payments.create_customer(email='user@example.com')

Quick Start

1. Install

SwapLayer has optional dependencies - install only what you need:

# Install with specific providers
pip install swaplayer[stripe]        # Just Stripe billing
pip install swaplayer[identity]      # Just WorkOS/Auth0
pip install swaplayer[email,sms]     # Email + SMS

# Or install everything
pip install swaplayer[all]

Available extras:

  • stripe - Stripe payment processing
  • identity - WorkOS/Auth0 OAuth/SSO
  • email - Enhanced email (django-anymail)
  • sms - Twilio/AWS SNS messaging
  • aws - AWS services (S3, SNS)
  • mcp - AI assistant integration
  • all - Everything

2. Configure

# settings.py
from swap_layer.settings import SwapLayerSettings

SWAPLAYER = SwapLayerSettings(
    email={'provider': 'django'},
    payments={'provider': 'stripe', 'stripe': {'secret_key': '...'}},
    sms={'provider': 'twilio', 'twilio': {'account_sid': '...'}},
    storage={'provider': 'django'},
)

3. Use Anywhere

from swap_layer import get_provider

# Email
get_provider('email').send(to='user@example.com', subject='Hello')

# Payments  
get_provider('payments').create_customer(email='user@example.com')

# SMS
get_provider('sms').send(to='+1555555', message='Welcome!')

Features

Module Status Description
Email ✅ Production SMTP, SendGrid, Mailgun, SES
Payments ✅ Production Stripe (PayPal planned)
SMS ✅ Production Twilio, AWS SNS
Storage ✅ Production S3, Azure, GCS, Local
Identity 🚧 Beta OAuth/SSO, KYC Verification
MCP Server ✅ Production AI Assistant Integration

🤖 AI Assistant Integration

SwapLayer includes an MCP (Model Context Protocol) server that exposes provider management as tools for AI assistants:

# Install with MCP support
pip install 'swaplayer[mcp]'

# Run the MCP server
swaplayer-mcp

AI assistants can now help you:

  • Configure and switch providers through conversation
  • Send test emails/SMS to verify integrations
  • Get provider setup instructions and capabilities
  • Inspect your current configuration

Perfect for AI-powered development workflows! → MCP Documentation


📚 Full Documentation

→ docs/ - One doc per module:


Why SwapLayer?

Avoid Vendor Lock-in - Never get trapped by a single provider
Consistent Interface - Same API across all vendors
Type Safe - Pydantic validation catches errors early
Battle Tested - Wraps proven tools (django-storages, django-anymail)
Zero Rewrites - Swap providers with configuration changes only
AI-Powered - Built-in MCP server for AI assistant integration


License

MIT - Because avoiding vendor lock-in should be free.


→ Read Full Documentation

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

swaplayer-0.2.3.tar.gz (146.2 kB view details)

Uploaded Source

Built Distribution

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

swaplayer-0.2.3-py3-none-any.whl (126.6 kB view details)

Uploaded Python 3

File details

Details for the file swaplayer-0.2.3.tar.gz.

File metadata

  • Download URL: swaplayer-0.2.3.tar.gz
  • Upload date:
  • Size: 146.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for swaplayer-0.2.3.tar.gz
Algorithm Hash digest
SHA256 b158c807a3e49a7cf28d105c71947c00c91f95f992a24b0ac9a7efbb415d8816
MD5 5b3f9741c1e733fc6d53e709cc109946
BLAKE2b-256 57ad7920c451b048e3dd7c8a760a4eac72ae6ca55a3f2d64f2bcf78bc9e6b1e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for swaplayer-0.2.3.tar.gz:

Publisher: publish.yaml on Tunet-xyz/swap_layer

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

File details

Details for the file swaplayer-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: swaplayer-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 126.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for swaplayer-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2ad35590c2976f5da35e0d5e80a42d0b86f7182507180465830a11e4cee9c997
MD5 4f9550d686dad8341dc61e80650c7bd4
BLAKE2b-256 2ab7ca490fca8641415ea8c6f2d9a61f8945606ba9f5cf7820ef902ea3740ce2

See more details on using hashes here.

Provenance

The following attestation bundles were made for swaplayer-0.2.3-py3-none-any.whl:

Publisher: publish.yaml on Tunet-xyz/swap_layer

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

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