My Visual Path / Frontend field guide

How your React
website works.

Architecture, state, local saves, API connections, PDF exports, and Cloudflare delivery—explained from your source.

React 19ViteRedux + React QueryBrowser PDF export

16 October 2026 · Source: scripts.zip · Companion to the Node.js guide

01 / SYSTEM OVERVIEW

The public website, on your device.

Discover routines and social stories, customize personal versions, use them interactively, and export PDFs. This app consumes the public Node.js API we documented earlier.

Shared catalog

React Query and Axios load activities, templates, stories, visuals, and categories from the backend.

Personal workspace

Redux holds saved content and progress. Browser storage persists personal records and preferences.

Browser exports

React PDF generates downloads and print previews from local state and fetched images.

Cloudflare Worker + assetsdist files · SPA route fallback Node.js API → PostgreSQLCatalog + community submissionsWorker proxies /sitemap.xml only User’s browser · React application Router + pages + componentsRoutines · stories · search · feedbackGuides · display preferences · tours React Query → AxiosAPI cache and network requestsDirect API requests Editor state → ReduxSaved routines, stories, progress Browser PDF processingReact PDF · image preparation SEO + error boundaryMetadata and UI error handlingHTML / JS / CSS Browser localStoragePersonal saves + preferences PDF / print previewGenerated on the user’s device Cloudflare R2 imagesPublic URLs from catalog dataFetch for PDF and previews
Where is Clerk? No Clerk dependency or admin route is included in this public app. Clerk protects the backend admin APIs; an admin frontend is outside this archive.

Logical architecture based on source. Cloudflare hosting is configured, not live-verified. R2 storage is confirmed by the previously supplied backend code.

02 / WORKING SEQUENCES

Follow a user action.

