Skip to content

Project Structure

maho-storefront/
├── src/
│   ├── index.tsx              # Main Hono app — routing, caching, SSR
│   ├── api-client.ts          # Maho REST API wrapper
│   ├── page-config.ts         # Variant resolver (page.json → component selection)
│   ├── types.ts               # TypeScript type definitions
│   ├── content-store.ts       # KV abstraction layer
│   ├── asset-version.ts       # Cache-bust hash generation
│   ├── css/                   # CSS source files
│   │   ├── product.css        # Product page styles
│   │   ├── cart.css           # Cart & checkout styles
│   │   ├── account.css        # Account dashboard styles
│   │   └── ...
│   ├── js/
│   │   ├── app.js             # Stimulus application bootstrap
│   │   ├── stimulus.js        # Stimulus re-export
│   │   ├── api.js             # Client-side API helpers
│   │   ├── utils.js           # Utility functions
│   │   ├── template-helpers.js # DOM hydration utilities
│   │   ├── analytics.js       # Event tracking
│   │   ├── payment-methods/   # Payment adapter implementations
│   │   └── controllers/       # 19 Stimulus controllers
│   └── templates/
│       ├── Layout.tsx          # Base HTML layout
│       ├── Home.tsx            # Homepage template
│       ├── Product.tsx         # Product detail page
│       ├── Category.tsx        # Category listing page
│       ├── Cart.tsx            # Cart page
│       ├── Checkout.tsx        # Checkout flow
│       ├── Account.tsx         # Account dashboard
│       └── components/         # Component variant system
│           ├── product-display/
│           ├── cart/
│           ├── category/
│           ├── filtering/
│           ├── homepage/
│           ├── navigation/
│           ├── checkout/
│           └── ...
├── public/
│   ├── styles.css             # [generated] UnoCSS output
│   └── controllers.js.txt     # [generated] esbuild JS bundle
├── scripts/
│   └── generate-manifest.js   # Manifest generator
├── theme-output/              # [generated] Sync output cache
├── wrangler.toml              # Cloudflare Workers configuration
├── uno.config.ts              # UnoCSS + DaisyUI configuration
├── theme.json                 # Default theme design tokens
├── page.json                  # Default component variant config
├── stores.json                # Store → theme/config mapping
├── deploy.sh                  # Deployment script
└── package.json

Key Directories

src/ — Application Source

The core application. index.tsx is the entry point — a Hono app that handles routing, edge caching, and server-side rendering.

src/templates/components/ — Variant System

Organized by domain (product-display, navigation, cart, etc.). Each slot has:

  • _manifest.json — variant definitions
  • index.tsx — variant resolver
  • VariantName.tsx — individual variant implementations

See Component Variants for details.

src/js/controllers/ — Stimulus Controllers

Client-side behavior via Stimulus.js. Controllers attach to server-rendered HTML using data-controller attributes. See Controllers for details.

src/css/ — Stylesheets

Component-specific CSS loaded as UnoCSS preflights. Most styling comes from DaisyUI classes and UnoCSS utilities — these files handle complex component layouts.

Configuration Files

FilePurpose
wrangler.tomlCloudflare Workers config (KV bindings, env vars)
uno.config.tsUnoCSS config (DaisyUI integration, theme tokens, preflights)
theme.jsonDesign tokens (colors, fonts, spacing, radii, shadows)
page.jsonComponent variant selection per page type
stores.jsonMaps store codes to themes and page configs

Generated Files

FileGenerated ByPurpose
public/styles.cssbun run build:cssCSS bundle
public/controllers.js.txtbun run build:jsJS bundle
manifest.jsonbun run manifestComponent metadata