-
Notifications
You must be signed in to change notification settings - Fork 0
add example env for easier setup, better readme #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,2 @@ | ||
| NEXT_PUBLIC_FORMBRICKS_API_HOST=http://localhost:3000 | ||
| NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID=YOUR-ENVIRONMENT-ID | ||
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,36 +1,52 @@ | ||
| This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). | ||
| # Formbricks Playground | ||
|
|
||
| ## Getting Started | ||
| A demo application for testing and developing Formbricks in-product surveys. This Next.js app provides an interactive environment to test survey triggers, user actions, and attributes. | ||
|
|
||
| First, run the development server: | ||
| ## Setup | ||
|
|
||
| 1. Install dependencies: | ||
|
|
||
| ```bash | ||
| npm run dev | ||
| # or | ||
| yarn dev | ||
| # or | ||
| pnpm dev | ||
| # or | ||
| bun dev | ||
| pnpm install | ||
| ``` | ||
|
|
||
| 2. Create a `.env.local` file with your Formbricks credentials: | ||
|
|
||
| ```env | ||
| NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID=your-environment-id | ||
| NEXT_PUBLIC_FORMBRICKS_API_HOST=https://app.formbricks.com | ||
| ``` | ||
|
|
||
| Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
| You can find your environment ID in the Formbricks app under Settings → Setup. | ||
|
|
||
| You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. | ||
| 3. Start the development server: | ||
|
|
||
| This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. | ||
| ```bash | ||
| pnpm dev | ||
| ``` | ||
pandeymangg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Learn More | ||
| Open [http://localhost:3000](http://localhost:3000) to view the app. | ||
|
|
||
| To learn more about Next.js, take a look at the following resources: | ||
| ## Features | ||
|
|
||
| - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
| - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
| - **User Identification**: Set user IDs and pull user data from Formbricks | ||
| - **User Attributes**: Test setting single and multiple custom attributes | ||
| - **Actions**: Test both no-code and code actions | ||
| - **Email Setting**: Test user email functionality | ||
| - **Language Support**: Test multi-language survey delivery | ||
| - **Debug Mode**: Automatically enabled for detailed widget logs (check browser console) | ||
| - **Dark Mode**: Toggle between light and dark themes | ||
|
|
||
| You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! | ||
| ## Usage | ||
|
|
||
| ## Deploy on Vercel | ||
| The app provides interactive buttons to test various Formbricks SDK methods: | ||
|
|
||
| The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
| - `formbricks.setUserId()` - Set user ID and sync state | ||
| - `formbricks.setAttribute()` - Set individual attributes | ||
| - `formbricks.setAttributes()` - Set multiple attributes at once | ||
| - `formbricks.setEmail()` - Set user email | ||
| - `formbricks.setLanguage()` - Set user language | ||
| - `formbricks.track()` - Trigger code actions | ||
| - `formbricks.logout()` - Clear user session | ||
|
|
||
| Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. | ||
| Create surveys in your Formbricks app and use this playground to test triggers and targeting. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.