# @prood/types (https://prood.com/docs/packages/types)

`@prood/types` is the **shared vocabulary** for all Prood packages. It contains TypeScript interfaces and types only — no runtime code, no dependencies.

## Installation [#installation]

Workspace package. Available from the source repo for now.

Already included as a dependency of `@prood/commerce`, `@prood/platform`, and `@prood/ui`.

## Domain types [#domain-types]

### Catalog [#catalog]

```ts
import type {
  Product,
  ProductVariant,
  Category,
  Brand,
  SearchResult,
  SearchParams,
} from '@prood/types'
```

### Cart & checkout [#cart--checkout]

```ts
import type {
  Cart,
  CartItem,
  CartTotals,
  ShippingMethod,
  PaymentMethod,
  Address,
  CustomerInfo,
} from '@prood/types'
```

### Orders [#orders]

```ts
import type {
  Order,
  OrderItem,
  OrderStatus,
  FulfillmentStatus,
} from '@prood/types'
```

### Store & customers [#store--customers]

```ts
import type { StoreInfo, Customer, Country } from '@prood/types'
```

## Adapter interfaces [#adapter-interfaces]

```ts
import type {
  CommerceAdapter,
  CatalogAdapter,
  CartAdapter,
  CheckoutAdapter,
  OrdersAdapter,
  CustomersAdapter,
  StoreAdapter,
} from '@prood/types'
```

Implement these to create a custom commerce backend adapter.

## Provider interfaces [#provider-interfaces]

```ts
import type {
  PaymentProvider,
  PaymentSession,
  CreatePaymentSessionInput,
  RefundInput,
  PaymentWebhookEvent,
  StorageProvider,
  UploadInput,
  UploadResult,
} from '@prood/types'
```

## Error handling [#error-handling]

```ts
import { CommerceError, toErrorResponse } from '@prood/types'

// Throw structured errors
throw new CommerceError('Product not found', 'NOT_FOUND', 404)

// Convert to HTTP response
const { status, body } = toErrorResponse(err)
// body: { code: 'NOT_FOUND', message: 'Product not found' }
```

## Admin types [#admin-types]

Input/output types for dashboard and admin API operations:

```ts
import type {
  CreateProductInput,
  UpdateProductInput,
  DashboardStats,
  FulfillOrderInput,
  RefundOrderInput,
} from '@prood/types'
```

## Specialized domains [#specialized-domains]

Types for advanced commerce patterns:

```ts
import type {
  ReturnRequest,
} from '@prood/types'
```

## Package structure [#package-structure]

```mermaid
flowchart TB
  IDX[index.ts]
  PRODUCT[product.ts]
  CART[cart.ts]
  ORDER[order.ts]
  CUSTOMER[customer.ts]
  STORE[store.ts]
  ADAPTER[adapter.ts]
  PAYMENT[payment.ts]
  STORAGE[storage.ts]
  ERROR[error.ts]
  ADMIN[admin.ts]
  SPEC[specialized/]

  IDX --> PRODUCT & CART & ORDER & CUSTOMER & STORE & ADAPTER & PAYMENT & STORAGE & ERROR & ADMIN & SPEC
```

## Related pages [#related-pages]

<Cards>
  <Card title="Unified types (architecture)" href="/docs/architecture/unified-types" description="Conceptual overview of the type system." />
  <Card title="@prood/platform" href="/docs/packages/platform" description="Built-in adapter implementing these interfaces." />
</Cards>
