PluginBench
Rule

database

via PatrickJS/awesome-cursorrules

Database best practices for Prisma and Supabase integration

What is database?

Guidance on setting up and managing databases with Prisma ORM and Supabase, covering schema design, query optimization, security policies, and performance considerations. Use this rule when building database layers with Prisma models or Supabase backends.

  • Configure Prisma schema design, migrations, relations, and client setup
  • Define Prisma models with proper naming, field types, indexes, and constraints
  • Optimize Prisma queries with filtering, relation loading, transactions, and pagination
  • Set up Supabase projects with authentication, RLS policies, and storage configuration
  • Implement database security through authentication, authorization, encryption, and backups
  • Apply performance optimization including connection pooling, caching, and N+1 query prevention

Applies to

File patterns this rule matches.

prisma/**/*
src/db/**/*
**/*.prisma
supabase/**/*
Rule definition (reference)

Source of truth, from the repository.

Database Best Practices

Prisma Setup

  • Use proper schema design
  • Implement proper migrations
  • Use proper relation definitions
  • Configure proper connection
  • Implement proper seeding
  • Use proper client setup

Prisma Models

  • Use proper model naming
  • Implement proper relations
  • Use proper field types
  • Define proper indexes
  • Implement proper constraints
  • Use proper enums

Prisma Queries

  • Use proper query optimization
  • Implement proper filtering
  • Use proper relations loading
  • Handle transactions properly
  • Implement proper pagination
  • Use proper aggregations

Supabase Setup

  • Configure proper project setup
  • Implement proper authentication
  • Use proper database setup
  • Configure proper storage
  • Implement proper policies
  • Use proper client setup

Supabase Security

  • Implement proper RLS policies
  • Use proper authentication
  • Configure proper permissions
  • Handle sensitive data properly
  • Implement proper backups
  • Use proper encryption

Supabase Queries

  • Use proper query optimization
  • Implement proper filtering
  • Use proper joins
  • Handle real-time properly
  • Implement proper pagination
  • Use proper functions

Database Design

  • Use proper normalization
  • Implement proper indexing
  • Use proper constraints
  • Define proper relations
  • Implement proper cascades
  • Use proper data types

Performance

  • Use proper connection pooling
  • Implement proper caching
  • Use proper query optimization
  • Handle N+1 queries properly
  • Implement proper batching
  • Monitor performance metrics

Security

  • Use proper authentication
  • Implement proper authorization
  • Handle sensitive data properly
  • Use proper encryption
  • Implement proper backups
  • Monitor security issues

Best Practices

  • Follow database conventions
  • Use proper migrations
  • Implement proper versioning
  • Handle errors properly
  • Document schema properly
  • Monitor database health

Related rules

Senior full-stack TypeScript, React, Node.js guidance with clean architecture, testing, and WHY-oriented reasoning.

**/*
41k
via PatrickJS/awesome-cursorrules

Quantitative factor research skills for designing, evaluating, and mining alpha factors in equities markets.

**/*
41k
via PatrickJS/awesome-cursorrules

Android development with Jetpack Compose, clean architecture, and Material Design 3.

**/*
41k
via PatrickJS/awesome-cursorrules

Angular development with Novo Elements UI library using standalone components.

**/*
41k
via PatrickJS/awesome-cursorrules

Expert Angular 18 + TypeScript development with Jest, emphasizing clean code and performance.

**/*
41k
via PatrickJS/awesome-cursorrules

Manage Kubernetes clusters, add-ons, stacks, and credentials via the Ankra CLI platform.

**/*.sh +5
41k
via PatrickJS/awesome-cursorrules