The Anti-Vendor-Lock-in Framework for Django. One Interface. Any Provider.
Project description
SwapLayer
The Anti-Vendor-Lock-in Framework for Django
One Interface. Any Provider. Zero Rewrites.
The Origin Story: "Never Again"
2025 was the hardest year of my professional life. I was two weeks away from onboarding a major client when my database provider, FaunaDB, effectively imploded for my use case.
My entire codebase was tightly coupled to their specific SDKs. I didn't just have a "database problem"; I had a "rewrite the whole application" problem. I lost the client. I lost months of work. I lost sleep.
I swore: Never Again.
I realized that "Vendor Lock-in" isn't just a buzzword—it's a business risk. If you import stripe or boto3 or twilio directly into your business logic, you are handing the keys of your architecture to a third party.
I built SwapLayer to ensure that no external vendor failure could ever sink my platform again.
What is SwapLayer?
SwapLayer is a unified infrastructure layer for Django applications.
Instead of stitching together 5 different libraries with 5 different patterns, you install one package that provides a consistent, "Adapter-based" interface for all your external integrations.
It is designed to be the "Firewall" between your clean business logic and the messy world of third-party APIs.
The "Single Package" Philosophy
We believe you shouldn't have to hunt down a dozen micro-libraries to build a standard SaaS. SwapLayer is a cohesive suite:
- One Import:
from swap_layer import get_provider - One Pattern: Consistent
Adapterinterfaces for Auth, Payments, Storage, Email, and SMS. - One Config: Centralized settings.
- Zero Lock-in: Swap underlying vendors by changing ONE line of config.
Architecture: The "Meta-Framework"
We don't reinvent the wheel. We make the wheel interchangeable.
SwapLayer uses a Wrapper Pattern to leverage the best existing tools while enforcing a unified API.
| Domain | Strategy | Underlying Tech | The Value |
|---|---|---|---|
| Storage | Wrapper | django-storages |
Unified interface for S3, Azure, GCloud, Local. |
| Wrapper | django-anymail |
Unified interface for SendGrid, Mailgun, SES. | |
| Payments | Custom | Stripe / PayPal | The Missing Link. A unified Payment Adapter that Django lacks. |
| Identity | Custom | Auth0 / WorkOS | Lightweight OIDC/OAuth abstraction. |
| SMS | Custom | Twilio / SNS | Simple, consistent messaging interface. |
Usage Example
1. The Old Way (The "Risk" Way)
Tightly coupled code that breaks if you switch vendors.
# views.py
import stripe
import boto3
def signup(request):
# Direct dependency on Stripe!
customer = stripe.Customer.create(email=request.user.email)
# Direct dependency on AWS!
s3 = boto3.client('s3')
s3.upload_file(...)
2. The SwapLayer Way (The "Safe" Way)
Vendor-agnostic code. The "Provider" is injected based on settings.
# views.py
from infrastructure.payments.factory import get_payment_provider
from infrastructure.storage.factory import get_storage_provider
def signup(request):
# Code doesn't know if it's Stripe or PayPal
payments = get_payment_provider()
customer = payments.create_customer(email=request.user.email)
# Code doesn't know if it's S3 or Azure
storage = get_storage_provider()
storage.upload_file(...)
Installation
# Install the core framework
pip install swap-layer
# Install with specific provider support (Optional Dependencies)
pip install swap-layer[stripe,aws,sendgrid]
Configuration
# settings.py
# Switch providers instantly. No code changes required.
PAYMENT_PROVIDER = 'stripe' # or 'paypal'
STORAGE_PROVIDER = 'django' # uses django-storages backend
EMAIL_PROVIDER = 'django' # uses django-anymail backend
Status
- Storage: ✅ Production Ready (Wraps
django-storages) - Email: ✅ Production Ready (Wraps
django-anymail) - Payments: 🚧 Beta (Stripe implemented, PayPal planned)
- Identity: 🚧 Beta (Auth0 implemented)
License
MIT. Because safety should be free.
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 swaplayer-0.1.0.tar.gz.
File metadata
- Download URL: swaplayer-0.1.0.tar.gz
- Upload date:
- Size: 77.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c068c385ca31bd0ffda9874b0a1a3162dccb7326f13b5901992484ca3095c1fe
|
|
| MD5 |
7bab6d0f6c9bf54734a881cb8d5822d4
|
|
| BLAKE2b-256 |
541aadefeda442fcc55483d881e14df57604987ffdc1c2ffddbd7c755863ff4b
|
Provenance
The following attestation bundles were made for swaplayer-0.1.0.tar.gz:
Publisher:
publish.yaml on Tunet-xyz/swap_layer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swaplayer-0.1.0.tar.gz -
Subject digest:
c068c385ca31bd0ffda9874b0a1a3162dccb7326f13b5901992484ca3095c1fe - Sigstore transparency entry: 797539694
- Sigstore integration time:
-
Permalink:
Tunet-xyz/swap_layer@c44977191e4cfb6639e4ed50925e20d463a4bd21 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Tunet-xyz
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@c44977191e4cfb6639e4ed50925e20d463a4bd21 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file swaplayer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: swaplayer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 105.2 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 |
d85945bcaf6ceb861af25402b5e0db8f6476f7adec948e4b7e269bb6a105df05
|
|
| MD5 |
402cb6e9c94a3b55e3118aa82479797c
|
|
| BLAKE2b-256 |
26b50ddd851f396f8ea3e4b7ec54842f7ea6052c218f634bb2a18bde64141d94
|
Provenance
The following attestation bundles were made for swaplayer-0.1.0-py3-none-any.whl:
Publisher:
publish.yaml on Tunet-xyz/swap_layer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swaplayer-0.1.0-py3-none-any.whl -
Subject digest:
d85945bcaf6ceb861af25402b5e0db8f6476f7adec948e4b7e269bb6a105df05 - Sigstore transparency entry: 797539697
- Sigstore integration time:
-
Permalink:
Tunet-xyz/swap_layer@c44977191e4cfb6639e4ed50925e20d463a4bd21 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Tunet-xyz
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@c44977191e4cfb6639e4ed50925e20d463a4bd21 -
Trigger Event:
workflow_dispatch
-
Statement type: