meilibridge 0.1.6

High-performance PostgreSQL to Meilisearch connector
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
# API & Development Guide

This guide covers the MeiliBridge REST API, development practices, testing strategies, and future recommendations.

## Table of Contents
- [API Documentation]#api-documentation
- [Authentication & Security]#authentication--security
- [API Endpoints]#api-endpoints
- [WebSocket Support]#websocket-support
- [Development Guide]#development-guide
- [Testing Strategies]#testing-strategies
- [Client SDKs]#client-sdks
- [Future Recommendations]#future-recommendations

## API Documentation

### Overview

MeiliBridge provides a comprehensive REST API for managing sync tasks, monitoring health, and accessing metrics. The API follows RESTful principles and returns JSON responses.

**Base URL**: `http://localhost:7708/api/v1`

### API Design Principles

1. **RESTful**: Standard HTTP methods (GET, POST, PUT, DELETE)
2. **Consistent**: Predictable URL patterns and response formats
3. **Versioned**: API version in URL path
4. **Documented**: OpenAPI/Swagger specification available
5. **Secure**: Authentication required for write operations

### Response Format

All API responses follow this structure:

**Success Response**:
```json
{
  "success": true,
  "data": { ... },
  "meta": {
    "timestamp": "2024-01-01T00:00:00Z",
    "version": "1.0.0"
  }
}
```

**Error Response**:
```json
{
  "success": false,
  "error": {
    "code": "TASK_NOT_FOUND",
    "message": "Task with ID 'users_sync' not found",
    "details": { ... }
  },
  "meta": {
    "timestamp": "2024-01-01T00:00:00Z",
    "request_id": "req_123abc"
  }
}
```

### HTTP Status Codes

| Status Code | Description |
|-------------|-------------|
| 200 OK | Successful request |
| 201 Created | Resource created successfully |
| 204 No Content | Successful request with no response body |
| 400 Bad Request | Invalid request parameters |
| 401 Unauthorized | Missing or invalid authentication |
| 403 Forbidden | Insufficient permissions |
| 404 Not Found | Resource not found |
| 409 Conflict | Resource conflict (e.g., duplicate) |
| 422 Unprocessable Entity | Validation error |
| 429 Too Many Requests | Rate limit exceeded |
| 500 Internal Server Error | Server error |

## Authentication & Security

### Bearer Token Authentication

Include the API token in the Authorization header:
```http
Authorization: Bearer your-api-token
```

**Example**:
```bash
curl -H "Authorization: Bearer ${API_TOKEN}" \
  http://localhost:7708/api/v1/tasks
```

### API Token Configuration

```yaml
api:
  auth:
    enabled: true
    type: "bearer"
    tokens:
      - name: "admin"
        token: "${API_ADMIN_TOKEN}"
        role: "admin"
        permissions: ["read", "write", "admin"]
      
      - name: "readonly"
        token: "${API_READONLY_TOKEN}"
        role: "read"
        permissions: ["read"]
      
      - name: "operator"
        token: "${API_OPERATOR_TOKEN}"
        role: "operator"
        permissions: ["read", "write"]
```

### Role-Based Permissions

| Role | Permissions |
|------|-------------|
| admin | Full access to all endpoints |
| operator | Read/write access, no admin endpoints |
| read | Read-only access to all endpoints |

## API Endpoints

### Health & Monitoring

#### GET /health
Health check endpoint.

**Response**:
```json
{
  "status": "healthy",
  "components": {
    "postgresql": {
      "status": "healthy",
      "message": null,
      "details": {
        "pool_size": 10,
        "pool_available": 8
      }
    },
    "meilisearch": {
      "status": "healthy",
      "message": null,
      "details": {
        "version": "1.5.0"
      }
    },
    "api": {
      "status": "healthy",
      "message": null,
      "details": {
        "uptime_seconds": 3600
      }
    }
  },
  "version": "1.0.0",
  "uptime_seconds": 3600
}
```

#### GET /health/:component
Get health status for a specific component.

**Parameters**:
- `component`: Component name (postgresql, meilisearch, redis, api)

#### GET /metrics
Prometheus-compatible metrics endpoint.

