-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
53 changed files
with
11,149 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.