Skip to main content

Digital Asset Marketplace & SaaS Licensing Engine CLI & SDK

Project description

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.

Go 1.23+ Docker Compose NATS JetStream License: MIT

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 -d

Then 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 damsle

Manage your stack with ease:

damsle up      # Start the infrastructure
damsle ps      # Check service status
damsle down    # Stop everything

Option 2: Docker Compose (Manual)

Start all services and infrastructure instantly:

docker compose up -d

Verify services are running:

curl http://localhost:8081/healthz  # Cart
curl http://localhost:8082/healthz  # Payment
curl http://localhost:8083/healthz  # License

Option 2: Local Development

Start infrastructure only:

docker compose up -d nats dragonflydb

Run services (in separate terminals):

cd services/cart && go run ./cmd/server
cd services/payment && go run ./cmd/server
cd services/license && go run ./cmd/server

Serve frontend:

cd web && python3 -m http.server 8080

Option 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.yaml

Usage

1. Manage Cart

  • Interact with the Cart Service on :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 Service on :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 Service on :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.checkoutpayment.completedlicense.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 (stripe or lemonsqueezy)
  • STRIPE_SECRET_KEY / STRIPE_WEBHOOK_SECRET: Stripe credentials
  • LICENSE_KEY_SECRET: HMAC secret for key generation
  • LOG_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_SECRET and 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

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

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

damsle-1.0.0.tar.gz (40.4 kB view details)

Uploaded Source

Built Distribution

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

damsle-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file damsle-1.0.0.tar.gz.

File metadata

  • Download URL: damsle-1.0.0.tar.gz
  • Upload date:
  • Size: 40.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for damsle-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ad3b13aeb0a134c6cb43a1a1bc502c5338e9f1b81c21be57c9f61757b829b3d1
MD5 8b395354f214857807bae9ced1255bcc
BLAKE2b-256 7ca62d14a7d8fb17b22dc52dad95e2bbef18af7cab4b24a8fd353947a93fd77e

See more details on using hashes here.

File details

Details for the file damsle-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: damsle-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for damsle-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40890616467828da203ce9033096982f410ec90cad57b9c48bbcf59e1567c934
MD5 213154969977d44082729e108cad5e74
BLAKE2b-256 601b19983f4d21d7e1147317a9e01ae66c70af95f02022b49bbb4d06b070d71e

See more details on using hashes here.

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