**Response**: Prometheus text format
```
# HELP meilibridge_cdc_events_total Total number of CDC events received
# TYPE meilibridge_cdc_events_total counter
meilibridge_cdc_events_total{table="users",event_type="insert"} 1234

# HELP meilibridge_cdc_lag_bytes CDC replication lag in bytes
# TYPE meilibridge_cdc_lag_bytes gauge
meilibridge_cdc_lag_bytes{slot="meilibridge_slot"} 1024
```

### Task Management

#### GET /api/v1/tasks
List all sync tasks.

**Query Parameters**:
- `status`: Filter by status (active, paused, failed)
- `table`: Filter by table name
- `page`: Page number (default: 1)
- `limit`: Items per page (default: 20)

**Response**:
```json
{
  "success": true,
  "data": {
    "tasks": [
      {
        "id": "users_sync",
        "status": "active",
        "table": "public.users",
        "index": "users",
        "events_processed": 12345,
        "last_error": null,
        "last_sync_at": "2024-01-01T00:00:00Z",
        "created_at": "2024-01-01T00:00:00Z",
        "config": { ... }
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 5,
      "pages": 1
    }
  }
}
```

#### GET /api/v1/tasks/:id
Get specific task details.

**Response**:
```json
{
  "success": true,
  "data": {
    "id": "users_sync",
    "status": "active",
    "table": "public.users",
    "index": "users",
    "primary_key": "id",
    "events_processed": 12345,
    "events_failed": 10,
    "last_error": null,
    "last_sync_at": "2024-01-01T00:00:00Z",
    "created_at": "2024-01-01T00:00:00Z",
    "position": {
      "lsn": "0/1234567",
      "xid": 789
    },
    "statistics": {
      "insert_count": 5000,
      "update_count": 6000,
      "delete_count": 1345,
      "avg_latency_ms": 125
    },
    "config": {
      "full_sync_on_start": true,
      "batch_size": 1000,
      "batch_timeout_ms": 1000
    }
  }
}
```

#### POST /api/v1/tasks
Create a new sync task.

**Request Body**:
```json
{
  "id": "products_sync",
  "table": "public.products",
  "index": "products",
  "primary_key": "sku",
  "full_sync_on_start": true,
  "auto_start": true,
  "filter": {
    "event_types": ["create", "update"],
    "conditions": [
      {
        "field": "active",
        "op": "equals",
        "value": true
      }
    ]
  },
  "transform": {
    "fields": {
      "public.products": {
        "price": {
          "type": "multiply",
          "factor": 100,
          "to": "price_cents"
        }
      }
    }
  },
  "options": {
    "batch_size": 500,
    "batch_timeout_ms": 2000
  }
}
```

#### PUT /api/v1/tasks/:id
Update task configuration.

**Request Body**: Same as POST /api/v1/tasks

#### DELETE /api/v1/tasks/:id
Delete a sync task.

**Query Parameters**:
- `force`: Force delete even if task is active (default: false)

#### POST /api/v1/tasks/:id/pause
Pause a sync task.

**Response**:
```json
{
  "success": true,
  "data": {
    "id": "users_sync",
    "status": "paused",
    "paused_at": "2024-01-01T00:00:00Z"
  }
}
```

#### POST /api/v1/tasks/:id/resume
Resume a paused sync task.

#### POST /api/v1/tasks/:id/full-sync
Trigger a full synchronization for a task.

**Request Body** (optional):
```json
{
  "start_from": "2024-01-01T00:00:00Z",
  "batch_size": 5000,
  "where_clause": "created_at > '2024-01-01'"
}
```

#### GET /api/v1/tasks/:id/stats
Get detailed statistics for a task.

**Response**:
```json
{
  "success": true,
  "data": {
    "events_per_second": 125.5,
    "avg_latency_ms": 45,
    "p95_latency_ms": 120,
    "p99_latency_ms": 250,
    "error_rate": 0.001,
    "lag_bytes": 1024,
    "lag_seconds": 2.5,
    "time_series": {
      "events_per_minute": [120, 135, 110, ...],
      "errors_per_minute": [0, 1, 0, ...]
    }
  }
}
```

### Dead Letter Queue

#### GET /api/v1/dead-letters
Get dead letter queue statistics.

**Response**:
```json
{
  "success": true,
  "data": {
    "total_entries": 25,
    "entries_by_task": {
      "users_sync": 10,
      "orders_sync": 15
    },
    "entries_by_error": {
      "Serialization error": 12,
      "Network timeout": 8,
      "Validation error": 5
    },
    "oldest_entry": "2024-01-01T00:00:00Z",
    "newest_entry": "2024-01-02T00:00:00Z"
  }
}
```

