Skip to content

Commit b667353

Browse files
committed
docs: finalize Full Developer Guidance Suite (Intro, FAQ, Architecture, Security)
1 parent fbe8616 commit b667353

File tree

3 files changed

+141
-2
lines changed

3 files changed

+141
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,11 @@ We subjected the engine to a "Thundering Herd" stress test (10,000 records).
110110

111111
For deep-dives into the engine's internals and security protocols:
112112

113-
* **[🏟️ Architecture Specification](doc/architecture.md)**: Understanding the Sync Engine Protocol, Delta Pulls, and High-Scale Ingestion.
113+
* **[🚀 Getting Started Tutorial](doc/getting_started.md)**: Build a high-scale sync engine in 5 minutes.
114+
* **[🏟️ Architecture Specification](doc/architecture.md)**: Understanding Delta Pulling and the Ordered Ingestion Protocol.
114115
* **[🛡️ Security Audit Report](doc/security_audit.md)**: Deep-dive into the 42 attack vectors and current hardening state.
115-
* **[🤝 Contributing Guide](CONTRIBUTING.md)**: How to add new adapters or features while maintaining Diamond-Standard quality.
116+
* **[❓ Common Questions & FAQ](doc/faq.md)**: Troubleshooting, performance, and best practices.
117+
* **[🤝 Contributing Guide](CONTRIBUTING.md)**: How to add new adapters or features while maintaining Diamond quality.
116118

117119
---
118120

doc/faq.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# ❓ dynos_sync FAQ
2+
3+
Common questions and troubleshooting for the **dynos_sync** engine.
4+
5+
---
6+
7+
## 🛠️ General Questions
8+
9+
### **Q: Does this replace my local database?**
10+
**A: No.** `dynos_sync` is a **headless** layer. It sits between your existing local database (Drift, Hive, Isar) and your remote API. You use your database normally; the engine simply mirrors those changes to the remote backend.
11+
12+
### **Q: What is "Ordered Ingestion"?**
13+
**A: Data Reliability.** Unlike libraries that push data in parallel chunks, `dynos_sync` preserves the **causal ordering** of your writes. This prevents race conditions where a record is "deleted" before it's even "created" on the server.
14+
15+
### **Q: How does it handle 100,000 records?**
16+
**A: Through Delta-Pulling.** Instead of fetching all data, the engine checks remote table timestamps. If `RemoteTS == LocalTS`, zero data is pulled. Only modified tables are fetched in memory-efficient batches.
17+
18+
---
19+
20+
## 🛡️ Security & Privacy
21+
22+
### **Q: What happens if the user logs out while offline?**
23+
**A: The Session Purge protocol.** When `logout()` is called, we call `local.clearAll([tables])`. This ensures that if User B logs into the same shared device, they cannot see User A's un-synced local data.
24+
25+
### **Q: Where is my data masked?**
26+
**A: On the edge.** Masking happens **locally on the device** before the JSON is even written to the sync queue. Your sensitive PII never leaves your device's boundary in plain text.
27+
28+
---
29+
30+
## 🚀 Performance & UI
31+
32+
### **Q: Will syncing block my UI thread?**
33+
**A: Not if you use isolates.** Wrap your engine in `IsolateSyncEngine` to offload all JSON serialization, deep-cloning, and PII masking to a dedicated background worker.
34+
35+
### **Q: My sync is stuck. How do I clear it?**
36+
**A: Check the Queue.** If a "poison pill" (a record that repeatedly fails) is blocking the queue, you can inspect it via `queue.getPending()` and either delete it or increase `maxRetries` in your `SyncConfig`.
37+
38+
---
39+
40+
## 🤝 Support & Licensing
41+
42+
### **Q: Can I use this for free?**
43+
**A: Yes!** If you are a startup with <$5M ARR/Funding or a non-commercial dev, the **Community Tier** is 100% free under the Business Source License (BSL).
44+
45+
---
46+
47+
*Secured by [dynos.fit](https://dynos.fit)*

doc/getting_started.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# 🚀 Getting Started with dynos_sync
2+
3+
This guide will walk you through building a high-reliability, production-hardened offline-first synchronization layer in under 5 minutes.
4+
5+
---
6+
7+
## 🏗️ 1. Define Your Implementation
8+
9+
Every **dynos_sync** architecture requires 4 core adapters. You can use our built-in helpers or write your own:
10+
11+
### A. The Local Store (e.g. SQLite via Drift)
12+
```dart
13+
class MyLocalStore implements LocalStore {
14+
@override
15+
Future<void> upsert(String t, String id, Map<String, dynamic> d) async => ...;
16+
@override
17+
Future<void> delete(String t, String id) async => ...;
18+
@override
19+
Future<void> clearAll(List<String> tables) async => ...; // Critical for secure logout
20+
}
21+
```
22+
23+
### B. The Remote Store (e.g. Supabase or REST)
24+
```dart
25+
class MyRemoteStore implements RemoteStore {
26+
@override
27+
Future<void> pushBatch(List<SyncEntry> entries) async => ...;
28+
@override
29+
Future<List<Map<String, dynamic>>> pullSince(String t, DateTime ts) async => ...;
30+
}
31+
```
32+
33+
---
34+
35+
## ⚡ 2. Initialize the Engine
36+
37+
Configure the `SyncEngine` with your schemas and security policies.
38+
39+
```dart
40+
final sync = SyncEngine(
41+
local: MyLocalStore(),
42+
remote: MyRemoteStore(),
43+
queue: MyQueueStore(),
44+
timestamps: MyTimestampStore(),
45+
tables: ['workouts', 'profiles'],
46+
config: const SyncConfig(
47+
sensitiveFields: ['password', 'ssn'], // 🛡️ Automasking for PII
48+
useExponentialBackoff: true, // 📶 Scalable retry logic
49+
batchSize: 50, // 🧠 Memory-efficient processing
50+
),
51+
);
52+
```
53+
54+
---
55+
56+
## 🦾 3. Efficient Backgrounding
57+
58+
To keep your UI at 120 FPS during massive data pulls (e.g., 100k rows), use the `IsolateSyncEngine`:
59+
60+
```dart
61+
final manager = IsolateSyncEngine(sync);
62+
63+
// Runs in a dedicated background worker
64+
await manager.syncAllInBackground();
65+
```
66+
67+
---
68+
69+
## 🛡️ 4. Security Practices
70+
71+
### The "Session Void" Pattern
72+
Ensure you call logout explicitly to purge sensitive un-synced data on shared devices:
73+
74+
```dart
75+
await sync.logout(); // Triggers table-scoped local wiping
76+
```
77+
78+
### JSON Exfiltration Prevention
79+
Set `maxPayloadBytes` in the config to prevent oversized accidental writes from jamming your sync pipeline.
80+
81+
---
82+
83+
## 📚 What's Next?
84+
* Read the **[🏟️ Architecture Guide](architecture.md)** for protocol deep-dives.
85+
* Check the **[🛡️ Security Audit](security_audit.md)** for the 42 attack vectors.
86+
* Explore **[example/example.dart](../example/example.dart)** for a complete Supabase integration sample.
87+
88+
---
89+
90+
*Battle-Tested by [dynos.fit](https://dynos.fit)*

0 commit comments

Comments
 (0)