# Integration Patterns

> Choose the right sync strategy for your use case.

URL: https://docs.reaktly.com/docs/integrations/integration-patterns

## Patterns Overview

| Pattern | Best For | Complexity |
|---|---|---|
| **One-time bulk sync** | Initial data import | Low |
| **Webhook-driven** | Real-time updates from CMS/e-commerce | Medium |
| **Scheduled batch sync** | Periodic database exports | Medium |
| **Real-time push** | ORM hooks, CMS afterChange hooks | Low-Medium |

## One-Time Bulk Sync

Use the bulk endpoint for initial data loads:

```ts
const items = await fetchAllFromDatabase();
const batches = chunk(items, 50); // Split into batches of 50

for (const batch of batches) {
  await fetch('https://api.reaktly.com/ingest/bulk', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': API_KEY,
    },
    body: JSON.stringify({ items: batch }),
  });
}
```

## Webhook-Driven

Set up webhooks in your CMS to push updates on content changes. The data flows in real-time without polling.

## Scheduled Batch Sync

Run a cron job to sync changes periodically:

```bash
# Every 6 hours
0 */6 * * * /usr/bin/node /path/to/sync-script.js
```

## Real-Time Push (Hooks)

Use ORM or CMS hooks to push on every save. Best for frameworks like Payload CMS, Strapi, or Prisma.

See [Payload CMS Integration](/docs/integrations/payload-cms) and [Custom Connector](/docs/integrations/custom-connector) for examples.