- This repository is a
pnpmworkspace managed with Turborepo. - The published SDK lives in
packages/js. - SDK source, helpers, and shared types live in
packages/js/src,packages/js/src/lib, andpackages/js/src/types. - The demo app lives in
apps/playgroundand exercises SDK behavior locally with Vite + React. - Generated output such as
dist/,coverage/, and.turbo/should not be edited by hand.
Run commands from the repo root unless you are working on a single package.
pnpm installinstalls workspace dependencies.pnpm devruns workspace dev tasks through Turbo; for interactive UI work, usepnpm --filter playground dev.pnpm buildbuilds all packages;pnpm --filter @formbricks/js buildrebuilds only the SDK.pnpm testruns workspace tests;pnpm test:coveragecollects coverage via Vitest.pnpm lintchecks formatting and lint rules with Biome.pnpm check-typesruns TypeScript without emitting output.pnpm cleanremoves local build artifacts.
- Biome is the formatter and linter.
- The repository uses 2-space indentation, double quotes, trailing commas, and semicolons.
- Prefer TypeScript modules and keep public exports in
packages/js/src/index.ts. - Use
camelCasefor variables and functions. - Use
PascalCasefor types and components. - Keep filenames descriptive; tests follow the source name, for example
load-formbricks.test.ts.
- SDK tests use Vitest and currently live beside the implementation under
packages/js/src. - Add or update
*.test.tsfiles when changing SDK behavior, especially proxy/loading logic insrc/lib. - Run
pnpm --filter @formbricks/js testbefore opening a PR. - Use
pnpm --filter @formbricks/js test:coveragewhen touching core runtime paths. - No explicit coverage threshold is configured, so contributors should cover new branches and regressions directly.
- Recent history follows Conventional Commits such as
fix: restore eslint 9andchore: bump minor dependencies. - Keep commit subjects short, imperative, and prefixed with
fix:,feat:,chore:, or similar. - PRs should explain the behavioral change and note affected packages (
packages/js,apps/playground, or both). - Link related issues when applicable.
- Include screenshots or short recordings for playground UI changes.
- Mention any required environment setup, such as
apps/playground/.envvariables, in the PR description.