This document outlines the language-specific conventions for the Formbricks codebase, providing guidelines for writing code in TypeScript/JavaScript.
any
type unless absolutely necessary@formbricks/*
modules~/*
)public
: SDK public API surface onlyinternal
: Internal SDK communication and shared componentsprivate
: Implementation details within specific classesprivate(set)
for read-only public propertiesFormbricks
) with static interfaceUserManager
, SurveyManager
, PresentSurveyManager
)FormbricksConfig.Builder
)FormbricksSDKErrorType
)LocalizedError
protocolFormbricksConfig
, UserManager
)environmentId
, setUserId
)FormbricksServiceProtocol
)// MARK:
comments for logical section separationstruct
for data models and value typesclass
for reference types and managersCodable
for JSON serialization/deserializationlet
over var
)OperationQueue
for network operationsNWPathMonitor
Formbricks
, Logger
, SDKError
)Survey
, User
)Guard.kt
, DateExtensions.kt
)SDKError
objectResult<T>
type for API responsesLogger
@Keep
annotations for ProGuard/R8 compatibility on public APIsFragmentManager
for UI componentssuspend
functions over callbackswithContext(Dispatchers.IO)
for network operationsdelay()
for robust API calls@SerializedName
String?
)