Technical Standards
Language-Specific
This document outlines the language-specific conventions for the Formbricks codebase, providing guidelines for writing code in TypeScript/JavaScript.
TypeScript
Our codebase follows the Vercel Engineering Style Guide conventions.
ESLint Configuration
We maintain three primary ESLint configurations for different project types:
- Library Configuration (for packages):
- React Configuration (for React applications):
- Next.js Configuration (for Next.js applications):
Key Conventions
-
TypeScript Usage
- Strict TypeScript checking enabled
- Explicit type annotations when necessary
- Proper interface and type naming (prefix with T for types, I for interfaces when helpful)
- No use of
any
type unless absolutely necessary
-
Imports/Exports
- Follow strict import ordering:
- Mocks (for testing)
- Server-only imports
- Third-party modules
- Internal
@formbricks/*
modules - Local aliases (`~/*)
- Relative imports
- Follow strict import ordering:
-
Error Handling
- Use typed error responses
- Proper error propagation
- Consistent error message formatting
- Implement error boundaries in React components
-
Async/Await
- Prefer async/await over raw promises
- Proper error handling in async functions
- Use Promise.all for parallel operations
-
React Specific
- Functional components with TypeScript
- Proper use of hooks
- Consistent prop typing
- Server Components by default in Next.js App Router
Code Formatting
We use Prettier with specific configurations:
Swift
Will be added upon release of the native iOS SDK.
Kotlin
Will be added upon release of the native Android SDK.
Was this page helpful?