Code Monkey home page Code Monkey logo

builder-test's Introduction

name slug description framework useCase css deployUrl demoUrl
Builder.io Personalization Starter
personalization-builder-io
Learn how to use Builder.io to personalize your Next.js pages.
Next.js
Starter
Edge Functions
Tailwind

Next.js + Builder.io Personalization Starter

This example walks you through personalizing Builder.io landing pages with Next.js.

Demo

https://nextjs-builder-edge-personalization.vercel.app

[hold ctrl + right click to show all the different personalization options from your space]

How to Use

You can choose from one of the following two methods to use this repository:

One-Click Deploy

After setting up your environment variables, deploy the example using Vercel:

Deploy with Vercel

Clone and Deploy

Execute create-next-app with npm or Yarn to bootstrap the example:

npx create-next-app --example https://github.com/vercel/examples/tree/main/edge-functions/personalization-builder-io
# or
yarn create next-app --example https://github.com/vercel/examples/tree/main/edge-functions/personalization-builder-io

Set up environment variables

To run this project, you need to do the following:

  1. Create a corresponding space in your account on Builder.io.
  2. Connect the two using the space's private and public keys.

Generating your Builder.io space

If you've just created your Builder.io account and logged in for the first time, Builder prompts you to create a space with a new Builder site or add Builder to an existing application. For this example, click Add Builder to an existing site or app.

Builder.io Welcome screen for creating a new Organization

You can choose to create a new Builder site or Add Builder to an existing application.

If you don't have the introductory prompt for creating a space, take the following steps. If you do have the prompt in the previous step, skip to step 4.

  1. Click on the Organization icon on the bottom left.

Space icon with two people standing together

The Organization icon features two figures and is on the left sidebar at the bottom.
  1. Hover over Builder.io and choose + New Space.

Menu options for creating a new space

Access the menu for creating a new space by clicking on the Organization icon.
  1. Click Add Builder to an existing site or app.

  2. When Builder asks you which e-commerce platform you use, select None.

  3. Name your new space by entering "My Next.js App" and click Create.

Dialogue for creating a new space

Enter a name for your new space, such as "My Next.js App".

Now that you have a new space, the next step is connecting this space with your next.js application.

Connecting Builder.io to your application

To connect your Builder.io space and your application, set the site URL and get the API key as follows:

  1. In Builder.io, click on the Account icon on the left sidenav.

Account icon in left sidenav

The Account icon takes you to important data about this space.
  1. Change the Site URL to http://localhost:3000 and click to copy the Public API Key.

Change the Site URL in account settings.

The Site URL and API Key are in the **Space** tab.
  1. In your code editor, rename .env.production.example to .env.production.local and .env.development.local and update it with the Public API Key as follows, but using your Public API Key that you copied in the previous step. For example:

    BUILDER_PUBLIC_KEY=08837cee608a405c806a3bed69acfe2d <-- replace this with your API Key

    Do the same for your private key

    BUILDER_PRIVATE_KEY=xxx-xxxxx <-- replace this with your private API Key

Running your application

Next, run Next.js in development mode:

npm install
npm run dev

# or

yarn
yarn dev

Deploy it to the cloud with Vercel (Documentation).

Experimenting

Now that you have a configured Builder.io space and a running application, start by creating a page, assign any URL, publish and preview. For more detail and ideas on creating pages, see Creating a landing page in Builder.io.

Create custom targeting attributes, those targeting attributes can be used when creating new content specific for a target audience.

Next steps

builder-test's People

Contributors

luctrate avatar

Watchers

 avatar

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.