Project Structure Differences with PWA Kit
PWA Kit organizes most app code under app/ with centralized route definitions and explicit runtime entry files. Storefront Next shifts to src/, file-based routes, and framework conventions around root and route modules. The outcome is a more convention-driven layout with clearer boundaries for routes, providers, middleware, and adapters.
| Aspect | PWA Kit | Storefront Next |
|---|---|---|
| Source Directory | app/ | src/ |
| Page Components | app/pages/ | src/routes/ |
| Configuration | config/ (JS) | config.server.ts file |
| Translations | translations/ (JSON) | src/locales/ |
| Static Assets | app/static/, app/assets/ | public/ |
| Theme/Styles | app/theme/ (Chakra) | src/app.css (Tailwind) |
| Type Definitions | N/A (JavaScript) | types/ |
| Aspect | PWA Kit | Storefront Next |
|---|---|---|
| Client Entry | app/main.jsx (explicit) | entry.client.tsx (hidden, revealable) |
| Server Entry | app/ssr.js (Express) | entry.server.tsx (hidden, revealable) |
| Root Layout | app/components/_app/ | src/root.tsx |
| Routes | app/routes.jsx (array) | src/routes.ts + src/routes/ (files) |
| Config | config/default.js | config.server.ts |
PWA Kit uses CommonJS modules:
Storefront Next uses TypeScript with defineConfig:
-
Language: PWA Kit uses JavaScript. Storefront Next uses TypeScript throughout.
-
Build Tool Integration: PWA Kit has separate config files for each tool. Storefront Next centralizes build config in
vite.config.ts. -
Server Architecture: PWA Kit uses Express with explicit route handlers. Storefront Next uses React Router’s middleware pattern.
-
Entry Point Pattern: PWA Kit has separate client/server entry files. Storefront Next consolidates into
root.tsxwith exports. -
Asset Handling: PWA Kit uses
getAssetUrl()helper. Storefront Next uses Vite’s native import system. -
Testing: PWA Kit uses Jest; Storefront Next uses Vitest with integrated Storybook.
-
Code Organization: Storefront Next introduces
middlewares/,providers/,adapters/directories for cleaner separation.
-
Move source code from
app/tosrc/. -
Convert pages from
app/pages/to file-based routes insrc/routes/. -
Migrate configuration from
config/default.jstoconfig.server.ts. -
Update translations from
translations/*.jsontosrc/locales/. -
Convert JavaScript to TypeScript-add type annotations throughout.
-
Replace Express routes with middleware exports in
root.tsxor resource routes. -
Update static asset imports to use Vite’s import system instead of
getAssetUrl(). -
Entry file customization: If needed, run
npx react-router revealto customize client/server entry points.