How hihayk/shaper works
File structure
• Top-level:
• package.json – lists React and build tools
• public/ – static entry point (index.html, manifest, robots.txt)
• src/ – all React source code, CSS, utilities, and tests
• src/index.js boots the React app and registers the service worker.
• src/App.js is the root component, importing CSS, subcomponents, and utilities.
• src/components/ – domain components:
• demo-email – UI to preview email styling
• specs – UI to list and edit style specifications
• settings – UI for application-level settings
• src/utilities.js, variables.js – shared logic and design tokens.
• serviceWorker.js – manages offline caching.
README
• Confirms it’s a client-side, in-browser interface style editor, with no external services.
a. Main components
• Web Browser (entry point)
• Static Assets (public/index.html, CSS, JS bundles)
• Service Worker (optional caching layer)
• React Root (App.js)
• Component Modules:
– DemoEmail Component
– Specs Component
– Settings Component
• Shared Libraries & Utilities (utilities.js, variables.js, CSS files)
b. Relationships and interactions
• Browser requests index.html → loads JS bundle
• Service Worker intercepts requests, serves cached assets if available
• index.js mounts App.js into the DOM
• App.js orchestrates state and passes props into DemoEmail, Specs, Settings
• Components import and apply CSS modules and consume tokens from variables.js
• Utilities provide helper functions to components (e.g., parsing style specs)
c. Architectural patterns & design principles
• Component-based UI (React)
• Single source of truth for design tokens (variables.js)
• Separation of concerns: styling (CSS), logic (utilities.js), presentation (components)
• Offline capability via service worker
d. Key technologies & libraries
• React (via package.json)
• create-react-app conventions (public/, serviceWorker.js)
• CSS modules and global CSS files (common.css, demo.css, settings.css, etc.)
• Jest + React Testing Library (App.test.js, setupTests.js)
Summary of essential elements
• Top-level components (public vs. src, service worker, root component, subcomponents, utilities)