Product Catalog Guide

Eastern Mills maintains a digital product catalog of 9,875 designs accessible through a web-based product portal and a JSON API endpoint.

Access: the catalog portal and the catalog/search API endpoints are for trade accounts only and require a login. Design records, including style numbers and specifications, are shared with trade customers under account access. Request access at corporate@easternmills.com.

>

A public, unauthenticated summary of scale, construction range, fibre mix and certifications is available at /api/capabilities — no design records. The catalog originates from Sourcewiz, a product information management system, and is augmented with high-resolution images stored in Firebase Storage. This guide explains how to access, query, filter, and interpret catalog data.

Catalog Overview

MetricValue
Total Products9,875
Products with Images9,645
Catalog SourceSourcewiz PIM
Image StorageFirebase Storage (Google Cloud)
Data FormatJSON
Last UpdatedDecember 2025
DeduplicationBy style number (first occurrence kept)
Default SortNewest first (reversed insertion order)

Access Methods

1. Products API (trade login required)

The primary read-only endpoint for retrieving the entire catalog.

Endpoint: GET /api/products

Authentication: None required for the API. However, the front-end product browsing experience at /products requires trade user login.

Response Format:

{
  "products": [...],
  "lastSynced": "2025-12-03T00:27:45.705728",
  "totalCount": 9875,
  "withImages": 9645
}

Caching: Statically generated at build time. Cache headers set to public, s-maxage=3600, stale-while-revalidate=86400 (1 hour fresh, 24 hours stale-while-revalidate).

Rate Limits: No explicit rate limiting on this endpoint. The response is served as a static asset by the CDN.

Error Response:

{
  "error": "Failed to fetch products",
  "products": [],
  "lastSynced": null,
  "totalCount": 0
}

2. Trade User Portal

The authenticated web interface at /products provides filtered product browsing based on user permissions. Trade users are granted access to specific construction types (Hand Knotted, Hand Tufted, Handloom, Flat Weave, Machine Made) through the admin panel at /admin/users.

3. Studio Portal

The studio interface at /studio/products provides the full unfiltered catalog with additional management capabilities including image uploads, CSV bulk imports, and product editing.

Product Data Schema

Each product object in the catalog contains the following fields.

Core Fields

FieldTypeDescriptionExample
idstringUnique product identifier (same as styleNumber)"EM-17-FRL-10"
styleNumberstringProduct style number, the primary identifier"EM-17-FRL-10"
displayNamestringHuman-readable name combining style number and collection"EM-17-FRL-10 - Arcadian Collection"
categorystringNormalized category slug"hand-knotted"
originalCategorystringOriginal category from Sourcewiz"Hand Knotted"
collectionstringCollection name"Arcadian Collection"
colorstringComma-separated color values"Beige,Brown"
sizestringDimensions as string"5X8 feet"
constructionstringConstruction method"Hand Knotted"
qualitystringQuality specification (knot density notation)"3/20"
descriptionstringProduct description, often comma-separated tags"Moroccan,Pile Rug"
keywordsstringSearch keywords"Pile Rug"

Material Fields

FieldTypeDescription
materialsarrayArray of material specifications
materials[].namestringMaterial name (e.g., "Wool", "Cotton", "Silk")
materials[].quantitynumberMaterial quantity (often 0 when not specified)

Image Fields

FieldTypeDescription
sourcewizUrlstringOriginal image URL from Sourcewiz CDN
firebaseUrlstring (optional)Primary image URL in Firebase Storage
additionalFirebaseUrlsstring[] (optional)Additional image URLs (image-2.jpg, image-3.jpg, etc.)
imagesarrayArray of local image file references
images[].filenamestringOriginal filename
images[].drive_idstringGoogle Drive file ID
images[].local_pathstringLocal image path on the server
hasLocalImagesbooleanWhether local images are available

Display Fields

FieldTypeDescription
priceTierstring (optional)Price tier indicator: "$", "$$", "$$$", "$$$$", or "$$$$$"

Image URL Structure

Product images are stored in Firebase Storage with a consistent path structure.

Primary Image

https://storage.googleapis.com/easternmillscom.firebasestorage.app/products/{product_id}/main.jpg

Additional Images

https://storage.googleapis.com/easternmillscom.firebasestorage.app/products/{product_id}/image-2.jpg
https://storage.googleapis.com/easternmillscom.firebasestorage.app/products/{product_id}/image-3.jpg

Image Priority

When displaying product images, the system follows this priority order:

  1. firebaseUrl (Firebase Storage, primary image)
  2. images[0].local_path (local server path, if hasLocalImages is true)
  3. sourcewizUrl (original Sourcewiz CDN URL)
  4. /images/placeholder-rug.jpg (fallback placeholder)

Product Categories

Products are classified into the following categories based on their construction method.

Category SlugDisplay NameDescription
hand-knottedHand KnottedIndividual knots tied by hand, highest durability
hand-tuftedHand TuftedTufting gun construction, mid-range pricing
hand-loomedHand LoomedFlatweave and low-pile on manual looms
premiumPremiumExceptional materials and craftsmanship
broadloomBroadloomWall-to-wall carpet from 15-acre facility
machine-madeMachine MadeMechanized production
natural-fiberNatural FiberJute, sisal, seagrass, and similar
otherOtherMiscellaneous products

Category Mapping Logic

