open-index/open-npm huggingface dataset:
npm package: @gersonresplandes/prisma-guard
Description: **Performance Guardian for Prisma ORM.**
Latest version: 0.0.7

# Prisma Guard 🛡️

**Performance Guardian for Prisma ORM.**

Turn your CI/CD pipeline into an enforcer. Prevent slow queries from reaching production by defining and enforcing Performance SLAs (Budgets) for every database operation.

## Features

- **Auto-Seeder**: Hydrate your database with extensive, referentially integrated mock data for realistic load testing.
- **Performance Monitor ("The Spy")**: Real-time latency measurement for every Prisma query.
- **Assertion Engine ("The Enforcer")**: Block builds (Exit Code 1) if queries breach defined thresholds.

## Installation

```bash
npm install -g @gersonresplandes/prisma-guard
```

## Quick Start

### 1. Initialize
Generate the configuration file `performance.config.ts` in your project root.

```bash
npx prisma-guard init
```

### 2. Configure SLAs
Edit `performance.config.ts` to define your budgets.

```typescript
export const config = {
  thresholds: {
    global: 200, // Max 200ms per query default
    endpoints: {
      'Usuario.count': 1000, // Exception for heavy query
      'Post.findMany': 50,   // Strict limit for hot paths
    }
  },
  failOnBreach: true // Exit with 1 if failed
};
```

### 3. Seed Data (Load Test Prep)
Fill your database with realistic volume to reveal bottlenecks.

```bash
npx prisma-guard seed ./prisma/schema.prisma -c 1000
```

### 4. Audit
Run your queries wrapped in the Enforcer.

```bash
npx prisma-guard audit
```

## CI/CD Integration (GitHub Actions)

Add this to your `.github/workflows/perf.yml`:

```yaml
jobs:
  performance-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: npm ci
      - name: 🛡️ Run Prisma Guard
        run: |
          npx prisma-guard seed ./prisma/schema.prisma -c 1000
          npx prisma-guard audit
        env:
          DATABASE_URL: ${{ secrets.DATABASE_URL }}
```

## License
MIT