#### POST /api/v1/dead-letters/:task_id/reprocess
Reprocess dead letter entries for a task.

**Request Body**:
```json
{
  "limit": 100,
  "error_type": "Network timeout"
}
```

### CDC Control

#### POST /api/v1/cdc/pause
Pause all CDC consumption.

#### POST /api/v1/cdc/resume
Resume CDC consumption.

#### GET /api/v1/cdc/status
Get CDC status and statistics.

**Response**:
```json
{
  "success": true,
  "data": {
    "status": "active",
    "slots": [
      {
        "name": "meilibridge_slot",
        "active": true,
        "lag_bytes": 1024,
        "lag_seconds": 2.5,
        "restart_lsn": "0/1234567",
        "confirmed_flush_lsn": "0/1234560"
      }
    ],
    "publications": [
      {
        "name": "meilibridge_pub",
        "tables": ["public.users", "public.orders"]
      }
    ]
  }
}
```

### Source Management

#### GET /api/v1/sources
List configured sources.

#### GET /api/v1/sources/:id
Get source details and status.

#### POST /api/v1/sources/test
Test source connection.

**Request Body**:
```json
{
  "type": "postgresql",
  "config": {
    "host": "localhost",
    "port": 5432,
    "database": "test",
    "user": "postgres",
    "password": "secret"
  }
}
```

### Parallel Processing

#### GET /api/v1/parallel/status

Get parallel processing status and configuration.

**Response**:
```json
{
  "success": true,
  "data": {
    "enabled": true,
    "workers_per_table": 4,
    "max_concurrent_events": 1000,
    "work_stealing_enabled": true,
    "tables": [
      {
        "table_name": "public.users",
        "queue_size": 125,
        "workers": 4
      },
      {
        "table_name": "public.orders",
        "queue_size": 50,
        "workers": 4
      }
    ]
  }
}
```

#### GET /api/v1/parallel/queues

Get current queue sizes for all tables.

**Response**:
```json
{
  "success": true,
  "data": {
    "queues": {
      "public.users": 125,
      "public.orders": 50,
      "public.products": 0
    },
    "total_events": 175
  }
}
```

### Metrics

#### GET /api/v1/metrics

Get Prometheus metrics in text format.

**Response**:
```text
# HELP meilibridge_cdc_events_total Total number of CDC events received
# TYPE meilibridge_cdc_events_total counter
meilibridge_cdc_events_total{table="public.users",event_type="insert"} 1234
meilibridge_cdc_events_total{table="public.users",event_type="update"} 567

# HELP meilibridge_parallel_queue_size Current number of events in parallel processing queue
# TYPE meilibridge_parallel_queue_size gauge
meilibridge_parallel_queue_size{table="public.users"} 125
meilibridge_parallel_queue_size{table="public.orders"} 50

# HELP meilibridge_parallel_worker_events_total Total number of events processed by parallel workers
# TYPE meilibridge_parallel_worker_events_total counter
meilibridge_parallel_worker_events_total{table="public.users",worker_id="0"} 5000
meilibridge_parallel_worker_events_total{table="public.users",worker_id="1"} 4800

# HELP meilibridge_statement_cache_size Current number of cached prepared statements
# TYPE meilibridge_statement_cache_size gauge
meilibridge_statement_cache_size 42

# HELP meilibridge_statement_cache_hits_total Total number of statement cache hits
# TYPE meilibridge_statement_cache_hits_total counter
meilibridge_statement_cache_hits_total 8234

# HELP meilibridge_statement_cache_hit_rate Statement cache hit rate (0.0 to 1.0)
# TYPE meilibridge_statement_cache_hit_rate gauge
meilibridge_statement_cache_hit_rate 0.85
```

### Statement Cache Management

MeiliBridge includes a prepared statement cache for PostgreSQL queries to improve performance:

#### GET /api/v1/cache/stats

Get statement cache statistics.

**Response**:
```json
{
  "size": 42,
  "hits": 8234,
  "misses": 1412,
  "evictions": 12,
  "hit_rate": 0.85,
  "enabled": true,
  "max_size": 100
}
```

#### POST /api/v1/cache/clear

