|
1 | | -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). |
| 1 | +# Formbricks Playground |
2 | 2 |
|
3 | | -## Getting Started |
| 3 | +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. |
4 | 4 |
|
5 | | -First, run the development server: |
| 5 | +## Setup |
| 6 | + |
| 7 | +1. Install dependencies: |
6 | 8 |
|
7 | 9 | ```bash |
8 | | -npm run dev |
9 | | -# or |
10 | | -yarn dev |
11 | | -# or |
12 | | -pnpm dev |
13 | | -# or |
14 | | -bun dev |
| 10 | +pnpm install |
| 11 | +``` |
| 12 | + |
| 13 | +2. Create a `.env.local` file with your Formbricks credentials: |
| 14 | + |
| 15 | +```env |
| 16 | +NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID=your-environment-id |
| 17 | +NEXT_PUBLIC_FORMBRICKS_API_HOST=https://app.formbricks.com |
15 | 18 | ``` |
16 | 19 |
|
17 | | -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
| 20 | +You can find your environment ID in the Formbricks app under Settings → Setup. |
18 | 21 |
|
19 | | -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. |
| 22 | +3. Start the development server: |
20 | 23 |
|
21 | | -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. |
| 24 | +```bash |
| 25 | +pnpm dev |
| 26 | +``` |
22 | 27 |
|
23 | | -## Learn More |
| 28 | +Open [http://localhost:3000](http://localhost:3000) to view the app. |
24 | 29 |
|
25 | | -To learn more about Next.js, take a look at the following resources: |
| 30 | +## Features |
26 | 31 |
|
27 | | -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. |
28 | | -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. |
| 32 | +- **User Identification**: Set user IDs and pull user data from Formbricks |
| 33 | +- **User Attributes**: Test setting single and multiple custom attributes |
| 34 | +- **Actions**: Test both no-code and code actions |
| 35 | +- **Email Setting**: Test user email functionality |
| 36 | +- **Language Support**: Test multi-language survey delivery |
| 37 | +- **Debug Mode**: Automatically enabled for detailed widget logs (check browser console) |
| 38 | +- **Dark Mode**: Toggle between light and dark themes |
29 | 39 |
|
30 | | -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! |
| 40 | +## Usage |
31 | 41 |
|
32 | | -## Deploy on Vercel |
| 42 | +The app provides interactive buttons to test various Formbricks SDK methods: |
33 | 43 |
|
34 | | -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. |
| 44 | +- `formbricks.setUserId()` - Set user ID and sync state |
| 45 | +- `formbricks.setAttribute()` - Set individual attributes |
| 46 | +- `formbricks.setAttributes()` - Set multiple attributes at once |
| 47 | +- `formbricks.setEmail()` - Set user email |
| 48 | +- `formbricks.setLanguage()` - Set user language |
| 49 | +- `formbricks.track()` - Trigger code actions |
| 50 | +- `formbricks.logout()` - Clear user session |
35 | 51 |
|
36 | | -Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. |
| 52 | +Create surveys in your Formbricks app and use this playground to test triggers and targeting. |
0 commit comments