Skip to main content

Overview

The @databite/connectors package provides ready-to-use connectors for popular services. Each connector follows the same structure: authentication, typed configuration, actions, and optional syncs. Use them on your server with @databite/server and connect from your app with @databite/connect.

Installation

npm install @databite/connectors @databite/build @databite/types
Peer Dependencies:
npm install zod typescript

Connector Structure

connectors/
└── example-service/
    ├── index.ts            # Connector definition (entry point)
    ├── actions/            # Actions (API calls)
         ├── sendMessage.ts
         └── listItems.ts
    └── syncs/              # Sync handlers (optional)
        ├── syncUsers.ts
        └── syncItems.ts

Generic Usage

import { exampleService } from "@databite/connectors";

// Create an integration on your server
await server.addIntegration(
  exampleService.createIntegration("Example Service", {
    // Integration configuration (varies by connector)
    apiKey: process.env.EXAMPLE_API_KEY!,
    baseUrl: process.env.EXAMPLE_BASE_URL!,
  })
);
Use with @databite/connect on the client to authenticate and create a connection via your server.

Configuration

Connector configuration mirrors the service’s requirements. A typical pattern:
// Integration config (static per integration)
const integrationConfig = {
  apiKey: process.env.EXAMPLE_API_KEY!,
  baseUrl: process.env.EXAMPLE_BASE_URL!,
};

// Connection config (set during client authentication)
// e.g. accessToken, userId, workspaceId, etc.