Product Pages & Datasheets: Dynamic Assembly from Multiple Sources

This article explains how we generate product pages and PDF datasheets by combining data from multiple systems.

The Problem: Product Data is Scattered

A product page needs:

  • Product info: Name, description, features

  • Images: Multiple product photos (from S3)

  • Pricing: Current prices in multiple currencies (from pricing engine)

  • Stock: Real-time inventory counts

  • Specifications: Technical specs grouped by category (from SKU structure)

Assembling this data from multiple sources for every page load is complex.

The Solution: Dynamic Assembly with Caching

We assemble product pages on-demand:

  1. Load product data from product database (in-memory)
  2. Fetch images from S3 via image manifest
  3. Calculate pricing with currency conversion
  4. Query stock from database (cached in Valkey)
  5. Generate datasheet on-demand or from cache

Product Database

We use a product database that contains:

  • Product descriptions: Product names and features

  • Part information: Component details

  • BOM data: Bill of Materials for assembled products

  • Pricing: Web prices and currency conversions

Product Page Assembly

Product pages are assembled from multiple sources:

  1. Product database: Product name, features, pricing
  2. S3 storage: Product images from image manifest
  3. Database: Stock counts (finished goods + parts)
  4. Valkey: Cached stock counts for performance

Image Sourcing

Product images are sourced from S3:

  1. Image manifest: Central registry of image locations
  2. S3 bucket: Product images stored in object storage
  3. WebP format: Optimized images for fast loading
  4. Fallback: Placeholder images when real images unavailable

Datasheet Generation

Datasheets are generated as PDFs using pdfkit:

  1. Template: HTML template with product information
  2. Features: Extracted from product database
  3. Images: Product images from S3
  4. PDF conversion: HTML to PDF using wkhtmltopdf

Datasheet layout uses a 2-column format with bold headings for feature names.

Inventory Calculation

We calculate inventory from multiple tiers:

  1. Tier 1: Ready to ship (Finished goods stock)
  2. Tier 2: Ready in 3 days (minimum component stock)
  3. Tier 3: Ready in 15 days (board + RAM stock)

Price Calculation

Prices are calculated using:

  1. Web price: From product database
  2. Currency conversion: Convert to user's currency
  3. GST: Add applicable tax
  4. Net amount: Total including tax

AI-Powered Descriptions

We use DeepSeek to generate product descriptions:

  1. Build product name: From SKU
  2. Extract features: From product database
  3. Send to DeepSeek: With system prompt for caching
  4. Parse response: Tagline and body
  5. Store for multilingual support

Summary

Product pages and datasheets provide:

  • Complete information: From multiple sources

  • Optimized images: WebP format from S3

  • Fast loading: Valkey caching for stock counts

  • AI content: DeepSeek for descriptions

  • Multilingual: Support for multiple languages