skills/vendix-multi-tenant-context/SKILL.md
Backend tenant context bridge from ecommerce domain resolution and JWT user context into AsyncLocalStorage. Trigger: Handling store context, implementing multi-tenant logic, or fixing Forbidden/403 errors in scoped services.
npx skillsauth add rzyfront/vendix vendix-multi-tenant-contextInstall 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.
Use this skill for backend request context: how store/organization/user data reaches RequestContextService and scoped Prisma services.
DomainResolverMiddleware is registered globally, but it only resolves domain context for URLs containing /ecommerce/.x-store-id header or store_id query param.PublicDomainsService.resolveDomain().{ store_id, organization_id? } to req['domain_context'] and continues even if resolution fails.RequestContextInterceptor merges JWT req.user and domain_context into AsyncLocalStorage.Key files:
apps/backend/src/common/middleware/domain-resolver.middleware.tsapps/backend/src/common/interceptors/request-context.interceptor.tsapps/backend/src/common/context/request-context.service.tsuser_id, organization_id, store_id, roles, permissions, and flags first.domain_context.store_id overwrites context.store_id.domain_context.organization_id fills organization_id only when JWT did not provide one.| Service | Scope |
| --- | --- |
| GlobalPrismaService | No tenant scope; use for superadmin/system operations only |
| OrganizationPrismaService | Organization-scoped models |
| StorePrismaService | Store/organization-scoped models |
| EcommercePrismaService | Ecommerce store/customer scoped access |
Model lists change over time. Treat the arrays inside the Prisma scoped service files as canonical instead of copying exhaustive lists into skills.
GlobalPrismaService for tenant data unless the use case is explicitly system-level or the code manually scopes the query.$queryRaw bypass scoped-service extensions; add explicit tenant filters.RequestContextService has a static currentContext fallback; treat it as existing behavior, not a pattern to expand.Check:
organization_id and store_id?x-store-id, store_id query, or host domain resolving correctly?vendix-prisma-scopes - Scoped Prisma model registrationvendix-backend-auth - JWT, public routes, guardsvendix-app-architecture - App/domain conceptsvendix-mcp-server - MCP auth/context injectiondevelopment
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.