A service that synchronizes data between the Drips database and search indices to power search functionality in the Drips application.
The service watches for changes to two types of data:
- Drip Lists
- Projects (GitHub repositories)
When changes are detected, it automatically updates the corresponding search indices.
The service follows a modular architecture centered around two main abstractions:
-
ChangeDetectionStrategy
: Defines how changes are detected in the source database -
Synchronizer
: Defines how changes are propagated to the search engine
graph LR
DB[(Drips DB)]
Search[(Search Engine)]
subgraph Service[Search Data Synchronizer]
CD[Change Detection Strategy]
Sync[Synchronizer]
end
CD --> |Changes| Sync
DB -.-> CD
Sync -.-> Search
classDef interface fill:#f9f,stroke:#333,stroke-dasharray: 5 5
class CD,Sync interface
The current implementation uses the following concrete implementations of the abstractions:
-
ChangeDetectionStrategy
→ Polling Strategy: Implements periodic polling of Postgres database -
Synchronizer
→MeiliSearch
: Manages MeiliSearch indices and updates
sequenceDiagram
participant DB as Postgres
participant Poll as Polling Strategy
participant Sync as MeiliSearchSynchronizer
participant Search as MeiliSearch
loop Every polling interval
Poll->>DB: Query changes since last sync
DB-->>Poll: Return changed records
Poll->>Sync: Send changes
Sync->>Search: Update indices
end
- Copy
.env.example
to.env
- Configure the environment variables according to your setup
- Run
docker compose up -d
to spin up MeiliSearch - Run
npm run dev
to run the app