skills/vendix-backend-auth/SKILL.md
Backend authentication and authorization patterns: global JWT guard, public/optional auth, roles, permissions, and request user shape. Trigger: When implementing authentication, editing auth guards/decorators, or protecting backend endpoints.
npx skillsauth add rzyfront/vendix vendix-backend-authInstall 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 auth and endpoint protection. Use vendix-permissions for permission seed/decorator details and vendix-subscription-gate for subscription write gates.
AppModule registers global guards/interceptors:
ThrottlerGuardJwtAuthGuardStoreOperationsGuardRequestContextInterceptorAuditInterceptorKey file: apps/backend/src/app.module.ts.
JwtAuthGuard is global. Routes require auth unless one of these applies:
OPTIONS.@Public().@OptionalAuth().EventSource cannot send headers.Key files:
apps/backend/src/domains/auth/guards/jwt-auth.guard.tsapps/backend/src/domains/auth/decorators/public.decorator.tsapps/backend/src/domains/auth/decorators/optional-auth.decorator.tsapps/backend/src/domains/auth/strategies/jwt.strategy.tsJwtStrategy.validate() returns a rich req.user object that includes IDs, roles, and permission objects. Permissions are not simple strings; they include route metadata such as name, path, method, and status.
RequestContextInterceptor then copies auth data into RequestContextService for scoped Prisma and downstream services.
@Roles(...) for role constraints.@Permissions(...) for granular backend authorization.PermissionsGuard.Real role enum values include lowercase roles such as super_admin, admin, manager, supervisor, employee, staff, owner, plus CUSTOMER.
| Endpoint Type | Pattern |
| --- | --- |
| Public auth/login/register/password reset | @Public() |
| Public ecommerce read flow | @Public() or optional auth only when intended |
| Admin/store write operations | JWT + permissions/roles + subscription gate as applicable |
| Store write operations | Also consider StoreOperationsGuard and @SkipSubscriptionGate() only when justified |
| Webhooks | Public only if signature/processor auth is implemented |
vendix-permissions - Permission names, seed rows, guard behaviorvendix-subscription-gate - Store write protection by subscription statevendix-multi-tenant-context - Request context propagationvendix-backend-api - Controller endpoint patternsdevelopment
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.