Skip to main content

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.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 (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

Release files for damsle 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for damsle 1.0.0
File Size Uploaded
damsle-1.0.0.tar.gz 40.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for damsle 1.0.0
File Interpreter ABI Platform
damsle-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 46.6 kB

Release files / damsle-1.0.0.tar.gz

Download URL damsle-1.0.0.tar.gz
Size 40.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ad3b13aeb0a134c6cb43a1a1bc502c5338e9f1b81c21be57c9f61757b829b3d1
BLAKE2b-256 checksum
How to use checksums
7ca62d14a7d8fb17b22dc52dad95e2bbef18af7cab4b24a8fd353947a93fd77e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / damsle-1.0.0-py3-none-any.whl

Download URL damsle-1.0.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40890616467828da203ce9033096982f410ec90cad57b9c48bbcf59e1567c934
BLAKE2b-256 checksum
How to use checksums
601b19983f4d21d7e1147317a9e01ae66c70af95f02022b49bbb4d06b070d71e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page