Lightyear Docs
Connectors

Sync connectors

What is a sync connector?

A sync connector is a TypeScript class that defines the method of data exchange between your integration and an external application.

  • Purpose: It outlines how an integration can synchronize data with a specific app.
  • Details Included:
    • API URLs and endpoints
    • Authorization token management
    • Data models to be synchronized (e.g., contacts, deals, invoices)

In essence, a sync connector defines how the integration works.

Using a built-in sync connector

  • Convenience: We offer a growing library of built-in sync connectors for popular applications.
  • Extendability: If a built-in connector nearly meets your needs, you can extend or customize it to suit your specific requirements.

This approach allows for easy initiation with common integrations and provides the flexibility to adapt as your needs evolve.

Creating a custom sync connector

  • Unlimited Potential: If you need to sync with a system not yet supported, you can develop your own sync connector from scratch.
  • When to Create One:
    • Integrating with your own product
    • Connecting with uncommon or proprietary external systems
import { AuthType, SyncConnector } from "@runlightyear/lightyear";
import { TaskModel } from "./TaskModel";
 
export class TodoApp extends SyncConnector {
  static authType: AuthType = "APIKEY";
 
  getBaseUrl(): string {
    return "https://todo-app.lightyear.dev";
  }
 
  getModels() {
    return {
      task: new TaskModel({
        todoApp: this,
        connector: this,
        collectionName: this.collectionName,
        modelName: "task",
      }),
    };
  }
}

On this page