# MiniProfiler

**Kind:** Service

**Source:** `Pams/API/Pams.API/Pams.API.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

MiniProfiler is a NuGet package dependency declared by the Pams.API project. It records request timing data in the API process and can expose profiling information for diagnostics during API calls.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant API as Pams.API
    participant Profiler as MiniProfiler
    participant Database

    Client->>API: Send API request
    API->>Profiler: Start request profiling
    API->>Database: Execute data operation
    Database-->>API: Return data
    API->>Profiler: Record operation timing
    API-->>Client: Return response with profiling metadata
```

## Usage

```ts
const response = await fetch("/api/customers", {
  headers: {
    Accept: "application/json",
  },
});

const customers = await response.json();

const profilerIds = response.headers.get("X-MiniProfiler-Ids");

console.log({ customers, profilerIds });
```

## AI Coding Instructions

- Treat MiniProfiler as a server-side dependency of the Pams.API project; client code should only read profiling metadata when it is present.
- Check the API startup and middleware configuration before changing profiler behavior, since the project file only declares the package dependency.
- Do not make application behavior depend on profiling headers or profiling output.
- Preserve the existing package reference format in `Pams.API.csproj` when updating the dependency.
