Architecture
The storefront is organized as a feature-complete Next.js application:Key Features
Multi-Regional Support
All storefront routes are prefixed with[countryCode] to provide:
- Region-specific pricing and currency
- Localized product availability
- Country-specific shipping options
- Tax calculations based on location
Server Components
The storefront leverages React Server Components for:- Fast initial page loads - HTML rendered on the server
- SEO optimization - Fully rendered content for search engines
- Reduced JavaScript - Only interactive components ship to the client
- Data fetching - Direct GraphQL queries without API roundtrips
Responsive Design
Built mobile-first with:- Touch-optimized product galleries
- Mobile-specific navigation patterns
- Adaptive layouts for all screen sizes
- Performance-optimized images
Core Modules
The storefront is organized into feature modules underfeatures/storefront/modules/:
Products
Product detail pages with image galleries, variant selection, and related products
Cart
Persistent shopping cart with quantity management and guest checkout support
Checkout
Multi-step checkout with address validation, shipping selection, and payment
Account
Customer dashboard for orders, addresses, profile, and invoicing
Customer Journey
The typical customer flow through the storefront:Data Layer
The storefront communicates with the Openfront backend via GraphQL:Performance
Image Optimization
Product images are optimized using Next.js Image component:- Automatic format selection (WebP, AVIF)
- Responsive sizes for different viewports
- Lazy loading below the fold
Caching Strategy
The storefront uses React’scache() function for:
- Deduplicating data fetches during rendering
- Consistent data across Server Components
- Reduced database queries
Revalidation
Data is revalidated using Next.js tags:Navigation
Homepage
Featured collections and products with customizable hero section:Product Browsing
Customers can browse products by:- Collections - Curated product groupings
- Categories - Hierarchical product organization
- Search - Full-text product search (when configured)
Templates
Each module provides templates for common layouts:Next Steps
Product Catalog
Learn how products are displayed and variants are managed
Shopping Cart
Understand cart management and persistence
Checkout
Explore the multi-step checkout process
Customer Accounts
See how customers manage orders and profiles