The system normalizes construction types from Sourcewiz to internal categories:

  • Construction containing "KNOT" maps to hand-knotted
  • Construction containing "TUFT" maps to hand-tufted
  • All others (including "HANDLOOM") map to hand-loomed

Catalog Filters

The product catalog supports the following filter dimensions on the front end.

Filter Order (as displayed)

  1. Collection - Filter by collection name
  2. Color - Filter by color values
  3. Size and Shape - Dynamically calculated from product dimensions
  4. Material - Filter by material type
  5. Construction - Filter by construction method
  6. Pile Height - Filter by pile height category

Size and Shape Filter Logic

Sizes are calculated from the product size field:

  • Small: Up to 5x8 feet (area-based calculation)
  • Medium: 6x9 to 8x10 feet
  • Large: 9x12 feet and above

Shapes are detected from the size string:

  • Rectangular: Default shape
  • Runner: Aspect ratio of 3:1 or greater
  • Round: Detected from "round" keyword in size string

Pile Height Filter Logic

Pile height categories are determined by construction type, keywords, and description:

  • Flatweave: Flatweave, dhurrie, kilim constructions
  • Low Pile: Low pile constructions and indicators
  • Medium Pile: Standard pile constructions
  • High Pile: High pile, shag, and plush constructions

Search Functionality

The catalog search operates on the following fields simultaneously:

  • id (style number)
  • displayName
  • collection
  • color
  • keywords
  • description

Search is case-insensitive and matches partial strings (substring matching, not fuzzy matching).

Contact Form API

In addition to the product catalog, the website provides a contact form API.

Endpoint: POST /api/contact

Rate Limit: 5 requests per minute per IP address.

Request Body:

{
  "name": "string (required, max 100 chars)",
  "email": "string (required, max 254 chars)",
  "company": "string (optional, max 200 chars)",
  "phone": "string (optional, max 30 chars)",
  "message": "string (required, max 5000 chars)",
  "inquiryType": "string (optional: general, custom, b2b, hospitality, existing)",
  "formType": "string (optional: footer)"
}

Inquiry Types:

ValueLabel
generalGeneral Inquiry
customCustom Design Project
b2bB2B Partnership
hospitalityHospitality and Contract
existingExisting Order

Success Response: { "success": true }

Error Responses:

  • 400 - Missing required fields, invalid types, field length exceeded, invalid email format
  • 429 - Rate limit exceeded
  • 500 - Internal server error

Trade User Authentication API

Access to the product catalog requires trade user authentication.

Login Endpoint: POST /api/auth/login

Rate Limit: 5 login attempts per 15-minute window per IP. After exceeding the limit, the IP is blocked for 30 minutes.

Request Body:

{
  "username": "string (required)",
  "password": "string (required, max 256 chars)"
}

Success Response:

{
  "success": true,
  "user": {
    "id": "string",
    "username": "string",
    "company": "string",
    "allowedConstructions": ["Hand Knotted", "Hand Tufted", "Handloom"]
  }
}

A JWT authentication cookie is set on successful login.

Auth Check Endpoint: GET /api/auth/check

Returns current authentication status and user details.

Logout Endpoint: POST /api/auth/logout

Clears the authentication cookie.

Style Number Convention

Eastern Mills style numbers follow a consistent pattern that encodes product information.

Format: EM-{YY}-{CODE}-{NUMBER}

SegmentMeaningExample
EMEastern Mills prefixAlways "EM"
YYYear of design/creation24 for 2024
CODECollection or type abbreviationFRL, MA, CO
NUMBERUnique sequential number10, 7736

Example: EM-24-MA-7736 is a 2024 design from the MA collection, item 7736.

Data Sources and Freshness

SourceTypeUpdate Frequency
Sourcewiz CatalogStatic JSONUpdated at build time
Firebase ImagesCloud StorageUploaded via scripts or studio portal
Product EditsFirestore overlayReal-time (admin/studio changes)
Trade UsersFirestoreReal-time (admin changes)

The catalog JSON is pre-generated from Sourcewiz exports using Python scripts (scripts/generate-product-catalog.py). Image URLs are added by separate upload scripts. The static catalog is embedded at Next.js build time, so any changes require a rebuild and redeploy.

Export Options

The admin panel provides export functionality for product data.

Excel Export

Endpoint: POST /api/export/excel

Generates an .xlsx file with selected product data including style numbers, collections, colors, sizes, materials, and image references.

PowerPoint Export

Endpoint: POST /api/export/ppt

Creates a .pptx presentation with product images and details. Limited to a maximum of 12 products per export.

Sent Samples

The admin panel includes a Sent Samples viewer that shows product samples shipped to buyers.

List Buyers: GET /api/admin/sent-samples

Returns all buyers with their sample shipment counts.

Buyer Details: GET /api/admin/sent-samples/{buyerId}

Returns a specific buyer's shipments and products with signed Firebase Storage URLs.

Firebase Storage Structure for Samples

sent-samples/
  {Buyer Name}/
    {N}-{DD}-{MM}-{YYYY}/
      EM-23-CO-5497 3K-1.jpg
      EM-23-CO-5497 3K-1 (2).jpg
      EM-23-CO-5497 AH-1.jpg

Images are grouped by normalizing filenames. Files like EM-23-CO-5497 3K-1.jpg and EM-23-CO-5497 3K-1 (2).jpg are treated as multiple angles of the same product and color, while EM-23-CO-5497 AH-1.jpg (different color code) is treated as a separate entry.