All projects
SampleSample · unsupportedUnsupported · no SLA

Diffusers Multi-Tenant LoRA Serving

Multi-tenant LoRA serving sample (Next.js 16 + FastAPI) that keeps every tenant's Diffusers LoRA adapters in Backblaze B2 through the S3-compatible API and loads them per request onto one shared SDXL base model, using stateless GPU workers, presigned fetches, verified caches and tenant isolation.

Built for: Developers serving image generation to many customers from a pool of shared GPU workers, where each customer brings their own LoRA styles, and AI coding agents extending the repository.

MIT licensed · Updated Nov 27, 2026

Dashboard with tenant, adapter, job, worker and cache-hit metrics, a load versus generate time chart and recent jobs
Tenants, adapter versions in B2, jobs, workers online and cache hit rate, with fetch, load, generate and unload timings and recent jobs per tenant.

What it's built with

Each piece of the stack, and the job it does in this project.

Next.js 16 + React 19
Web dashboard UI
Tailwind CSS v4 + shadcn/ui + TanStack Query + Recharts
Design tokens, interface primitives, data fetching and timing charts
FastAPI (Python 3.12) + SQLite
Dispatcher: adapter registry, tenant-scoped resolution, leased job queue and presigned URLs
PyTorch + Diffusers + PEFT
Stateless GPU workers that load and unload LoRA adapters on one SDXL base model
boto3 (S3-compatible API)
Backblaze B2 storage for adapters, manifests, outputs and reports
pnpm workspaces
Monorepo for the web app, API, worker and shared types

Core capabilities

What the project does out of the box, before you write any code of your own.

  • Adapter registry

    Publish, version, edit, verify and delete tenant LoRA adapters, with the weight written first and the tenant manifest rewritten last.

  • Tenant-scoped serving

    Every request resolves through the requesting tenant's own manifest; another tenant's adapter is rejected before any job or URL exists.

  • Credential-free workers

    Workers receive a short-lived presigned URL for exactly one adapter, verify its sha256 into a tenant-scoped cache, load it, generate and unload it.

  • Worker recovery

    Jobs carry a lease and a fixed seed, so a killed worker's job is re-rendered by another worker and the late result is rejected.

  • Generate and compare

    Generate per tenant and adapter, or compare adapters on the same prompt and seed.

  • Runs and timing reports

    Jobs grouped by run, with an adapters.json report in B2 recording fetch, load, generate and unload times and cache hits.

  • Library and bucket explorer

    Browse adapters, outputs and reports under the app prefix, and preview or download any object in the bucket.

A closer look

More screens from the running project.

Adapter registry listing each tenant's LoRA adapters with version, scale, license and size
Every tenant's LoRA adapters in B2, with current version, scale, license and size, plus publish actions.
Papercut adapter detail for tenant globex with generate form, versions, manifest entry and recent jobs
One tenant's adapter with a tenant-scoped generate form, immutable checksummed versions, its B2 manifest entry and recent jobs.
Generate page with tenant, adapter and version pickers and a compare adapters form
Generate as a tenant through one of its adapters, try the tenant isolation check, or compare adapters on the same prompt and seed.
Runs list with run IDs, creation times, job counts, states and adapters.json reports
Jobs grouped by run, each with its adapters.json timing report written to B2.
Run detail showing a papercut fox image generated for globex with checksum, cache and timing data
The generated image labelled with its tenant and adapter, the verified sha256, cache hit, unload result and the run's timing report.
Library outputs tab with a grid of generated images labelled by tenant and run
Everything the app wrote under its B2 prefix, here the generated outputs labelled by tenant and run.

Choose it for the right job

Diffusers Multi-Tenant LoRA Serving is a head start for a specific shape of project, not a supported, general-purpose product.

Use it when

  • You serve image generation to many customers from shared GPU workers and each customer brings their own LoRA adapters.
  • You want one base model in memory and adapters fetched on demand from object storage, verified by checksum and cached per tenant.
  • You need a hard guarantee that a request can only load its own tenant's adapter, with cross-tenant requests rejected before work is queued.
  • You want GPU workers that hold no storage credentials and can be added, replaced or killed without losing jobs.

Choose another path when

  • You need authentication: the tenant in a request is trusted as given, so production needs an authenticating gateway in front.
  • You need a training pipeline, a general model-hub cache, a ComfyUI integration, an autoscaler or a GPU scheduler.
  • You need several dispatchers: one dispatcher owns manifest writes and the SQLite queue, so scaling it out needs a shared queue and lock.
  • You want a hosted or serverless deployment: workers need a local NVIDIA GPU or Apple silicon, and there is no one-click deploy.
  • You only need to sync a Hugging Face model cache with B2: see hf-cache-sync.
Sample · unsupported

Project status and support

Report repository defects through GitHub Issues on the repository; it is provided as a sample with no SLA.