Build landing pages visually right in your React or Next.js projects. Deploy them zero further configuration!
Examples: prettyfunnels.com, Destack Online Builder
π£ [17/12/2022] Destack v2 is now in beta. It's a major rewrite that comes new custom page builder based on Craft.js.
You can check it out at destack-starter-beta. More info at LiveDuo#62 and LiveDuo#22.
π£ [11/10/2022] Destack now supports multiple themes. Two new themes have been added Meraki UI and Hyper UI.
It's a tool to build landing pages within your React or Next.js projects. It's powered by Grapes.js and includes the complete set of blocks from Tailblocks, Meraki UI and Hyper UI. Supports asset uploading, form submission and a variaty of Tailwind colors.
Destack is a tool to help you stop worrying about the marketing pages and focus on your project.
Destack now supports theme selection.
Theme selection | Meraki UI (Components) |
Hyper UI (Components) | Tailblocks (Components) |
Tip: Change theme by clicking the theme icon.
There are hundreds of well designed and heavily functional blocks from Tailblocks, Meraki UI and Hyper UI. Supports Tailwind's theme colors ie. Red, Yellow, Green, Blue, Indigo, Purple & Pink.
Powered by Grapes.js, a flexible and feature-full editor similar to Webflow that supports margins, paddings, borders and a lot of others CSS-like options that are familiar to developers.
Destack stores all your assets on Github, Bitbucket etc through the editor. There are no external dependencies to manage or worry about.
Stores the images uploaded in the editor in your repository & displays them when needed on production. Also supports HTML and API form submission out of the box.
Works existing & new React and Next.js projects. Requires minimal setup and no extra configuration to deploy your landing pages to production.
-
Fork the destack-starter project
npm i destack
Create pages/api/builder/handle.js
and add the following:
export { handleData as default, config } from 'destack/build/server'
On any Next.js page you want to setup Destack:
import 'grapesjs/dist/css/grapes.min.css'
export { getStaticProps } from 'destack/build/server'
export { ContentProvider as default } from 'destack'
How to use along other components
import { ContentProvider } from 'destack'
import 'grapesjs/dist/css/grapes.min.css'
export { getStaticProps } from 'destack/build/server'
export default function Page(props) {
return (
<div style={{height: '100%'}}>
<span>Hello world</span>
<ContentProvider {...props}/>
</div>)
}
-
Fork the destack-react-starter project
npm i destack
In package.json
:
- Replace the "start" script with
destack -d \"react-scripts start\"
- Then, replace the "build" script with
destack -b \"react-scripts build\"
In any React.js component you want to setup Destack:
import 'grapesjs/dist/css/grapes.min.css'
export { ContentProviderReact as default } from 'destack'
How to use along other components
import 'grapesjs/dist/css/grapes.min.css'
import { ContentProviderReact } from 'destack'
const App = () => {
return (
<div style={{ height: '100%' }}>
<span>Hello world</span>
<ContentProviderReact />
</div>
)
}
export default App
π Destack is composed of two main components, the first is a React component that shows the editor or the generated page and the second is a Next.js API route that saves your progress to your repository.
π¨βπ» When you run the project in development
(ie. with npm run dev
) the React component understands it from the NODE_ENV
environment variable and shows you the editor where you can create your landing page visually.
π‘ Every change you make goes to the API route which updates a default.json
file. That file contains the HTML for your landing page and it remembers how you structure your page so you can come back later to update it.
π When is time to go in production
(ie. do npm run build
or deploy to Vercel) the React component reads NODE_ENV
again and statically generates the HTML version of the page you build in the editor from the default.json
file Destack created for you earlier.
Note: The above description is for Next.js. In React.js, the
destack -b
script creates an API route similar to the one described above that handles template changes and file uploads in development. In production thedestack -d
script copiesdefault.json
to thepublic
folder and builds a static version of the page.
- Drop a block that contains a form
- Click on the form & head to components settings
- Add form URL & check
async
if don't want a redirection - To handle a
async
forms you can create an API route- Next.js: Create a file in api/submit.js
- React.js: You will need a seperate Node.js server listening on
/api/submit
- Drop a block that contains an image or use image block
- Click on an image to open the upload modal
- Select the image you want to update and click on it to add it to the page
- Note: Images are uploaded to
public/uploaded
with their original filenames
- Install Destack to a new or existing project
- Set
showEditorInProd={true}
in theContentProvider
component - The result should be similar to Destack Online Builder
Note: this is only available for Next.js.
Code snippet
import { ContentProvider } from 'destack'
import 'grapesjs/dist/css/grapes.min.css'
export { getStaticProps } from 'destack/build/server'
export default function Page(props) {
return (
<div style={{height: '100%'}}>
<ContentProvider {...props} showEditorInProd={true}/>
</div>)
}
Create a new page file in pages
folder of the Next.js project and import destack
as described in #with-an-existing-nextjs-project to various pages.
Install a routing library such as react-router-dom
or router-tutorial
in the React.js project and import destack
as described in #with-a-new-reactjs-project to various routes. For more info check out destack-react-starter.
See CONTRIBUTING.md
This project was nothing that was planned and design in depth in advance. Instead it was evolved out of the need and enjoyment of using some amazing tools and prototype quickly. These projects heavily improved my developer life and a few of my friends'.
Next.js π § β Tailwind CSS π β Grapes.js π = π£π£
Please go and show these projects some love (βοΈ).
Don't forget to check out Tailblocks, Meraki UI and Hyper UI, without their amazing open sourced components none of this would have been possible.
Made with contributors-img.
- Custom tailwind.config.js file
- Add admin UI as a Next.js route
- Migrate to Craft.js (or similar)