Clear the statement cache.

**Response**:
```json
{
  "message": "Statement cache cleared",
  "cleared_count": 42
}
```

## WebSocket Support

### Real-time Event Streaming

Connect to WebSocket endpoint for real-time CDC events:
```javascript
const ws = new WebSocket('ws://localhost:7708/ws/events');

ws.on('message', (data) => {
  const event = JSON.parse(data);
  console.log('CDC Event:', event);
});
```

**Event Format**:
```json
{
  "type": "cdc_event",
  "data": {
    "id": "evt_123",
    "table": "users",
    "action": "insert",
    "data": { ... },
    "timestamp": "2024-01-01T00:00:00Z"
  }
}
```

### Subscribing to Specific Tables

```javascript
ws.send(JSON.stringify({
  "action": "subscribe",
  "tables": ["users", "orders"]
}));
```

## Development Guide

### Project Structure

```
meilibridge/
├── src/
│   ├── api/           # API server implementation
│   ├── config/        # Configuration structures
│   ├── source/        # Source adapters (PostgreSQL, etc.)
│   ├── destination/   # Destination adapters (Meilisearch)
│   ├── pipeline/      # Event processing pipeline
│   ├── dlq/           # Dead letter queue
│   ├── metrics/       # Prometheus metrics
│   ├── health/        # Health checks
│   └── main.rs        # Application entry point
├── tests/
│   ├── unit/          # Unit tests
│   ├── integration/   # Integration tests
│   └── e2e/           # End-to-end tests
├── docs/              # Documentation
├── scripts/           # Utility scripts
└── Cargo.toml         # Rust dependencies
```

### Development Setup

1. **Install Dependencies**:
```bash
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install development tools
cargo install cargo-watch cargo-tarpaulin cargo-audit
```

2. **Run Development Server**:
```bash
# Watch mode with auto-reload
cargo watch -x run

# With specific log level
RUST_LOG=debug cargo run
```

3. **Code Formatting**:
```bash
# Format code
cargo fmt

# Check formatting
cargo fmt -- --check
```

4. **Linting**:
```bash
# Run clippy
cargo clippy -- -D warnings

# Fix clippy warnings
cargo clippy --fix
```

### Best Practices

#### Error Handling

Use the custom error types:
```rust
use crate::error::{MeiliBridgeError, Result};

pub async fn process_event(event: Event) -> Result<()> {
    validate_event(&event)
        .map_err(|e| MeiliBridgeError::Validation(e.to_string()))?;
    
    // Process event
    Ok(())
}
```

#### Logging

Use structured logging with tracing:
```rust
use tracing::{info, debug, error, warn, instrument};

#[instrument(
    name = "process_event",
    skip(event),
    fields(
        table = %event.table,
        event_type = ?event.event_type
    )
)]
pub async fn handle_event(event: Event) -> Result<()> {
    debug!("Starting event processing");
    
    let start = std::time::Instant::now();
    
    match process_event(event).await {
        Ok(_) => {
            info!(
                duration_ms = start.elapsed().as_millis(),
                "Event processed successfully"
            );
        }
        Err(e) => {
            error!(
                error = %e,
                duration_ms = start.elapsed().as_millis(),
                "Failed to process event"
            );
        }
    }
    
    Ok(())
}
```

#### Async Best Practices

1. **Use tokio for async runtime**:
```rust
#[tokio::main]
async fn main() -> Result<()> {
    // Application code
}
```

2. **Avoid blocking operations**:
```rust
// Bad
std::thread::sleep(Duration::from_secs(1));

// Good
tokio::time::sleep(Duration::from_secs(1)).await;
```

3. **Use channels for communication**:
```rust
use tokio::sync::mpsc;

let (tx, mut rx) = mpsc::channel(100);

// Producer
tokio::spawn(async move {
    tx.send(event).await.unwrap();
});

// Consumer
while let Some(event) = rx.recv().await {
    process_event(event).await?;
}
```

## Testing Strategies

### Unit Testing

Test individual components in isolation:

```rust
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_event_filter() {
        let filter = EventFilter::new(FilterConfig {
            event_types: vec!["insert".to_string()],
            ..Default::default()
        });
        
        let event = Event {
            event_type: EventType::Insert,
            ..Default::default()
        };
        
        assert!(filter.should_process(&event));
    }
    
    #[tokio::test]
    async fn test_async_processor() {
        let processor = EventProcessor::new();
        let result = processor.process(test_event()).await;
        assert!(result.is_ok());
    }
}
```

