This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run dev- Start development server on port 3456 with codegennpm run dev:ca- Start dev server with customer account API (unstable)npm run build- Build for production with codegennpm run preview- Preview production buildnpm run start- Start production servernpm run typecheck- Run TypeScript type checkingnpm run codegen- Generate GraphQL types and schema
npm run biome- Run linting (error level only)npm run biome:fix- Auto-fix linting issuesnpm run format- Format code with Biomenpm run format:check- Check formatting without changes
npm run e2e- Run Playwright end-to-end testsnpm run e2e:ui- Run Playwright tests with UI
npm run clean- Remove build artifacts and dependencies
This is a Shopify Hydrogen storefront built with React Router v7 (not Remix) and integrated with Weaverse for visual page building. Key architectural decisions:
- Hydrogen 2025.5.0 - Shopify's React framework for commerce
- React Router v7 - File-based routing (NOT Remix - see import rules below)
- Weaverse - Visual page builder with component system
- Vite - Build tool and dev server
- Biome - Linting and formatting (replaces ESLint/Prettier)
- TailwindCSS v4 - Styling with CSS-in-JS approach
app/
├── components/ # Reusable UI components
├── sections/ # Weaverse page-building sections
├── routes/ # File-based routing (React Router)
├── weaverse/ # Weaverse integration and config
├── hooks/ # Custom React hooks
├── utils/ # Utility functions
├── graphql/ # GraphQL fragments and queries
└── styles/ # Global styles
ALWAYS use React Router imports, NEVER Remix:
// ✅ CORRECT
import { useLoaderData, Link, Form } from 'react-router';
// ❌ WRONG
import { useLoaderData, Link, Form } from '@remix-run/react';- All page content is managed through Weaverse's visual builder
- Components must be registered in
app/weaverse/components.ts - Section components live in
app/sections/with proper schema exports - Theme settings defined in
app/weaverse/schema.server.ts - Use
withWeaverseHOC on root App component
- Components: Small, reusable UI elements (
app/components/) - Sections: Full-width page-building blocks (
app/sections/) - Weaverse Schema: Every section must export a
schemaobject usingcreateSchema() - Data Loading: Use component
loaderfunctions for server-side data fetching
- TailwindCSS v4 with CSS-in-JS setup via Vite plugin
- Design tokens managed through Weaverse theme settings
- Global styles in
app/weaverse/style.tsxdriven by theme settings - Component-specific styles using Tailwind classes
- Storefront API for product/collection data
- Generated types in
storefront-api.generated.d.ts(DO NOT edit directly) - Fragments defined in
app/graphql/fragments.ts - Queries in
app/graphql/queries.ts - Regenerate types with
npm run codegenafter schema changes
- Playwright for end-to-end testing
- Test files in
tests/directory - Configuration in
playwright.config.ts
- Create component in
app/sections/[section-name]/index.tsx - Export default component with
forwardRef - Export
schemaobject withcreateSchema() - Optionally export
loaderfunction for data fetching - Register in
app/weaverse/components.ts
export let schema = createSchema({
type: 'my-section',
title: 'My Section',
settings: [ // Use "settings", NOT "inspector"
{
group: 'Content',
inputs: [
{
type: 'text',
name: 'heading',
label: 'Heading',
defaultValue: 'Default heading',
},
],
},
],
});- Routes in
app/routes/follow React Router v7 conventions - Locale-aware routes:
($locale).page-name.tsx - Dynamic routes:
($locale).products.$productHandle.tsx - API routes:
($locale).api.endpoint.ts
- TypeScript: Strict mode disabled, but use types where beneficial
- Linting: Biome configuration in
biome.json(extends@weaverse/biome) - Formatting: Double quotes, semicolons required
- Imports: Use
~/*alias for app directory imports
Required environment variables:
PUBLIC_STORE_DOMAIN- Shopify store domainPUBLIC_STOREFRONT_API_TOKEN- Storefront API access tokenWEAVERSE_PROJECT_ID- Weaverse project identifierSESSION_SECRET- Session encryption key
- Server-side rendering with hydration
- Component lazy loading via Vite warming
- GraphQL caching using Hydrogen's cache strategies
- Image optimization with Shopify CDN
- Asset inlining disabled for CSP compliance
- Modify queries in
app/graphql/ - Run
npm run codegen - Update TypeScript types as needed
- Edit
app/weaverse/schema.server.ts - Add corresponding styles in
app/weaverse/style.tsx - Use
useThemeSettings()hook in components
- Dev tools: http://localhost:3456/graphiql
- Network requests: http://localhost:3456/debug-network
- Hydrogen logs: Check terminal output during development
- Shopify Oxygen: Native Hydrogen deployment platform
- Build command:
npm run build - Environment: Ensure all env vars are configured