@databricks/appkit | AppKit

Core library for building Databricks applications with type-safe SQL queries, plugin architecture, and React integration.

Enumerations

EnumerationDescription
RequestedClaimsPermissionSetPermission set for Unity Catalog table access
ResourceTypeResource types from schema $defs.resourceType.enum

Classes

ClassDescription
AppKitErrorBase error class for all AppKit errors. Provides a consistent structure for error handling across the framework.
AuthenticationErrorError thrown when authentication fails. Use for missing tokens, invalid credentials, or authorization failures.
ConfigurationErrorError thrown when configuration is missing or invalid. Use for missing environment variables, invalid settings, or setup issues.
ConnectionErrorError thrown when a connection or network operation fails. Use for database pool errors, API failures, timeouts, etc.
ExecutionErrorError thrown when an operation execution fails. Use for statement failures, canceled operations, or unexpected states.
InitializationErrorError thrown when a service or component is not properly initialized. Use when accessing services before they are ready.
PluginBase abstract class for creating AppKit plugins.
ResourceRegistryCentral registry for tracking plugin resource requirements. Deduplication uses type + resourceKey (machine-stable); alias is for display only.
ServerErrorError thrown when server lifecycle operations fail. Use for server start/stop issues, configuration conflicts, etc.
TunnelErrorError thrown when remote tunnel operations fail. Use for tunnel connection issues, message parsing failures, etc.
ValidationErrorError thrown when input validation fails. Use for invalid parameters, missing required fields, or type mismatches.

Interfaces

InterfaceDescription
BasePluginConfigBase configuration interface for AppKit plugins
CacheConfigConfiguration for the CacheInterceptor. Controls TTL, size limits, storage backend, and probabilistic cleanup.
DatabaseCredentialDatabase credentials with OAuth token for Postgres connection
EndpointConfig-
GenerateDatabaseCredentialRequestRequest parameters for generating database OAuth credentials
ITelemetryPlugin-facing interface for OpenTelemetry instrumentation. Provides a thin abstraction over OpenTelemetry APIs for plugins.
LakebasePoolConfigConfiguration for creating a Lakebase connection pool
PluginManifestPlugin manifest that declares metadata and resource requirements. Attached to plugin classes as a static property. Extends the shared PluginManifest with strict resource types.
RequestedClaimsOptional claims for fine-grained Unity Catalog table permissions When specified, the returned token will be scoped to only the requested tables
RequestedResourceResource to request permissions for in Unity Catalog
ResourceEntryInternal representation of a resource in the registry. Extends ResourceRequirement with resolution state and plugin ownership.
ResourceFieldEntryDefines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key).
ResourceRequirementDeclares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements(). Narrows the generated base: type → ResourceType enum, permission → ResourcePermission union.
ServingEndpointEntryShape of a single registry entry.
ServingEndpointRegistryRegistry interface for serving endpoint type generation. Empty by default — augmented by the Vite type generator's .d.ts output via module augmentation. When populated, provides autocomplete for alias names and typed request/response/chunk per endpoint.
StreamExecutionSettingsExecution settings for streaming endpoints. Extends PluginExecutionSettings with SSE stream configuration.
TelemetryConfigOpenTelemetry configuration for AppKit applications
ValidationResultResult of validating all registered resources against the environment.

Type Aliases

Type AliasDescription
ConfigSchemaConfiguration schema definition for plugin config. Re-exported from the standard JSON Schema Draft 7 types.
ExecutionResultDiscriminated union for plugin execution results.
IAppRouterExpress router type for plugin route registration
PluginDataTuple of plugin class, config, and name. Created by toPlugin() and passed to createApp().
ResourcePermissionUnion of all possible permission levels across all resource types.
ServingFactoryFactory function returned by AppKit.serving.
ToPluginFactory function type returned by toPlugin(). Accepts optional config and returns a PluginData tuple.

Variables

VariableDescription
sqlSQL helper namespace

Functions

FunctionDescription
appKitServingTypesPluginVite plugin to generate TypeScript types for AppKit serving endpoints. Fetches OpenAPI schemas from Databricks and generates a .d.ts with ServingEndpointRegistry module augmentation.
appKitTypesPluginVite plugin to generate types for AppKit queries. Calls generateFromEntryPoint under the hood.
createAppBootstraps AppKit with the provided configuration.
createLakebasePoolCreate a Lakebase pool with appkit's logger integration. Telemetry automatically uses appkit's OpenTelemetry configuration via global registry.
extractServingEndpointsExtract serving endpoint config from a server file by AST-parsing it. Looks for serving({ endpoints: { alias: { env: "..." }, ... } }) calls and extracts the endpoint alias names and their environment variable mappings.
findServerFileFind the server entry file by checking candidate paths in order.
generateDatabaseCredentialGenerate OAuth credentials for Postgres database connection using the proper Postgres API.
getExecutionContextGet the current execution context.
getLakebaseOrmConfigGet Lakebase connection configuration for ORMs that don't accept pg.Pool directly.
getLakebasePgConfigGet Lakebase connection configuration for PostgreSQL clients.
getPluginManifestLoads and validates the manifest from a plugin constructor. Normalizes string type/permission to strict ResourceType/ResourcePermission.
getResourceRequirementsGets the resource requirements from a plugin's manifest.
getUsernameWithApiLookupResolves the PostgreSQL username for a Lakebase connection.
getWorkspaceClientGet workspace client from config or SDK default auth chain
isSQLTypeMarkerType guard to check if a value is a SQL type marker