# How it works

> Source site → crawler → product pool → rules → XML/API and Trendyol/Temu. A step-by-step technical explanation of the Giyimport data flow.

The Giyimport data flow has five layers. Each consumes the previous one's output and every step is visible in the panel.

## Architecture

Source sites → Crawler → Product pool → Rules → XML / API · Trendyol / Temu

## Step by step

1. **Crawl the source site** — The crawler reads the supplier's product list and product pages and extracts products, variants, stock, prices and images.
2. **Write to the product pool** — The pool updates changed records, adds price changes to price history and downloads images to our own server.
3. **Apply rules** — The pricing rule computes the sale price; the active rule deactivates sold-out or blocked products; plan scope defines which products a customer can see.
4. **Publish** — Products are served through the API and XML feed, limited to active products in the key owner's plan scope.
5. **Push to marketplaces** — Stock (and optionally price) computed from the pool is pushed to connected Trendyol and Temu stores; orders are pulled back and open quantities deducted from the pool.

## Components

| Component | Role |
| --- | --- |
| Crawler | Scheduled, resumable site crawls |
| Product pool (PostgreSQL) | Products, variants, images, attributes, price history |
| Rules | Pricing, active state, plan/category scope |
| API and XML | Key-based authentication, quota, request log |
| Marketplace service | Matching, stock/price push, order import, recipient data encryption |
| Panel | Role-based screens, audit log, user and plan management |
