Step 2 - Understand the project
Check out the folder structure
Open up the lightyear-integrations
project with your IDE and familiarize
yourself with the key files in the directory structure.
Understand the project structure
Main entry point
src/index.ts
This is the main entry point for the project. You can see that it imports the
taskManagement
collection and todoApp
integration.
Task management collection
src/taskManagement/index.ts
A collection is where we store the data that we sync between apps. The data in a collection is grouped into different models, each with an optional schema and optional matching rule.
This one is pretty simple, so it has only one model. But if you are syncing something like CRM data, you might have a model for contacts, another for companies, and another for deals.
For additional information on collections, see the Collections page.
TodoApp integration
src/todoApp/index.ts
Here we define both the custom app called todoApp
and the related sync
integration.
For additional information on custom apps, see the Apps and custom apps page.
For additional information on integrations, see the Integrations page.
TodoApp sync connector
src/todoApp/TodoApp.ts
A sync connector is a TypeScript class that defines how data is synced between the app and the collection. This is where we define things like the base URL, the authentication header, and which models we are syncing.
Task model connector
src/todoApp/TaskModel.ts
A model connector is a TypeScript class that synchronizes data between an app and a specific model within a collection. This is the real meat of the integration and it's where you define what endpoint you are using and how to map the data back and forth from the collection.