Skip to content

DatabiteDev/databite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Databite SDK

Databite SDK Hero

A comprehensive TypeScript SDK for building, managing, and executing connectors to third-party APIs. The Databite SDK provides a powerful, type-safe way to create integrations with external services, manage data synchronization, and build robust data pipelines.

πŸ—οΈ Architecture

The Databite SDK is built as a modular monorepo with the following packages:

databite/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ ai/             # AI-powered connector generator
β”‚   β”œβ”€β”€ build/          # Core SDK for building connectors
β”‚   β”œβ”€β”€ connect/        # React components for UI integration
β”‚   β”œβ”€β”€ connectors/     # Pre-built connector library
β”‚   β”œβ”€β”€ engine/         # Data synchronization and execution engine
β”‚   β”œβ”€β”€ flow/           # Flow engine for complex workflows
β”‚   β”œβ”€β”€ types/          # Shared TypeScript types
β”‚   └── example-webapp/ # Example Next.js web application

πŸ“¦ Packages

Core Packages

Integration Packages

πŸš€ Quick Start

Installation

# Install core packages
npm install @databite/build @databite/flow @databite/types

# Install additional packages as needed
npm install @databite/connectors @databite/sync @databite/connect

Basic Usage

import { createConnector, createFlow } from "@databite/build";
import { createFlow as createFlowBuilder } from "@databite/flow";

// Create a connector
const myConnector = createConnector()
  .withIdentity("my-service", "My Service")
  .withVersion("1.0.0")
  .withAuthor("Your Name")
  .withLogo("https://example.com/logo.png")
  .withDescription("Connector for My Service")
  .withAuthenticationFlow(
    createFlowBuilder("authenticate").httpBlock("auth", {
      url: "https://api.example.com/auth",
      method: "POST",
      body: { apiKey: "{{apiKey}}" },
    })
  )
  .withActions({
    getData: createAction({
      label: "Get Data",
      description: "Fetch data from the service",
      inputSchema: z.object({ id: z.string() }),
      outputSchema: z.object({ data: z.any() }),
      handler: async (params, connection) => {
        // Your implementation
        return { data: { id: params.id } };
      },
    }),
  })
  .build();

🎯 Key Concepts

Three-Tier Hierarchy

  1. Connector - A template/blueprint that defines what properties and configurations are available
  2. Integration - An instance of a connector where specific values have been filled in for the properties and configs
  3. Connection - When someone actually uses an integration to connect to a service

Core Features

  • πŸ”§ Connector Builder: Fluent API for defining connectors with full TypeScript support
  • ⚑ Flow Engine: Execute complex authentication and data workflows with automatic type inference
  • πŸ”„ Sync Engine: Handle recurring data synchronization with cron/interval scheduling
  • πŸ€– AI Generator: Automatically generate connectors from API documentation using AI
  • πŸ“Š Context Manager: Manage execution contexts and state across flows
  • 🎨 React Components: Pre-built UI components for easy integration

πŸ“š Documentation

Package Documentation

πŸ› οΈ Development

Prerequisites

  • Node.js >= 16.0.0
  • TypeScript >= 4.5.0
  • npm or yarn

Setup

# Clone the repository
git clone https://github.com/DatabiteDev/databite.git
cd databite

# Install dependencies
pnpm install

# Build all packages
pnpm run build:all

# Run tests
pnpm test

Project Structure

databite/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ ai/                       # AI-powered connector generator
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ analyzer.ts       # AI documentation analysis
β”‚   β”‚   β”‚   β”œβ”€β”€ crawler.ts        # Web documentation crawler
β”‚   β”‚   β”‚   β”œβ”€β”€ file-generator.ts # Connector file generation
β”‚   β”‚   β”‚   β”œβ”€β”€ generator.ts      # Main generation orchestrator
β”‚   β”‚   β”‚   └── cli.ts            # Command-line interface
β”‚   β”‚   └── README.md
β”‚   β”œβ”€β”€ build/                    # Core SDK
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   └── connector-builder/ # Builder implementation
β”‚   β”‚   β”œβ”€β”€ examples/             # Usage examples
β”‚   β”‚   └── README.md
β”‚   β”œβ”€β”€ connect/                  # React components
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ components/       # UI components
β”‚   β”‚   β”‚   └── hooks/           # React hooks
β”‚   β”‚   └── README.md
β”‚   β”œβ”€β”€ connectors/               # Pre-built connectors
β”‚   β”‚   β”œβ”€β”€ src/connectors/       # Connector implementations
β”‚   β”‚   └── README.md
β”‚   β”œβ”€β”€ flow/                     # Flow engine
β”‚   β”‚   β”œβ”€β”€ src/flow-builder/     # Flow builder implementation
β”‚   β”‚   └── README.md
β”‚   β”œβ”€β”€ engine/                   # Data synchronization and execution engine
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ sync-engine/      # Sync engine implementation
β”‚   β”‚   β”‚   β”œβ”€β”€ action-executer/  # Action execution logic
β”‚   β”‚   β”‚   β”œβ”€β”€ rate-limiter/     # Rate limiting functionality
β”‚   β”‚   β”‚   └── databite-engine/  # Main engine implementation
β”‚   β”‚   └── README.md
β”‚   β”œβ”€β”€ types/                    # Shared types
β”‚   β”‚   β”œβ”€β”€ src/types/            # Type definitions
β”‚   β”‚   └── README.md
β”‚   └── example-webapp/           # Example Next.js application
β”‚       β”œβ”€β”€ app/                  # Next.js app directory
β”‚       β”œβ”€β”€ components/           # Shared components
β”‚       └── README.md
└── webapp/                       # Example application (legacy)
    β”œβ”€β”€ app/                      # Next.js app directory
    β”œβ”€β”€ components/               # Shared components
    └── db/                       # Database schema

πŸš€ Release Workflow

Creating a Changeset

To document changes for a release:

# Create a changeset describing changes
pnpm changeset

Publishing a Release

When ready to release:

# When ready to release:
pnpm release

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

πŸ“‹ Code of Conduct

This project adheres to a Code of Conduct to ensure a welcoming and inclusive environment for all contributors and community members. We are committed to providing a harassment-free experience for everyone, regardless of background, identity, or experience level.

Please read our Code of Conduct to understand our community guidelines and expectations for participation.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

Releases

No releases published

Packages

No packages published