damsle
v1.0.0
Published
**Digital Asset Marketplace & SaaS Licensing Engine**
Readme
DAMSLE
Digital Asset Marketplace & SaaS Licensing Engine
A production-grade, open-source Go boilerplate for building digital asset marketplaces with automated license management. Three decoupled microservices, event-driven architecture, and zero-dependency frontend.
Features
- Clean Architecture: Decoupled microservices (
cart,payment,license) - Event-Driven: Built on NATS JetStream for reliable async messaging
- High Performance: DragonflyDB for ultra-fast caching and distributed locking
- Payment Abstraction: Seamless support for Stripe and LemonSqueezy
- Modern UI: Zero-dependency vanilla HTML/CSS/JS frontend dashboard
Quick Start
Docker Compose:
git clone https://github.com/vyofgod/DAMSLE.git
cd DAMSLE
docker compose up -dThen open http://localhost:8080 for the frontend.
Installation Methods
Option 1: Python CLI & SDK (PyPI)
Install the management tool and developer SDK instantly:
pip install damsleManage your stack with ease:
damsle up # Start the infrastructure
damsle ps # Check service status
damsle down # Stop everythingOption 2: Docker Compose (Manual)
Start all services and infrastructure instantly:
docker compose up -dVerify services are running:
curl http://localhost:8081/healthz # Cart
curl http://localhost:8082/healthz # Payment
curl http://localhost:8083/healthz # LicenseOption 2: Local Development
Start infrastructure only:
docker compose up -d nats dragonflydbRun services (in separate terminals):
cd services/cart && go run ./cmd/server
cd services/payment && go run ./cmd/server
cd services/license && go run ./cmd/serverServe frontend:
cd web && python3 -m http.server 8080Option 3: Kubernetes Deployment
Deploy to your K8s cluster:
kubectl apply -f deploy/k8s/namespace.yaml
kubectl apply -f deploy/k8s/nats/
kubectl apply -f deploy/k8s/dragonflydb/
kubectl apply -f deploy/k8s/cart-service/
kubectl apply -f deploy/k8s/payment-service/
kubectl apply -f deploy/k8s/license-service/
kubectl apply -f deploy/k8s/ingress.yamlUsage
1. Manage Cart
- Interact with the
Cart Serviceon:8081 - Endpoints:
GET /api/v1/cart/{id},POST /api/v1/cart/{id}/items - Perform checkout:
POST /api/v1/cart/{id}/checkout
2. Process Payments
- Handled by
Payment Serviceon:8082 - Verify payment status:
GET /api/v1/payments/{id} - Receives provider webhooks (e.g., Stripe) at
/api/v1/payments/webhook
3. Issue & Validate Licenses
- Governed by
License Serviceon:8083 - Create products:
POST /api/v1/products - Validate issued keys:
POST /api/v1/licenses/validate
Architecture & Specifications
System Design
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Cart │ │ Payment │ │ License │
│ Service │ │ Service │ │ Service │
│ :8081 │ │ :8082 │ │ :8083 │
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
└───────────┬───────┴───────────┬───────┘
│ │
┌─────┴─────┐ ┌──────┴──────┐
│ NATS │ │ DragonflyDB │
│ JetStream │ │ (Redis) │
└───────────┘ └─────────────┘Event Flow
cart.checkout→payment.completed→license.issued
Tech Stack
- Language: Go 1.23
- Cache / Store: DragonflyDB (Redis-compatible)
- Locking: Distributed mutex via
bsm/redislock - Frontend: Vanilla HTML/CSS/JS
Configuration
All configuration is handled via environment variables:
PORT: Service port (8081/8082/8083)NATS_URL: NATS server URL (default:nats://localhost:4222)DRAGONFLY_ADDR: DragonflyDB address (default:localhost:6379)PAYMENT_PROVIDER: Provider choice (stripeorlemonsqueezy)STRIPE_SECRET_KEY/STRIPE_WEBHOOK_SECRET: Stripe credentialsLICENSE_KEY_SECRET: HMAC secret for key generationLOG_LEVEL: Logging verbosity (debug,info,warn,error)
Python SDK Usage
Integrate DAMSLE into your Python applications with ease:
from damsle import DamsleClient
client = DamsleClient("http://localhost:8083")
# Validate a license key
result = client.validate_license(
product_id="my-product-uuid",
license_key="ABCD-1234-EFGH"
)
if result.get("valid"):
print("Welcome, licensed user!")
else:
print(f"Access denied: {result.get('message')}")Important Notes
- Secret Management - Ensure
LICENSE_KEY_SECRETand payment API keys are kept secure - Event Idempotency - Services are designed to handle duplicate events safely
- Data Persistence - DragonflyDB is used for caching, configure persistence if required for production
Links
- GitHub: https://github.com/vyofgod/DAMSLE
- Issues: https://github.com/vyofgod/DAMSLE/issues
Contributing
Contributions welcome! Please submit a Pull Request.
License
MIT License - see LICENSE file for details.
Disclaimer
This software is provided "as is" without warranty. Ensure proper testing in staging environments before deploying to production.
Empowering Digital Commerce with DAMSLE
Version 1.0.0
