How liveduo/destack works
Project type and purpose
• Destack is an open-source tool / component library (distributed via NPM) that integrates into React and Next.js apps to provide a visual landing-page builder.
• It bundles a React client (the editor + page renderer), a server component (an API route that persists JSON and uploads), a CLI to wrap host-project build/dev scripts, and dozens of Tailwind-based themes.
File structure
• Top-level “lib” directory holds the published package code:
– lib/client → React/Craft.js & GrapesJS editor components and page providers
– lib/server → Node API handler (builder endpoint), file-storage logic, CLI bin shim
– lib/themes → a plugin-style theme collection (Tailblocks, Meraki UI, Hyper UI, Preline, Flowbite, Flowrift, etc.)
– lib/scripts → post-build utilities (patch-version)
– rollup.config.js → bundling config
• “dev” folder contains example host apps: Next.js starter, React starter, custom Next.js app.
• “e2e” folder: end-to-end tests for dev/build scenarios.
• “assets/design/overview.md” contains a higher-level architecture description.
• “scripts” folder holds automation for screenshots and previews.
README insights
• Two main run-modes: development (shows editor, writes default.json via API) and production (static HTML generation at build time).
• Integration points:
• Next.js: import ContentProvider & getStaticProps, pages/api/builder/handle.js → server.handleEditor
• React: CLI wraps react-scripts start/build, ContentProviderReact for components.
• Persisted state: default.json in repo (dev writes), public/ in production (static).