auth-svc Cursor Rules — Cursor Rules | Neura Market
    Neura MarketNeura Market/Cursor
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeek
    CoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    View All Directories
    OverviewRulesPromptsMCPsAgentsBlogVideosGuidesCoursesCommunityExtensionsTrendingGenerate
    CursorRulesauth-svc Cursor Rules
    Back to Rules
    Database

    auth-svc Cursor Rules

    janovix April 15, 2026
    0 copies 0 downloads

    This service has a **hybrid column naming convention** due to Better Auth's requirements:

    Rule Content
    # Auth-SVC Cursor Rules
    
    ## Database Column Naming Convention - IMPORTANT EXCEPTION
    
    This service has a **hybrid column naming convention** due to Better Auth's requirements:
    
    ### Better Auth Managed Tables (camelCase columns)
    Better Auth generates its own SQL queries that **bypass Prisma's `@map` directives**. 
    These tables MUST use camelCase column names in the database:
    
    | Table | Example Columns |
    |-------|----------------|
    | `users` | `emailVerified`, `banReason`, `banExpires`, `createdAt`, `updatedAt` |
    | `sessions` | `expiresAt`, `ipAddress`, `userAgent`, `activeOrganizationId`, `impersonatedBy`, `userId` |
    | `accounts` | `accountId`, `providerId`, `userId`, `accessToken`, `refreshToken`, `idToken`, `accessTokenExpiresAt` |
    | `verifications` | `expiresAt`, `createdAt`, `updatedAt` |
    | `jwks` | `publicKey`, `privateKey`, `createdAt`, `expiresAt` |
    | `organizations` | `createdAt`, `updatedAt`, `status`, `archivedAt`, `archivedReason` (archive fields applied in `0002_org_archive_user_overage.sql`) |
    | `members` | `organizationId`, `userId`, `createdAt`, `updatedAt` |
    | `invitations` | `organizationId`, `inviterId`, `expiresAt`, `createdAt`, `updatedAt` |
    
    **DO NOT add `@map` directives to these models in `schema.prisma`** - they will be ignored by Better Auth.
    
    ### Custom Auth-SVC Tables (snake_case columns)
    Tables that are NOT managed by Better Auth use standard snake_case via `@map` directives:
    
    | Table | Example Columns |
    |-------|----------------|
    | `organization_settings` | `organization_id`, `date_format`, `avatar_url`, `created_at` |
    | `user_settings` | `user_id`, `date_format`, `avatar_url`, `payment_methods` |
    | `audit_logs` | `event_type`, `entity_type`, `actor_user_id`, `created_at` |
    | `subscription_plans` | `billing_interval`, `stripe_price_id`, `base_price`, `notices_included` |
    | `organization_subscriptions` | `organization_id`, `stripe_customer_id`, `plan_id`, `current_period_start` |
    | `enterprise_licenses` | `organization_id`, `license_key`, `notices_per_month`, `issued_at` |
    | `usage_records` | `organization_id`, `subscription_id`, `period_start`, `notices_created` |
    
    **Always use `@map("snake_case")` directives in Prisma for these models.**
    
    ## Why This Exception Exists
    
    Better Auth's Prisma adapter generates raw SQL queries using the Prisma model field names directly, 
    completely bypassing Prisma's column mapping layer. This is a known limitation of Better Auth.
    
    Options considered:
    1. ✅ **Accept camelCase for Better Auth tables** (chosen) - Works with the library, not against it
    2. ❌ **Force snake_case everywhere** - Would require forking/patching Better Auth
    
    ## Migration File Convention
    
    - `migrations/0001_initial.sql` — baseline full schema for D1 (regenerate from `prisma/schema.prisma` via `pnpm exec prisma migrate diff --from-empty --to-schema-datamodel prisma/schema.prisma --script`, then merge with the existing `DROP TABLE IF EXISTS` preamble and ordering). New environments apply 0001 then later files in order.
    - `migrations/0002_*.sql` and onward — additive changes only (`ALTER TABLE`, new tables, indexes). Do not fold already-deployed deltas back into 0001 once shipped, or remote DBs that already ran the old 0001 will drift.
    
    Prisma `schema.prisma` reflects the **post-migration** shape; SQL history stays in numbered migration files.
    
    ## Testing After Schema Changes
    
    Always run after any schema changes:
    ```bash
    pnpm run seedLocalDb     # Apply migrations to local D1
    pnpm prisma generate     # Regenerate Prisma client
    pnpm typecheck           # Verify types
    pnpm lint                # Check linting
    pnpm test                # Run tests (may skip on Windows)
    ```
    

    Tags

    prisma

    Comments

    More Rules

    View all
    Web Development

    Next.js 15 + TypeScript Cursor Rules

    Comprehensive .cursorrules file for Next.js 15 App Router projects with TypeScript, enforcing server components by default, proper use of "use client" directive, and App Router conventions.

    C
    Community
    Backend Development

    Python FastAPI Best Practices Rules

    Cursor rules for Python FastAPI projects enforcing async patterns, Pydantic v2 models, dependency injection, and proper error handling.

    C
    Community
    Frontend Development

    React + TypeScript Component Rules

    Rules for consistent React component development with TypeScript interfaces, proper hook patterns, and component composition.

    C
    Community
    AI/ML

    Cursor Agent Mode Configuration

    Rules optimizing Cursor Agent mode behavior including multi-file editing context, session management, and autonomous task completion patterns.

    C
    Cursor Team
    Frontend Development

    Tailwind CSS + shadcn/ui Rules

    Cursor rules for projects using Tailwind CSS with shadcn/ui component library, enforcing consistent utility class usage and component patterns.

    C
    Community
    Backend Development

    Go Backend Service Rules

    Rules for Go backend services enforcing idiomatic Go patterns, proper error handling, and clean architecture conventions.

    C
    Community

    Stay up to date

    Get the latest Cursor prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for Cursor and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Guides

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.