Skip to content

Commit

Permalink
Next 14 example app (#49)
Browse files Browse the repository at this point in the history
* init

* add examples

* Add server/client distinction; use growthbook-react

* Ensure no race conditions

* Clean up

* Switch to static; use revalidate

* Go with fetch polyfill approach

* Change copy/design/layout, add experiment support, fix rendering edge cases, dedicated hydration examples

---------

Co-authored-by: Jeremy Dorn <jeremy@jeremydorn.com>
  • Loading branch information
bttf and jdorn authored Apr 26, 2024
1 parent 8b47c35 commit 9b84a9a
Show file tree
Hide file tree
Showing 53 changed files with 11,149 additions and 45 deletions.
3 changes: 3 additions & 0 deletions next-js-pages/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions next-js-pages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
35 changes: 35 additions & 0 deletions next-js-pages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## GrowthBook Next.js Example

### Installation

Install dependencies

```bash
yarn install
```

### Set Up GrowthBook

First, create a GrowthBook account (either self-hosted or Cloud) - https://www.growthbook.io

Then, create a `.env.local` file in this repo with some environment variables:

```
NEXT_PUBLIC_GROWTHBOOK_API_HOST=
NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY=
```

Finally, create 2 simple feature flags in GrowthBook.

1. Feature key: `feature1`, Type: `Boolean (on/off)`
2. Feature key: `feature2`, Type: `String`

### Running the Example

Start the development server:

```bash
yarn dev
```

and open [http://localhost:3000](http://localhost:3000) with your browser to see it running
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions next-js-pages/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "growthbook-nextjs-example",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@growthbook/growthbook-react": "^0.17.0",
"@next/font": "13.1.2",
"@types/node": "18.11.18",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"cross-fetch": "^3.1.5",
"eslint": "8.32.0",
"eslint-config-next": "13.1.2",
"eventsource": "^2.0.2",
"next": "13.1.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "4.9.4"
},
"devDependencies": {}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 9b84a9a

Please sign in to comment.