Skip to content

How It Works

Architecture Overview

The integration system provides two ways to sync your store data with external systems like Odoo:

  • Pull: Your system requests data from the REST API
  • Push: Tajir sends real-time notifications via Webhooks
Architecture Overview

Key Components

ComponentDescription
REST APIapi.durj.ly/api/v1/* — fetch products, orders, customers, inventory
Event LogEvery data change is recorded in PostgreSQL
Event PollerChecks the event log every 3 seconds, enqueues to BullMQ
BullMQ QueueRedis-backed job queue for reliable delivery
Webhook DispatcherSigns payload with HMAC-SHA256, POSTs to your endpoint

Webhook Delivery Flow

When an event occurs in your store (new order, product update…), here’s what happens:

Webhook Flow

Retry Policy

AttemptDelay
1st retry1 minute
2nd retry5 minutes
3rd retry30 minutes
4th retry2 hours
5th retry12 hours

After 5 failed attempts, the delivery moves to the Dead Letter Queue (DLQ) and can be manually retried from the admin dashboard.

Circuit Breaker

If an endpoint fails 10 consecutive times, it’s automatically paused for 30 minutes to protect your server. It auto-resets on the first successful delivery.


Sync Strategy: Pull vs Push

Data Sync Strategy

Best Approach: Combine Both

  1. Initial sync — Use Pull to import historical data via bulk export endpoints (/export)
  2. Ongoing sync — Use Push (Webhooks) to receive updates in real-time
  3. Periodic reconciliation — Schedule a Pull job hourly to catch any missed events
Terminal window
# Example: Initial product sync
curl -H "Authorization: Bearer tjr_..." \
"https://api.durj.ly/api/v1/products/export" \
-o products.ndjson
# Then rely on Webhooks for real-time updates