How rishikeshsv/mini-page-builder works
Project type + purpose (from README + file tree)
This is a single-page React application (Create React App–style) called “Mini Page Builder”. Its purpose is to let a user visually assemble a simple webpage by selecting elements (via a sidebar) and configuring them (via a canvas/config panel). It’s deployed as a static site (README links Surge).
• Client-only UI runtime (React in browser)
• Internal UI modules: Sidebar (element palette) + Canvas (render/configure page)
• State/data flow between those modules (selection → configuration → rendering)
• Build/serve pipeline (npm scripts → CRA dev server / static build → Surge)
There’s no backend directory, no API client, no DB. Treat it as a front-end app with internal components and state management.
File structure → architectural clues
Top-level:
• package.json, package-lock.json: npm-managed React app dependencies + scripts
• public/: static HTML shell and assets (index.html, manifest.json, etc.)
• src/: actual application code
• src/styles/: SCSS styling, including a CSS generator theme (cssGenerator.scss)
Key modules:
• src/App.js: top-level app composition (likely lays out sidebar + canvas)
• src/index.js: React entrypoint mounting into public/index.html
• src/modules/sidebar/*: sidebar UI + sidebar data model (SidebarData.js)
• src/modules/canvas/*: canvas UI + element configuration UI (ConfigureElement.jsx)
• src/styles/modules/*.scss: per-module styling (app/canvas/sidebar)
This is a feature/module-oriented component structure (modules grouped by feature rather than by pure component type).
What
For this project, “system design” is best represented as containers + components + runtime data flow.
Static hosting / Dev server
• Dev: CRA dev server (npm start)
• Prod: static bundle deployed to Surge (implied by README URL)
React SPA
• Entry: public/index.html + src/index.js
• Root component: src/App.js
Sidebar module
• src/modules/sidebar/index.jsx
• Data source: src/modules/sidebar/SidebarData.js (the “catalog” of available elements)
• Responsibilities to label:
• Element palette
• Emit “user selected element type” events
Canvas module
• src/modules/canvas/index.jsx
• Configuration component: src/modules/canvas/ConfigureElement.jsx
• Responsibilities to label:
• Render current page layout
• Manage selected element
• Provide configuration UI (ConfigureElement)
• Apply configuration to element representation
Styles subsystem
• Global + shared: src/styles/index.scss, common.scss
• CSS generator: src/styles/cssGenerator.scss (important: implies the app can produce CSS output or style rules)
• Module-scoped styles: src/styles/modules/{app,canvas,sidebar}.scss
“State / model” (even if not explicit in files)
Even if there’s no explicit store/ directory, the app definitely has an internal “page model” concept:
• Element definitions (from SidebarData.js)
• Page layout state (list/tree of elements placed on canvas)
• Selected element state
• Element properties/config (edited in ConfigureElement.jsx)
This as either:
• A central App state (owned by App.js and passed down), or
• Local state split across Canvas/Sidebar with callbacks
User → Sidebar
• User clicks an element type in the sidebar palette.
Sidebar → App/State
• Sidebar emits “add element of type X”
• App/state updates the page layout model.
State → Canvas
• Canvas renders the updated layout model.
User → Canvas
• User selects an element on the canvas.
Canvas → State
• Update “selectedElementId”
State → ConfigureElement
• ConfigureElement receives selected element + props
ConfigureElement → State
• Persist new props/styles into the page model
(Optional, if applicable) State → CSS Generator
• Generate CSS output or computed styles based on config
Styles (SCSS) → Rendered UI
• SCSS compiled into CSS during build; used by Sidebar/Canvas/App
• “Select element type”
• “Add element”
• “Select element instance”
• “Edit properties”
• “Re-render layout”
• “Generate CSS / apply styles”
Architectural patterns / principles to call out
• SPA / client-only architecture: everything runs in the browser; no server-side domain logic.
• Feature-module organization: modules/sidebar and modules/canvas are bounded UI contexts.
• Unidirectional data flow (typical React): UI events → state update → render.
• Separation of concerns:
• Sidebar = element catalog + selection UX
• Canvas = layout rendering + selection
• ConfigureElement = editing UI for a selected element
• Styles separated into SCSS files (global + module-level)