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:
- Load product data from product database (in-memory)
- Fetch images from S3 via image manifest
- Calculate pricing with currency conversion
- Query stock from database (cached in Valkey)
- 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:
- Product database: Product name, features, pricing
- S3 storage: Product images from image manifest
- Database: Stock counts (finished goods + parts)
- Valkey: Cached stock counts for performance
Image Sourcing
Product images are sourced from S3:
- Image manifest: Central registry of image locations
- S3 bucket: Product images stored in object storage
- WebP format: Optimized images for fast loading
- Fallback: Placeholder images when real images unavailable
Datasheet Generation
Datasheets are generated as PDFs using pdfkit:
- Template: HTML template with product information
- Features: Extracted from product database
- Images: Product images from S3
- 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:
- Tier 1: Ready to ship (Finished goods stock)
- Tier 2: Ready in 3 days (minimum component stock)
- Tier 3: Ready in 15 days (board + RAM stock)
Price Calculation
Prices are calculated using:
- Web price: From product database
- Currency conversion: Convert to user's currency
- GST: Add applicable tax
- Net amount: Total including tax
AI-Powered Descriptions
We use DeepSeek to generate product descriptions:
- Build product name: From SKU
- Extract features: From product database
- Send to DeepSeek: With system prompt for caching
- Parse response: Tagline and body
- 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