Hernando Abella

E-commerce Storefront · Step 2 of 7

Model and validate the catalog

Define a Product type and place sample records in a separate data module. Keep prices as integer minor units (such as cents) so arithmetic avoids floating-point surprises.

Understand

A well-shaped data model prevents UI code from guessing what fields mean.

Build

Add a formatter for the chosen currency and a small validation function for required fields and non-negative prices.

Check

The catalog loads from one source, each record passes validation, and displayed prices are formatted consistently.

Try it

Add a product with a missing image and design a useful fallback.