An enterprise-grade, decoupled microservices system designed to autonomously discover official laptop configurations from brand manufacturer portals in Egypt (ASUS, Lenovo, HP, Dell, Acer, GigaByte), crawl live market inventories from leading Egyptian retailers (Compumarts, Sigma Computer, 2B Egypt), and provide structured data persistence, entity resolution, and intelligent consumer recommendations.
The consumer laptop market in Egypt presents a uniquely challenging landscape for buyers, retailers, and data systems:
Ω Ω‘Ω’Ω£Ω€Ω₯Ω¦Ω§Ω¨Ω©), with no unified naming standards.This project solves these challenges by establishing an autonomous, decoupled microservices pipeline:
flowchart TD
subgraph Manufacturer Portals ["Official Brand Portals (Egypt)"]
ASUS["ASUS Egypt Store"]
LENOVO["Lenovo Egypt"]
HP["HP Egypt"]
DELL["Dell Egypt"]
ACER["Acer Egypt"]
GIGA["GigaByte Egypt"]
end
subgraph Retailer Stores ["Egyptian Retailer Stores"]
COMP["Compumarts Egypt"]
SIGMA["Sigma Computer"]
TWOB["2B Egypt"]
end
subgraph ScraperService ["scraper-service (Pure Ingestion Engine)"]
ENG["ScraplingEngine (Stealth Chrome / Anti-Bot)"]
L1["Level 1: Fast Catalog Discovery (Cards)"]
L2["Level 2: Deep Spec & SKU Crawl (/techspec/)"]
WM["Watermark Cursor Engine (until_model)"]
STORE_ENG["Store Crawlers (Compumarts, Sigma, 2B)"]
end
subgraph StandaloneArtifacts ["Standalone Ingestion JSON Artifacts"]
JSON_BRAND["brand_{brand}.json (Official Specs & SKUs)"]
JSON_STORE["store_{store}.json (Raw Store Inventory & Prices)"]
end
subgraph CatalogService ["catalog-service (Business Layer & Database)"]
RAW_INGEST["Raw Payload Ingestion Pipeline"]
RAW_DB[("RawLaptopRecord (JSONB Audit Log)")]
SPEC_EVID[("SpecificationEvidence (Field-Level Provenance)")]
ENTITY_RES["Entity Resolution & Matching Engine"]
CANONICAL_DB[("Canonical Models (Brand, Family, Model, Configuration)")]
ALIAS_DB[("LaptopConfigurationAlias (Store SKU Bindings)")]
REC_API["Recommendation & Filtering API (FastAPI)"]
end
ManufacturerPortals --> ENG
ENG --> L1
L1 --> WM
WM --> L2
L2 --> JSON_BRAND
RetailerStores --> ENG
ENG --> STORE_ENG
STORE_ENG --> JSON_STORE
JSON_BRAND --> RAW_INGEST
JSON_STORE --> RAW_INGEST
RAW_INGEST --> RAW_DB
RAW_DB --> SPEC_EVID
RAW_DB --> ENTITY_RES
SPEC_EVID --> ENTITY_RES
ENTITY_RES --> CANONICAL_DB
ENTITY_RES --> ALIAS_DB
CANONICAL_DB --> REC_API
ALIAS_DB --> REC_API
A foundational architectural decision in this system is that scraper-service is strictly an ingestion service:
brand_{brand}.json and store_{store}.json) into RawLaptopRecord (PostgreSQL JSONB), data engineers can adjust, test, and re-run entity resolution algorithms offline without re-crawling the web.catalog-service manages this via SpecificationEvidence (field-level confidence and source tracking) and LaptopConfigurationAlias.laptop-recommender/
βββ Docs/ # Master technical documentation
β βββ ARCHITECTURE.md # System architecture, schemas, and data models
β βββ GETTING_STARTED.md # Complete developer setup & environment guide
β βββ BRAND_SCRAPING_GUIDE.md # Building brand scrapers (L1/L2, markdown parsing)
β βββ STORE_SCRAPING_GUIDE.md # Retailer store crawlers and schemas
β βββ tasks/
β βββ NEW_BRAND_SCRAPERS_TASK.md # Engineering task for Acer, Dell, and GigaByte
βββ services/
β βββ scraper-service/ # Standalone Web Ingestion Engine
β β βββ app/
β β β βββ cli.py # Scraper CLI (Brand & Store modes)
β β β βββ core/ # Constants, URLs, and token normalizer
β β β βββ engine/ # Scrapling headless browser & HTTP abstraction
β β β βββ schemas/ # Pydantic v2 data models & JSON output schemas
β β β βββ scrapers/ # Brand scrapers (ASUS, BaseBrandScraper)
β β β βββ services/ # Brand orchestrators (AsusScraperService)
β β β βββ stores/ # Store scrapers (Compumarts, Sigma, 2B)
β β βββ requirements.txt # Scraper dependencies
β β βββ README.md # Scraper service documentation
β βββ catalog-service/ # Relational Catalog, Matching & API Engine
β βββ alembic/ # Alembic schema migrations
β βββ app/
β β βββ api/ # FastAPI routes (Health, Catalog, Recommendations)
β β βββ core/ # Settings, async database session engine
β β βββ models/ # SQLAlchemy 2.0 ORM models (4-Tier + Components)
β β βββ repositories/ # Database query repositories
β β βββ schemas/ # Pydantic v2 API schemas
β β βββ services/ # Ingestion, matching, and recommendation logic
β β βββ main.py # FastAPI application entrypoint
β βββ requirements.txt # Catalog service dependencies
β βββ README.md # Catalog service documentation
βββ .vscode/ # Workspace settings for multi-virtual environments
scraper-servicehttps://www.asus.com/eg-en/store/laptops/).until_model): If the card matches the watermark, Level 1 halts immediately./techspec/ page for each Level 1 laptop.markdownify to convert complex nested HTML spec tables into clean Markdown.S5452MA-QD045W), manufacturer part numbers (MPNs), distinct physical configurations, and available colors.--until-model)Instead of guessing publication dates via brittle meta tags or heuristic CPU generation tables, the scraper uses a Reverse Watermark Cursor Pattern:
latest_pointers (e.g. ["ASUS Vivobook S14 (S5452)", "ASUS Vivobook S14 (S3407)", "ProArt P16 (H7607)"]).catalog-service passes --until-model "S5452".--max-pages parameter (default: 5) ensures the scraper never enters an infinite loop if the watermark model was renamed or unlisted.--mode store)Crawls live inventory, stock availability, and current EGP prices from leading Egyptian computer stores:
compumarts.com): Search query and HTML card parsing.sigma-computer.com): Structured product grid parsing.2b.com.eg): Bilingual Arabic/English title parsing and Arabic numeral conversion.store_{store_key}.json).ScraplingEngineScraplingEngine utilizing StealthyFetcher (Patchright / Playwright Chromium engine).curl_cffi for fast HTTP requests.navigator.webdriver, randomizes viewport sizes, injects realistic headers, and solves JavaScript-rendered SPAs protected by Cloudflare.catalog-serviceMapped columns, AsyncSession)JSONB support)To prevent configuration collisions, the data model strictly separates marketing families from physical configurations:
Brand (e.g., ASUS)
β
LaptopFamily (e.g., Vivobook)
β
LaptopModel (e.g., ASUS Vivobook S14 (S5452))
β
LaptopConfiguration (e.g., S5452MA-QD045W)
βββ Canonical Components (CPU, GPU, Display, RAM, Storage, Battery, Ports)
βββ Retail Offers via LaptopConfigurationAlias (Compumarts, Sigma, 2B)
CPU: Manufacturer, architecture, generation, core counts (P-cores / E-cores), TDP, base/boost clocks, benchmark scores.GPU: Integrated vs Discrete, architecture, VRAM size, memory type, TDP, benchmark scores.Display: Screen size (inches), resolution (width x height), panel type (OLED, IPS), refresh rate (Hz), color gamut (sRGB, DCI-P3 %), brightness (nits).LaptopMemory & LaptopStorage: Slot counts, soldered flags, capacity, expansion slots.Battery: Capacity (Wh), cell count, measured runtime hours.LaptopPort, LaptopConnectivity, LaptopWebcam, LaptopAudio, LaptopThermals, LaptopBuild, LaptopMeasurement.RawLaptopRecord: Stores raw scraped payloads (raw_payload as PostgreSQL JSONB), external IDs, ingestion timestamp, and processing status (PENDING, PROCESSED, FAILED).SpecificationEvidence: Records exact field-level extraction history (field_name, field_value, source_url, confidence, collected_at).LaptopConfigurationAlias: Maps retailer SKU strings and external IDs to the canonical LaptopConfiguration.catalog-service during pipeline processing of RawLaptopRecord.scraper-service# Navigate to scraper service
cd "services/scraper-service"
# Create and activate virtual environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1
# Install Python dependencies
pip install -r requirements.txt
# Install Playwright Chromium binaries
playwright install chromium
catalog-service# In a separate terminal, navigate to catalog service
cd "services/catalog-service"
# Create and activate virtual environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1
# Install Python dependencies
pip install -r requirements.txt
# Configure environment variables
cp .env.example .env
# Set your PostgreSQL connection string in .env:
# DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/laptop_recommender
# Run database migrations
alembic upgrade head
# Start the FastAPI server
uvicorn app.main:app --reload --port 8000
Interactive API documentation will be available at http://localhost:8000/docs.
Always run commands as modules from within services/scraper-service with its virtual environment activated:
cd "services/scraper-service"
.\.venv\Scripts\Activate.ps1
--mode brand-only or --mode brand)python -m app.cli --brand asus --mode brand-only --level 1
python -m app.cli --brand asus --mode brand-only --level 2 --save-json asus_catalog.json
Halts immediately upon reaching the watermark laptop pointer:
python -m app.cli --brand asus --mode brand-only --level 2 --until-model "S3407" --save-json asus_new.json
--mode store or --mode stores)Crawls live market inventory, stock status, and EGP prices directly from Egyptian computer retailers:
# Scrape all supported stores (Compumarts, Sigma, 2B)
python -m app.cli --mode store --stores all --limit 20
# Scrape a specific store
python -m app.cli --mode store --stores compumarts --limit 30 --save-json store_compumarts.json
# Scrape specific multiple stores
python -m app.cli --mode store --stores compumarts,sigma --limit 15
All detailed architecture specifications, developer guides, and engineering tasks are maintained in the Docs/ folder:
| Document | Description |
|---|---|
System Architecture (Docs/ARCHITECTURE.md) | In-depth microservice design, data models, entity relationships, and watermark cursor mechanics. |
Getting Started Guide (Docs/GETTING_STARTED.md) | Step-by-step developer setup, database provisioning, IDE configuration, and troubleshooting. |
Brand Scraping Guide (Docs/BRAND_SCRAPING_GUIDE.md) | Guide to building and maintaining brand scrapers, Level 1/2 models, and Markdown spec extraction. |
Store Scraping Guide (Docs/STORE_SCRAPING_GUIDE.md) | Guide to retailer store crawlers (Compumarts, Sigma, 2B), token normalization, and output schemas. |
Catalog Specifications Report (Docs/CATALOG_SPECIFICATIONS_REPORT.md) | Database entities checklist, fields obtained from brand portals, and external enrichment requirements. |
New Brand Scrapers Task (Docs/tasks/NEW_BRAND_SCRAPERS_TASK.md) | Detailed handover task specification for implementing Acer, Dell, and GigaByte brand services. |
Docs/tasks/NEW_BRAND_SCRAPERS_TASK.md.catalog-service to process brand_{brand}.json and store_{store}.json into RawLaptopRecord and SpecificationEvidence.catalog-service to link raw retailer offers to canonical LaptopConfiguration items.An enterprise-grade, decoupled microservices system designed to autonomously discover official laptop configurations from brand manufacturer portals in Egypt (ASUS, Lenovo, HP, Dell, Acer, GigaByte), crawl live market inventories from leading Egyptian retailers (Compumarts, Sigma Computer, 2B Egypt), and provide structured data persistence, entity resolution, and intelligent consumer recommendations.
The consumer laptop market in Egypt presents a uniquely challenging landscape for buyers, retailers, and data systems:
Ω Ω‘Ω’Ω£Ω€Ω₯Ω¦Ω§Ω¨Ω©), with no unified naming standards.This project solves these challenges by establishing an autonomous, decoupled microservices pipeline:
flowchart TD
subgraph Manufacturer Portals ["Official Brand Portals (Egypt)"]
ASUS["ASUS Egypt Store"]
LENOVO["Lenovo Egypt"]
HP["HP Egypt"]
DELL["Dell Egypt"]
ACER["Acer Egypt"]
GIGA["GigaByte Egypt"]
end
subgraph Retailer Stores ["Egyptian Retailer Stores"]
COMP["Compumarts Egypt"]
SIGMA["Sigma Computer"]
TWOB["2B Egypt"]
end
subgraph ScraperService ["scraper-service (Pure Ingestion Engine)"]
ENG["ScraplingEngine (Stealth Chrome / Anti-Bot)"]
L1["Level 1: Fast Catalog Discovery (Cards)"]
L2["Level 2: Deep Spec & SKU Crawl (/techspec/)"]
WM["Watermark Cursor Engine (until_model)"]
STORE_ENG["Store Crawlers (Compumarts, Sigma, 2B)"]
end
subgraph StandaloneArtifacts ["Standalone Ingestion JSON Artifacts"]
JSON_BRAND["brand_{brand}.json (Official Specs & SKUs)"]
JSON_STORE["store_{store}.json (Raw Store Inventory & Prices)"]
end
subgraph CatalogService ["catalog-service (Business Layer & Database)"]
RAW_INGEST["Raw Payload Ingestion Pipeline"]
RAW_DB[("RawLaptopRecord (JSONB Audit Log)")]
SPEC_EVID[("SpecificationEvidence (Field-Level Provenance)")]
ENTITY_RES["Entity Resolution & Matching Engine"]
CANONICAL_DB[("Canonical Models (Brand, Family, Model, Configuration)")]
ALIAS_DB[("LaptopConfigurationAlias (Store SKU Bindings)")]
REC_API["Recommendation & Filtering API (FastAPI)"]
end
ManufacturerPortals --> ENG
ENG --> L1
L1 --> WM
WM --> L2
L2 --> JSON_BRAND
RetailerStores --> ENG
ENG --> STORE_ENG
STORE_ENG --> JSON_STORE
JSON_BRAND --> RAW_INGEST
JSON_STORE --> RAW_INGEST
RAW_INGEST --> RAW_DB
RAW_DB --> SPEC_EVID
RAW_DB --> ENTITY_RES
SPEC_EVID --> ENTITY_RES
ENTITY_RES --> CANONICAL_DB
ENTITY_RES --> ALIAS_DB
CANONICAL_DB --> REC_API
ALIAS_DB --> REC_API
A foundational architectural decision in this system is that scraper-service is strictly an ingestion service:
brand_{brand}.json and store_{store}.json) into RawLaptopRecord (PostgreSQL JSONB), data engineers can adjust, test, and re-run entity resolution algorithms offline without re-crawling the web.catalog-service manages this via SpecificationEvidence (field-level confidence and source tracking) and LaptopConfigurationAlias.laptop-recommender/
βββ Docs/ # Master technical documentation
β βββ ARCHITECTURE.md # System architecture, schemas, and data models
β βββ GETTING_STARTED.md # Complete developer setup & environment guide
β βββ BRAND_SCRAPING_GUIDE.md # Building brand scrapers (L1/L2, markdown parsing)
β βββ STORE_SCRAPING_GUIDE.md # Retailer store crawlers and schemas
β βββ tasks/
β βββ NEW_BRAND_SCRAPERS_TASK.md # Engineering task for Acer, Dell, and GigaByte
βββ services/
β βββ scraper-service/ # Standalone Web Ingestion Engine
β β βββ app/
β β β βββ cli.py # Scraper CLI (Brand & Store modes)
β β β βββ core/ # Constants, URLs, and token normalizer
β β β βββ engine/ # Scrapling headless browser & HTTP abstraction
β β β βββ schemas/ # Pydantic v2 data models & JSON output schemas
β β β βββ scrapers/ # Brand scrapers (ASUS, BaseBrandScraper)
β β β βββ services/ # Brand orchestrators (AsusScraperService)
β β β βββ stores/ # Store scrapers (Compumarts, Sigma, 2B)
β β βββ requirements.txt # Scraper dependencies
β β βββ README.md # Scraper service documentation
β βββ catalog-service/ # Relational Catalog, Matching & API Engine
β βββ alembic/ # Alembic schema migrations
β βββ app/
β β βββ api/ # FastAPI routes (Health, Catalog, Recommendations)
β β βββ core/ # Settings, async database session engine
β β βββ models/ # SQLAlchemy 2.0 ORM models (4-Tier + Components)
β β βββ repositories/ # Database query repositories
β β βββ schemas/ # Pydantic v2 API schemas
β β βββ services/ # Ingestion, matching, and recommendation logic
β β βββ main.py # FastAPI application entrypoint
β βββ requirements.txt # Catalog service dependencies
β βββ README.md # Catalog service documentation
βββ .vscode/ # Workspace settings for multi-virtual environments
scraper-servicehttps://www.asus.com/eg-en/store/laptops/).until_model): If the card matches the watermark, Level 1 halts immediately./techspec/ page for each Level 1 laptop.markdownify to convert complex nested HTML spec tables into clean Markdown.S5452MA-QD045W), manufacturer part numbers (MPNs), distinct physical configurations, and available colors.--until-model)Instead of guessing publication dates via brittle meta tags or heuristic CPU generation tables, the scraper uses a Reverse Watermark Cursor Pattern:
latest_pointers (e.g. ["ASUS Vivobook S14 (S5452)", "ASUS Vivobook S14 (S3407)", "ProArt P16 (H7607)"]).catalog-service passes --until-model "S5452".--max-pages parameter (default: 5) ensures the scraper never enters an infinite loop if the watermark model was renamed or unlisted.--mode store)Crawls live inventory, stock availability, and current EGP prices from leading Egyptian computer stores:
compumarts.com): Search query and HTML card parsing.sigma-computer.com): Structured product grid parsing.2b.com.eg): Bilingual Arabic/English title parsing and Arabic numeral conversion.store_{store_key}.json).ScraplingEngineScraplingEngine utilizing StealthyFetcher (Patchright / Playwright Chromium engine).curl_cffi for fast HTTP requests.navigator.webdriver, randomizes viewport sizes, injects realistic headers, and solves JavaScript-rendered SPAs protected by Cloudflare.catalog-serviceMapped columns, AsyncSession)JSONB support)To prevent configuration collisions, the data model strictly separates marketing families from physical configurations:
Brand (e.g., ASUS)
β
LaptopFamily (e.g., Vivobook)
β
LaptopModel (e.g., ASUS Vivobook S14 (S5452))
β
LaptopConfiguration (e.g., S5452MA-QD045W)
βββ Canonical Components (CPU, GPU, Display, RAM, Storage, Battery, Ports)
βββ Retail Offers via LaptopConfigurationAlias (Compumarts, Sigma, 2B)
CPU: Manufacturer, architecture, generation, core counts (P-cores / E-cores), TDP, base/boost clocks, benchmark scores.GPU: Integrated vs Discrete, architecture, VRAM size, memory type, TDP, benchmark scores.Display: Screen size (inches), resolution (width x height), panel type (OLED, IPS), refresh rate (Hz), color gamut (sRGB, DCI-P3 %), brightness (nits).LaptopMemory & LaptopStorage: Slot counts, soldered flags, capacity, expansion slots.Battery: Capacity (Wh), cell count, measured runtime hours.LaptopPort, LaptopConnectivity, LaptopWebcam, LaptopAudio, LaptopThermals, LaptopBuild, LaptopMeasurement.RawLaptopRecord: Stores raw scraped payloads (raw_payload as PostgreSQL JSONB), external IDs, ingestion timestamp, and processing status (PENDING, PROCESSED, FAILED).SpecificationEvidence: Records exact field-level extraction history (field_name, field_value, source_url, confidence, collected_at).LaptopConfigurationAlias: Maps retailer SKU strings and external IDs to the canonical LaptopConfiguration.catalog-service during pipeline processing of RawLaptopRecord.scraper-service# Navigate to scraper service
cd "services/scraper-service"
# Create and activate virtual environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1
# Install Python dependencies
pip install -r requirements.txt
# Install Playwright Chromium binaries
playwright install chromium
catalog-service# In a separate terminal, navigate to catalog service
cd "services/catalog-service"
# Create and activate virtual environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1
# Install Python dependencies
pip install -r requirements.txt
# Configure environment variables
cp .env.example .env
# Set your PostgreSQL connection string in .env:
# DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/laptop_recommender
# Run database migrations
alembic upgrade head
# Start the FastAPI server
uvicorn app.main:app --reload --port 8000
Interactive API documentation will be available at http://localhost:8000/docs.
Always run commands as modules from within services/scraper-service with its virtual environment activated:
cd "services/scraper-service"
.\.venv\Scripts\Activate.ps1
--mode brand-only or --mode brand)python -m app.cli --brand asus --mode brand-only --level 1
python -m app.cli --brand asus --mode brand-only --level 2 --save-json asus_catalog.json
Halts immediately upon reaching the watermark laptop pointer:
python -m app.cli --brand asus --mode brand-only --level 2 --until-model "S3407" --save-json asus_new.json
--mode store or --mode stores)Crawls live market inventory, stock status, and EGP prices directly from Egyptian computer retailers:
# Scrape all supported stores (Compumarts, Sigma, 2B)
python -m app.cli --mode store --stores all --limit 20
# Scrape a specific store
python -m app.cli --mode store --stores compumarts --limit 30 --save-json store_compumarts.json
# Scrape specific multiple stores
python -m app.cli --mode store --stores compumarts,sigma --limit 15
All detailed architecture specifications, developer guides, and engineering tasks are maintained in the Docs/ folder:
| Document | Description |
|---|---|
System Architecture (Docs/ARCHITECTURE.md) | In-depth microservice design, data models, entity relationships, and watermark cursor mechanics. |
Getting Started Guide (Docs/GETTING_STARTED.md) | Step-by-step developer setup, database provisioning, IDE configuration, and troubleshooting. |
Brand Scraping Guide (Docs/BRAND_SCRAPING_GUIDE.md) | Guide to building and maintaining brand scrapers, Level 1/2 models, and Markdown spec extraction. |
Store Scraping Guide (Docs/STORE_SCRAPING_GUIDE.md) | Guide to retailer store crawlers (Compumarts, Sigma, 2B), token normalization, and output schemas. |
Catalog Specifications Report (Docs/CATALOG_SPECIFICATIONS_REPORT.md) | Database entities checklist, fields obtained from brand portals, and external enrichment requirements. |
New Brand Scrapers Task (Docs/tasks/NEW_BRAND_SCRAPERS_TASK.md) | Detailed handover task specification for implementing Acer, Dell, and GigaByte brand services. |
Docs/tasks/NEW_BRAND_SCRAPERS_TASK.md.catalog-service to process brand_{brand}.json and store_{store}.json into RawLaptopRecord and SpecificationEvidence.catalog-service to link raw retailer offers to canonical LaptopConfiguration items.