Giter Site home page Giter Site logo

thedanielchen / destack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liveduo/destack

0.0 1.0 0.0 4.19 MB

Page builder based on Next.js ๐Ÿ…ง, Tailwind CSS ๐Ÿƒ & Grapes.js ๐Ÿ‡. Zero-config deployment to Vercel ๐Ÿš€.

License: MIT License

JavaScript 79.83% CSS 0.78% Shell 0.20% TypeScript 19.19%

destack's Introduction

Destack ๐Ÿ”Œ Own your stack. Embrace your design.

Build landing pages visually right in your Next.js project. Deploy them zero further configuration!

Editor preview: Destack Online Builder

Example in production: prettyfunnels.com

Tutorial

What's Destack?

It's a tool to build landing pages within your Next.js project. It's powered by Grapes.js and includes the complete set of blocks from Tailblocks.cc. 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.

Features

๐Ÿงฑ Powerful Blocks

There are 92 well designed and heavily functional blocks from the Tailblocks project. Supports Tailwind's theme colors ie. Red, Yellow, Green, Blue, Indigo, Purple & Pink.

๐Ÿƒ Delightful Builder

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.

๐Ÿ•น Data Ownership

Destack stores all your assets on Github, Bitbucket etc through the editor. There are no external dependencies to manage or worry about.

๐Ÿž Assets & Forms Support

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.

๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ป Easy Setup & Deployment

Works existing & new Next.js projects. Requires minimal setup and no extra configuration to deploy your landing pages to production.

Getting Started

With a new project:

  • Fork the destack-starter project

  • OR deploy a project to Vercel:

  • OR preview it online with Gitpod:

With an existing project:

1. Install Destack on your Next.js project
npm i destack
2. Setup the builder endpoint

Create pages/api/builder/handle.js and add the following:

export { handleData as default, config } from 'destack/build/server'
3. Then create a new page

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>)
}

How it works

๐Ÿ›  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.

How to's & guides

Adding an HTML form

  • 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 (eg. api/submit.js)

Uploading images

  • 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
  • Notes: Images are uploaded to public/uploaded with their original filenames

Show editor in production

  • Install Destack to a new or existing project
  • Set showEditorInProd={true} in the ContentProvider component
  • The result should be similar to Destack Online Builder
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>)
}

Contributing to the project

See CONTRIBUTING.md

How is this possible?

This project was none's bright idea. It was not something 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.cc, without Mert's amazing designs none of this would have been possible.

Contributors

Made with contributors-img.

Upcoming Tasks

  • Custom tailwind.config.js file
  • Tests for local editor & editor in prod
  • Move builder API route to next.config.js

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.