Choose a scenario. Diagrams read top to bottom; text steps appear below.

    03 / STATE & STORAGE

    Different state, different responsibilities.

    LayerWhat it holdsLifetime / source
    Component stateUnsaved editor fields, dialogs, current choices, statususeState / useRef; scoped to components
    React QueryAPI results, errors, loading, saved-content resolutionMemory cache; global staleTime 5 minutes; scoped catalog gcTime 30 minutes
    Redux ToolkitsocialStories.stories, schedules.schedules, schedules.scheduleProgressShared application state initialized from browser storage
    localStorageschedules, scheduleProgress, visualStepsStories, favorites, history, display/privacy settingsSame browser origin, until cleared or unavailable
    PostgreSQLShared catalog and public submissionsBackend-owned records accessed through API
    R2 / asset URLsPictures for display and PDF preparationImage bytes separate from saved personal records
    Local saves are not account synchronization

    The inspected flow does not upload personal routines or stories to a user account. Clearing site storage or changing browser/origin can make saves unavailable. Routine backup UI exists. localStorage is not a server backup.

    Compact records still depend on catalog data

    Routine saves use activity references and customization. Story storage version 2 stores page IDs and overrides, avoiding repeated library image metadata when a visual ID exists. useSavedStory resolves references through API/cache. A saved record does not guarantee full offline functionality.

    Provider composition

    main.jsx mounts StrictMode → HelmetProvider → Redux Provider → QueryClientProvider → BrowserRouter → AppErrorBoundary → App. ScrollToTop is also inside BrowserRouter. The store subscribes to relevant changes and persists schedules, progress, and compact stories.

    04 / PAGE MAP

    From discovery to daily use.

    URL familyPurpose
    / · /searchHomepage and global search
    /routines · /routines/:slugBrowse and view ready-made routines
    /routines/create · /routines/:slug/customizeBuild from scratch or adapt a shared template
    /my-routines · /routines/:scheduleId/view, /use, /editManage, view, run, and edit local routines; suffixes summarize separate routes
    /social-stories · /social-stories/:slugBrowse and view shared stories
    /social-stories/create · /social-stories/:slug/customize · /social-stories/:storyId/editStory builder
    /my-stories · /social-stories/:storyId/viewSaved stories and reader
    /social-stories/saved-templates/:storyId/viewPersonal saved-template view
    /request-resource · /feedbackForms that POST to the backend
    /resources/* · feature how-it-works and guidesLearning and support content
    /about · /contact · /faq · legal pagesInformation and policy pages
    *In-app not-found screen

    App.jsx mounts pages inside Layout. BrowserRouter handles navigation. Cloudflare’s configured SPA fallback supports client-side paths.

    05 / DEPENDENCY REFERENCE

    Every package, tied to its actual role.

    17 runtime and 11 development dependencies. Version ranges are declarations from package.json, not installed-version verification.

    Runtime package / rangeRoleSource
    @dnd-kit/core
    ^6.3.1
    Drag-and-drop contexts, sensors, and collision handling for activity and story-page lists.RoutineSelectedActivities.jsx; StoryPageList.jsx
    @dnd-kit/sortable
    ^10.0.0
    Sortable items and arrayMove let users reorder activities and pages.RoutineSelectedActivities.jsx; useStoryPages.js
    @dnd-kit/utilities
    ^3.2.2
    Converts drag transforms to CSS values so items move visibly.RoutineSelectedActivities.jsx; StoryPageList.jsx
    @react-pdf/renderer
    ^4.9.0
    Builds PDF documents from React PDF components in the browser. Active export paths dynamically load it; these are document layouts rather than web-page screenshots.useSchedulePdf.jsx; social-stories/utils/storyExport.js
    @reduxjs/toolkit
    ^2.12.0
    Creates the central Redux store and schedule/story slices. Tracks saved content and progress; persistence is implemented separately.store/store.js; store/slices/
    @tanstack/react-query
    ^5.103.1
    Loads and caches API data and tracks loading/error states. Defaults: 5-minute stale time, one retry, no window-focus refetch. Hooks can override these defaults.main.jsx; hooks/
    axios
    ^1.20.0
    Sends API requests through axiosClient: VITE_API_BASE_URL, JSON headers, 45-second timeout. No Clerk token interceptor is present here.api/axiosClient.js
    buffer
    ^6.0.3
    Supplies Node-style Buffer support for browser PDF dependencies, assigning globalThis.Buffer only if missing.utils/pdfBuffer.js
    driver.js
    ^1.8.0
    Provides interactive guided tours in the routine and story builders.RoutineBuilderEditor.jsx; SocialStoryBuilderPage.jsx
    html2canvas
    ^1.4.1
    Can render HTML to canvas. No import/use found in supplied src or scripts; listed dependency only. Current PDF paths use React PDF.package.json; source usage search
    jspdf
    ^4.2.1
    Can create PDFs in JavaScript. No import/use found in supplied src or scripts; do not infer it powers current exports.package.json; source usage search
    lucide-react
    ^1.48.0
    React icons for navigation, actions, sharing, feedback, and other UI.TemplateActions.jsx and UI components
    react
    ^19.2.8
    Components, state, effects, refs, and interactive rendering. Unsaved editor values stay in component state before Save.src/
    react-dom
    ^19.2.8
    Mounts the app with createRoot; flushSync also appears in the story builder. hydrateRoot is not used at the entry point.main.jsx; SocialStoryBuilderPage.jsx
    react-helmet-async
    ^3.0.0
    Manages document titles, SEO/social metadata, canonical tags, and structured data via HelmetProvider and Helmet. It is different from backend helmet.components/SEO.jsx; StructuredData.jsx; main.jsx
    react-redux
    ^9.3.0
    Connects React to Redux through Provider, useSelector, and useDispatch. Toolkit defines the store; this package connects components to it.main.jsx; feature pages and hooks
    react-router-dom
    ^7.18.4
    Maps URLs to pages and provides navigation, route parameters, and location state. Layout wraps the public routes.App.jsx; main.jsx

    Development tools

    Development package / rangeRoleSource
    @eslint/js
    ^10.0.1
    Standard JavaScript lint configurations; exact enabled rules cannot be verified without the omitted ESLint config.package.json
    @types/react
    ^19.2.18
    React type definitions for editor tooling and TypeScript consumers; this does not mean the JSX app uses TypeScript.package.json
    @types/react-dom
    ^19.2.7
    React DOM type definitions for tooling.package.json
    @vitejs/plugin-react
    ^6.1.1
    React integration and development refresh support for Vite; plugin wiring cannot be verified without the Vite config.package.json
    eslint
    ^10.10.0
    Static JavaScript checks through npm run lint; config not included.package.json
    eslint-plugin-react-hooks
    ^7.1.1
    Lint rules for hook usage and related React checks; enabled rules depend on omitted config.package.json
    eslint-plugin-react-refresh
    ^0.5.6
    Lint rules supporting Fast Refresh compatibility; config not supplied.package.json
    globals
    ^17.12.0
    Environment global-name lists for lint configuration.package.json
    vite
    ^8.3.0
    Development server, production asset build, and local build preview.package.json; scripts/build-prerender.mjs
    wait-on
    ^9.5.1
    Waits for the temporary preview server before SEO prerendering.scripts/build-prerender.mjs
    wrangler
    ^4.151.0
    Cloudflare tooling. wrangler.jsonc configures Worker/static assets; no deploy script is declared in package.json.wrangler.jsonc; package.json
    Helmet vs. React Helmet: backend helmet sets HTTP security headers; react-helmet-async controls titles, metadata, and document-head content.
    06 / BUILD & DELIVERY

    Vite builds it. Cloudflare serves it.

    1 · Developvite development server
    →
    2 · Buildvite build outputs assets
    →
    3 · Optional SEOPreview → wait-on → Playwright
    →
    4 · ServeWorker assets binding serves dist
    Optional SEO build

    build:seo runs Vite, then starts a preview server on port 4173. wait-on waits for it. prerender.mjs uses Playwright to render selected static pages and routine/story slugs obtained from the API into dist. Normal build does not run this extra step.

    Worker behavior

    worker/index.js forwards only /sitemap.xml to API_ORIGIN and returns XML with a one-hour cache header. Other requests use env.ASSETS.fetch. It is not a general API proxy. Browser API requests use VITE_API_BASE_URL independently.

    Configuration inputs

    VITE_API_BASE_URL configures Axios; VITE_PUBLIC_SITE_URL supports public sharing links. PRERENDER_API_URL and PRERENDER_PREVIEW_URL control prerender sources. Worker API_ORIGIN is for the sitemap. Frontend VITE variables are client-visible settings, not backend secrets.

    Archive completeness

    Supplied folders: src, scripts, worker, plus package.json and wrangler.jsonc. Missing: index.html, public assets, Vite/ESLint config, lockfile, and environment files. The prerender script imports Playwright, which is not declared in this package.json; it may be supplied by a wider workspace. This archive alone is not a verified runnable build.

    Rendering and validation scope

    The entry uses createRoot rather than hydrateRoot despite the optional captured HTML. Tests are present, but no test script is declared. This guide uses static source inspection; app tests, build, and live deployment were not run. No application source was changed.

    07 / FULL-STACK CONNECTIONS

    React and Node.js, connected.

    Frontend actionDestinationMeaning
    Browse catalogPublic API GET → PostgreSQLShared server content
    Save personal routine/storylocalStorage + ReduxBrowser save, not cloud save
    Resource request / general feedbackPOST /resource-requests or /feedbackBackend stores a community submission
    Helpfulness choicePOST /template-feedback30/min route limit plus global backend limit
    Load imagePublic URL, commonly R2Separate from JSON delivery
    Export PDFBrowser image processing + React PDFDoes not call sharp or a server PDF endpoint
    Manage shared catalog / upload imageBackend /api/admin endpointsAdmin frontend not supplied here
    SitemapCloudflare Worker → Node /sitemap.xmlBackend-generated sitemap exposed by website host

    Open the companion Node.js guide (keep both HTML files together).

    08 / SOURCE MAP

    Where to look in the code.

    AreaFiles
    Composition / navigationsrc/main.jsx; src/App.jsx
    API / cachingsrc/api/axiosClient.js; scopedCatalogApi.js; src/hooks/useScopedCatalog.js
    Storagesrc/store/store.js; store/slices/; RoutineBuilderEditor.jsx; social-stories/utils/storyStorage.js; useSavedStory.js
    Active PDF exportschedule/hooks/useSchedulePdf.jsx; social-stories/hooks/useStoryPdf.js; social-stories/utils/storyExport.js; utils/pdfBuffer.js
    Sharing / submissionsTemplateActions.jsx; templateSharing.js; FeedbackPage.jsx; RequestResourcePage.jsx
    Build / hostingpackage.json; scripts/build-prerender.mjs; scripts/prerender.mjs; wrangler.jsonc; worker/index.js