BlogGetting startedReact edition

How to run the Palatian React edition

Build the HTML edition once, then install, generate and start the React 19 app in the react folder. How the shell, the engine bridge and the generated pages fit together, and what the host needs for deep links.

2 min readPerforks

The React edition: build the HTML edition once, then install, generate and start the app in the react folder

The react/ folder is the same admin as a React 19 single-page app, built with Vite and React Router. It shares the stylesheet, the icon fonts and the engine with the HTML edition, so the two look and behave the same. It needs Node.js 20 or newer, like the HTML build.

Steps

  1. Build the HTML edition once. The React app copies the stylesheet, fonts and icons from dist/:
    cd palatian-v1.5.0
    npm install && npm run build
  2. Install and generate the React app:
    cd react
    npm install
    npm run generate   # converts dist/*.html into src/pages/*.jsx, writes routes and nav, copies assets
  3. Start it:
    npm run dev        # http://localhost:5174
    npm run build      # production build in react/dist
    npm run preview    # serves react/dist on port 4174
    npm test           # builds, serves and checks every route in Chromium

How it is put together

FileRole
src/shell/The persistent chrome as components: Dock, Panel, Toolbar, Footer, CommandBar and Inspector, with useDock() for the section, pin and overlay state and useRouterLinks(), which turns the template's plain page.html links into client-side navigation.
src/engine.jsImports the shared engine from ../src/js through the @engine alias and exposes it as window.Palatian, exactly as in the HTML edition. bootShell() runs once, scanPage() after every route render and releasePage() destroys the charts that left the DOM.
src/hooks/usePageEngine.jsCall it at the top of any page component. It scans the page for data-pl-* automations, forms and declarative charts, and runs an optional init such as a dashboard's chart init.
src/pages/*.jsxOne component per page, generated from the built HTML by scripts/generate.mjs. Regenerate after you change the HTML, or treat the files as your own and edit them directly.
src/routes.generated.js, src/nav.generated.jsThe route table with lazy-loaded pages and the navigation config.
public/assets/palatian.min.css, palatian.rtl.min.css, the icon fonts and the avatars, copied from the HTML build. Nothing is bundled twice.

Theme, preferences and RTL

window.Palatian.prefs, setTheme, setScheme and the Theme settings page work unchanged. A small script in react/index.html applies the stored preferences before React mounts and swaps in the right-to-left stylesheet when the stored direction is rtl, so there is no flash. See changing the mode, scheme and direction.

Things to know

  • Bootstrap's data API (dropdowns, modals, offcanvas, tabs, collapse) works on React-rendered markup because it listens on document. Tooltips are created by scanPage().
  • Inputs are rendered uncontrolled, with defaultValue and defaultChecked, so the demo markup stays editable. Wire your own state where you need it.
  • Deep links need the host to serve index.html for unknown paths, the usual single-page-app rewrite rule. Without it, a page refreshed at /orders returns the server's 404.

To add a page of your own, see adding a page to Palatian.