vendix-backend-middleware

Configure DomainResolverMiddleware for multi-tenant NestJS backends with Prisma.

5|Updated Aug 23, 2025
One-click install
npx skills add https://github.com/Rzyfront/Vendix --skill vendix-backend-middleware
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vendix-backend-middleware
Source: https://github.com/Rzyfront/Vendix/tree/main/skills/vendix-backend-middleware
Command: npx skills add https://github.com/Rzyfront/Vendix --skill vendix-backend-middleware

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill configures and wires DomainResolverMiddleware to support dynamic domain resolution, multi-tenancy, and per-request context for Vendix backend services.

Core Features & Use Cases

  • Domain resolution: Detects store, organization, or vendix_core domains from the request host and injects store_id, organization_id, and domain_type into the request context.
  • Caching: Uses an LRU cache to minimize database lookups for frequent domain resolutions.
  • Request-scoped context: Works with Prisma and NestJS to expose per-request context to controllers and services.

Quick Start

Integrate the middleware into AppModule and start the NestJS server. Then send requests to subdomains like tienda.tiendavendix.com to verify the injected context.

Frequently Asked Questions about vendix-backend-middleware

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure multi-tenant middleware in NestJS for dynamic subdomain resolution?

Configure multi-tenant middleware in NestJS by applying DomainResolverMiddleware globally to intercept requests, resolve subdomains, and inject tenant identifiers into the request context. This automates wiring for dynamic domain detection without manual route handlers.

How does domain resolution cache work with Prisma in a multi-tenant backend?

Domain resolution caching uses an LRU cache to store resolved domains, minimizing Prisma database lookups for frequent subdomain requests. This reduces database load by serving cached tenant identifiers like store_id and organization_id directly from memory.

Can I inject request-scoped context like store_id and organization_id into NestJS controllers?

Yes, the middleware injects store_id, organization_id, and domain_type into the request-scoped context. This exposes tenant identifiers to NestJS controllers and services, enabling Prisma queries scoped to the specific store or organization making the request.

What is the best way to detect store, organization, and core domains from request hosts in a Vendix backend?

The best way to detect domains is using middleware that parses the request host to identify store, organization, or vendix_core domains. It automatically categorizes the domain type and injects the corresponding tenant IDs into the request context.

Do I need Prisma integration to use multi-tenant middleware for subdomain routing?

Yes, Prisma integration is required because the middleware relies on Prisma to perform initial database lookups for domain resolutions. Resolved tenant identifiers are cached in an LRU cache to minimize repeated Prisma queries for subsequent requests.