### Integration Testing

Test component interactions:

```rust
#[tokio::test]
async fn test_cdc_to_meilisearch_flow() {
    // Setup test environment
    let env = TestEnvironment::new().await;
    
    // Insert data in PostgreSQL
    env.pg_client
        .execute("INSERT INTO users (name) VALUES ($1)", &[&"Test User"])
        .await
        .unwrap();
    
    // Wait for sync
    tokio::time::sleep(Duration::from_secs(2)).await;
    
    // Verify in Meilisearch
    let results = env.meili_client
        .index("users")
        .search()
        .with_query("Test User")
        .execute::<User>()
        .await
        .unwrap();
    
    assert_eq!(results.hits.len(), 1);
}
```

### End-to-End Testing

Full system tests using Docker:

```bash
# Run E2E tests
cargo test --test e2e

# Run specific test suite
cargo test --test e2e_sync_test -- --test-threads=1
```

### Performance Testing

Benchmark critical paths:

```rust
use criterion::{black_box, criterion_group, criterion_main, Criterion};

fn benchmark_event_processing(c: &mut Criterion) {
    c.bench_function("process_event", |b| {
        b.iter(|| {
            process_event(black_box(create_test_event()))
        });
    });
}

criterion_group!(benches, benchmark_event_processing);
criterion_main!(benches);
```

### Test Coverage

Generate coverage reports:
```bash
# Run tests with coverage
cargo tarpaulin --out Html

# View report
open tarpaulin-report.html
```

## Future Recommendations

### 1. Advanced Transformations

**JavaScript Transformations**:
```yaml
transform:
  - type: javascript
    script: |
      function transform(event) {
        // Custom logic
        event.data.fullName = `${event.data.firstName} ${event.data.lastName}`;
        delete event.data.firstName;
        delete event.data.lastName;
        return event;
      }
```

**WASM Support**:
- Load custom WASM modules for transformations
- Better performance than JavaScript
- Language-agnostic transformation logic

### 2. Multi-Source Support

**MySQL Support**:
```yaml
source:
  type: mysql
  mysql:
    host: localhost
    port: 3306
    server_id: 1000
    binlog:
      format: ROW
      start_position: "mysql-bin.000001:154"
```

**MongoDB Support**:
```yaml
source:
  type: mongodb
  mongodb:
    connection_string: "mongodb://localhost:27017"
    database: myapp
    change_stream:
      full_document: "updateLookup"
      start_after: null
```

### 3. Advanced Routing

**Content-Based Routing**:
```yaml
routing:
  rules:
    - condition: |
        event.table == "products" && 
        event.data.category == "electronics"
      destination:
        index: "electronics_products"
        
    - condition: |
        event.data.price > 1000
      destination:
        index: "premium_products"
```

### 4. Data Quality Features

**Schema Validation**:
```yaml
validation:
  schemas:
    public.users:
      required: ["id", "email", "created_at"]
      types:
        id: integer
        email: string
        created_at: timestamp
```

**Data Profiling**:
- Automatic detection of data patterns
- Anomaly detection
- Quality metrics dashboard

### 5. Performance Enhancements

**GPU Acceleration**:
- Use GPU for parallel event processing
- Batch transformations on GPU
- ML-based transformations

**Edge Computing**:
- Deploy lightweight agents near data sources
- Reduce network latency
- Distributed processing

### 6. Enterprise Features

**Multi-Tenancy**:
```yaml
tenancy:
  enabled: true
  isolation: "logical"  # logical, physical
  identifier: "tenant_id"
```

**Audit Logging**:
```yaml
audit:
  enabled: true
  events: ["task_created", "task_deleted", "config_changed"]
  storage: "elasticsearch"
```

**Compliance**:
- GDPR compliance tools
- Data masking/anonymization
- Retention policies

### 7. Observability Improvements

**Distributed Tracing**:
- Full request tracing
- Performance bottleneck identification
- Cross-service correlation

**AI-Powered Monitoring**:
- Anomaly detection
- Predictive failure analysis
- Auto-tuning recommendations

These recommendations represent the future direction of MeiliBridge, focusing on scalability, performance, and enterprise readiness.