QueryPerf intercepts bad database code at the moment it's written. By auditing your Prisma schema alongside your TypeScript queries, QueryPerf catches structural performance anti-patterns (like N+1 queries and missing indexes) before they ever reach production.
Designed specifically to catch common mistakes made by AI code generators and junior developers.
- 🚨 N+1 Query Detection: Automatically identifies queries inside loops (
for/map/forEach) that should be refactored into batch operations or.include(). - 🔍 Missing Index Detection: Scans
.findUnique,.findFirst, and.whereclauses against yourschema.prismato catch slow queries missing proper@uniqueor@@indexattributes. - 📦 Select-Star Bloat: Flags queries fetching massive payloads without using
selectto narrow down the returned columns. - 📄 Unpaginated List Risk: Detects
.findMany()calls lackingtakeorskiplimits. - 💥 Cascade Risk: Identifies
deleteoperations on tables with cascading relations that could cause unintended data loss.
The best way to use QueryPerf is to run it on every Pull Request to prevent bad queries from merging into your main branch.
Add this workflow file to your repository at .github/workflows/queryperf.yml:
name: Database Performance Audit
on:
pull_request:
branches: [ main ]
jobs:
audit:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run QueryPerf Audit
uses: WebToolkit-Pro/[email protected]
with:
# Path to your Prisma schema (default: ./prisma/schema.prisma)
schema-path: './prisma/schema.prisma'
# Glob pattern for files containing Prisma queries (default: src/**/*.ts)
query-glob: 'src/**/*.ts'| Input | Description | Default |
|---|---|---|
schema-path |
Path to your Prisma schema file | ./prisma/schema.prisma |
query-glob |
Glob pattern to find files containing Prisma queries | src/**/*.ts |
We also provide a sleek, terminal-inspired web interface for live code analysis. You can paste your schema and queries directly into the browser to get an instant audit report.
Try the live sandbox: queryperf-git-main-netizenlabs.vercel.app
To run the web interface locally:
# 1. Install dependencies
npm install
# 2. Start the development server
npm run dev
# 3. Open http://localhost:3000This project is licensed under the MIT License.