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.

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.






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.
Project status and support
Report repository defects through GitHub Issues on the repository; it is provided as a sample with no SLA.