skills/vendix-backend-middleware/SKILL.md
Backend middleware and request-context patterns: ecommerce-only domain resolution, cache-manager usage, domain_context on the request, and AsyncLocalStorage request context population via interceptor. Trigger: When configuring middleware.
npx skillsauth add rzyfront/vendix vendix-backend-middlewareInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
apps/backend/src/common/middleware/domain-resolver.middleware.tsapps/backend/src/common/interceptors/request-context.interceptor.tsapps/backend/src/common/context/request-context.service.tsapps/backend/src/app.module.tsDomainResolverMiddleware is not a generic all-route tenancy resolver. It currently runs only for ecommerce-style requests and exits early unless req.originalUrl contains /ecommerce/.
It resolves store context in this order:
x-store-id header or store_id query param.PublicDomainsService.resolveDomain(hostname).cache-manager.The middleware writes:
req['domain_context'] = { store_id, organization_id? }
It does not write req.store_id / req.organization_id / req.domain_type directly.
RequestContextService is AsyncLocalStorage-based, not request-scoped DI over REQUEST.
RequestContextInterceptor merges auth user data and req['domain_context'].x-request-id into the request context.RequestContextService.asyncLocalStorage.run(contextObj, ...).getStoreId(), getUserId(), getRequestId(), isSuperAdmin().RequestContextService; use the real ALS/static API.vendix-multi-tenant-contextvendix-prisma-scopesvendix-backend-domaindevelopment
Mobile app development rules for Vendix Expo/React Native project. Trigger: When editing, creating, or modifying any file under apps/mobile, or when developing mobile-specific features.
development
Feature gating by store subscription state: global store write guard, AI feature gate, Redis feature resolution, quota consumption, frontend paywall interceptor, banner, and subscription UI states. Trigger: When adding feature gates, paywalls, subscription-based access control, protecting store write operations, AI feature gates, or rollout flags.
testing
SaaS subscription billing for Vendix stores: plan pricing, invoices, Wompi platform payments, manual payments, partner commissions, payouts, proration, and dunning. Trigger: When creating SaaS invoices, working with partner rev-share, margin/surcharge pricing, invoice sequence allocation, partner payout batches, subscription payments, manual payments, or dunning flows.
development
Periodic quota counters with Redis, UTC period keys, Lua-based idempotent AI quota consumption, request-id deduplication, and post-success consumption. Trigger: When building quota counters, enforcing monthly/daily feature caps, or reusing AI quota patterns for uploads, emails, exports, or rate-limited features.