@avalw/search-worker 1.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +323 -184
- package/bin/cli.js +236 -28
- package/index.js +887 -0
- package/package.json +15 -22
- package/LICENSE +0 -21
- package/examples/basic-usage.js +0 -32
- package/examples/express-integration.js +0 -73
- package/examples/search-api.js +0 -58
- package/lib/worker.js +0 -158
package/README.md
CHANGED
|
@@ -1,130 +1,303 @@
|
|
|
1
1
|
# @avalw/search-worker
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
```
|
|
4
|
+
___ _ _____ _ __ __
|
|
5
|
+
/ | | / / | | / / / /
|
|
6
|
+
/ /| | | / / /| | |/ / _ __/ /_
|
|
7
|
+
/ ___ | |/ / ___ | / | '__ __|
|
|
8
|
+
/_/ |_|___/_/ |_|_|\_\|_| |_|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Distributed Cache Worker v2.1.0
|
|
11
|
+
```
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
Contribute your computer's cache storage to the AVALW search network and earn free API access in return.
|
|
13
14
|
|
|
14
15
|
## How It Works
|
|
15
16
|
|
|
16
17
|
```
|
|
17
|
-
|
|
18
|
-
│
|
|
19
|
-
|
|
20
|
-
│
|
|
21
|
-
│
|
|
22
|
-
│
|
|
23
|
-
│
|
|
24
|
-
│
|
|
25
|
-
│
|
|
26
|
-
│
|
|
27
|
-
│
|
|
28
|
-
│
|
|
29
|
-
|
|
18
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
19
|
+
│ AVALW DISTRIBUTED CACHE │
|
|
20
|
+
├─────────────────────────────────────────────────────────────────────────┤
|
|
21
|
+
│ │
|
|
22
|
+
│ ┌─────────┐ ┌──────────────┐ ┌─────────────┐ │
|
|
23
|
+
│ │ User │────────▶│ avalw.org │────────▶│ Coordinator │ │
|
|
24
|
+
│ │ Search │ │ Server │ │ Server │ │
|
|
25
|
+
│ └─────────┘ └──────────────┘ └──────┬──────┘ │
|
|
26
|
+
│ │ │
|
|
27
|
+
│ ┌─────────────────────────┼───────┐ │
|
|
28
|
+
│ │ │ │ │
|
|
29
|
+
│ ▼ ▼ ▼ │
|
|
30
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────┐ │
|
|
31
|
+
│ │ Worker 1 │ │ Worker 2 │ │ ... │ │
|
|
32
|
+
│ │ Cache │ │ Cache │ │ │ │
|
|
33
|
+
│ └──────────┘ └──────────┘ └──────┘ │
|
|
34
|
+
│ │
|
|
35
|
+
│ YOUR WORKER stores search results and serves them when requested │
|
|
36
|
+
│ │
|
|
37
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
30
38
|
```
|
|
31
39
|
|
|
32
|
-
|
|
40
|
+
### The Flow
|
|
33
41
|
|
|
34
|
-
|
|
42
|
+
```
|
|
43
|
+
1. USER SEARCHES 2. CHECK CACHE 3. SERVE RESULT
|
|
44
|
+
"spotify"
|
|
45
|
+
┌─────────────┐
|
|
46
|
+
┌──────┐ │ Coordinator │ ┌──────────┐
|
|
47
|
+
│ User │──search──▶ │ checks │──hit──▶ │ Worker │──result──▶ User
|
|
48
|
+
└──────┘ │ workers │ │ serves │
|
|
49
|
+
└─────────────┘ └──────────┘
|
|
50
|
+
│
|
|
51
|
+
miss │
|
|
52
|
+
▼
|
|
53
|
+
┌──────────┐
|
|
54
|
+
│ Server │──result──▶ User + Distribute to Workers
|
|
55
|
+
│ process │
|
|
56
|
+
└──────────┘
|
|
57
|
+
```
|
|
35
58
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
59
|
+
### What Your Worker Does vs. Doesn't Do
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
✅ DOES ❌ DOESN'T
|
|
63
|
+
───────────────────────────────── ─────────────────────────────────
|
|
64
|
+
• Store search RESULTS • Have the search INDEX
|
|
65
|
+
• Serve cached results • Process raw documents
|
|
66
|
+
• Use 50-200MB RAM • Use significant CPU
|
|
67
|
+
• Use 500MB-2GB disk • Access your files
|
|
68
|
+
• Connect via WebSocket • Run arbitrary code
|
|
69
|
+
• Earn you API access • Collect your data
|
|
70
|
+
```
|
|
43
71
|
|
|
44
72
|
## Quick Start
|
|
45
73
|
|
|
46
|
-
|
|
74
|
+
```bash
|
|
75
|
+
# 1. Get your token at https://worker.avalw.org
|
|
76
|
+
# 2. Run the worker:
|
|
77
|
+
npx @avalw/search-worker --token YOUR_TOKEN
|
|
78
|
+
```
|
|
47
79
|
|
|
48
|
-
|
|
49
|
-
- **Account Hash** - Your unique identifier (save this!)
|
|
50
|
-
- **Worker Token** - Used to run the worker
|
|
80
|
+
That's it! Your worker will connect and start contributing.
|
|
51
81
|
|
|
52
|
-
|
|
82
|
+
## Installation
|
|
53
83
|
|
|
54
84
|
```bash
|
|
85
|
+
# Global install
|
|
55
86
|
npm install -g @avalw/search-worker
|
|
87
|
+
|
|
88
|
+
# Or use npx (no install needed)
|
|
89
|
+
npx @avalw/search-worker --token YOUR_TOKEN
|
|
56
90
|
```
|
|
57
91
|
|
|
58
|
-
|
|
92
|
+
## What's New in v2.1.0
|
|
59
93
|
|
|
60
|
-
```bash
|
|
61
|
-
avalw-worker YOUR_WORKER_TOKEN
|
|
62
94
|
```
|
|
95
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
96
|
+
│ INTELLIGENT CACHE SYSTEM │
|
|
97
|
+
├────────────────────────────────────────────────────────────────┤
|
|
98
|
+
│ │
|
|
99
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
100
|
+
│ │ Size Limits │ │ Time-Based │ │ Popularity │ │
|
|
101
|
+
│ │ 100MB - 2GB │ │ Eviction │ │ Scoring │ │
|
|
102
|
+
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
103
|
+
│ │
|
|
104
|
+
│ • Cache up to 2GB of search results │
|
|
105
|
+
│ • Auto-remove queries unused for 7+ days │
|
|
106
|
+
│ • Popular queries stay cached longer │
|
|
107
|
+
│ • Background cleanup every hour │
|
|
108
|
+
│ │
|
|
109
|
+
└────────────────────────────────────────────────────────────────┘
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Command Line Options
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Basic usage (500MB cache, 7 day retention)
|
|
116
|
+
npx @avalw/search-worker --token abc123
|
|
63
117
|
|
|
64
|
-
|
|
118
|
+
# Custom cache size (100-2048 MB)
|
|
119
|
+
npx @avalw/search-worker --token abc123 --cache-size 1024
|
|
120
|
+
|
|
121
|
+
# Custom retention (1-30 days)
|
|
122
|
+
npx @avalw/search-worker --token abc123 --max-age 14
|
|
123
|
+
|
|
124
|
+
# Full customization
|
|
125
|
+
npx @avalw/search-worker \
|
|
126
|
+
--token abc123 \
|
|
127
|
+
--cache-size 1024 \
|
|
128
|
+
--max-age 14
|
|
65
129
|
```
|
|
66
|
-
╔═══════════════════════════════════════════════╗
|
|
67
|
-
║ AVALW Search Worker v1.0.0 ║
|
|
68
|
-
╠═══════════════════════════════════════════════╣
|
|
69
|
-
║ Free Search API in exchange for compute ║
|
|
70
|
-
╚═══════════════════════════════════════════════╝
|
|
71
130
|
|
|
72
|
-
|
|
73
|
-
Token: abc123def456...
|
|
131
|
+
### All Options
|
|
74
132
|
|
|
75
|
-
|
|
76
|
-
|
|
133
|
+
```
|
|
134
|
+
┌──────────────────┬─────────────────┬───────────────────────────────────┐
|
|
135
|
+
│ Option │ Default │ Description │
|
|
136
|
+
├──────────────────┼─────────────────┼───────────────────────────────────┤
|
|
137
|
+
│ -t, --token │ $AVALW_TOKEN │ Your worker authentication token │
|
|
138
|
+
│ -s, --cache-size │ 500 │ Max cache size in MB (100-2048) │
|
|
139
|
+
│ -a, --max-age │ 7 │ Days to keep unused queries (1-30)│
|
|
140
|
+
│ -h, --help │ │ Show help │
|
|
141
|
+
│ -v, --version │ │ Show version │
|
|
142
|
+
└──────────────────┴─────────────────┴───────────────────────────────────┘
|
|
77
143
|
```
|
|
78
144
|
|
|
79
|
-
###
|
|
145
|
+
### Environment Variables
|
|
80
146
|
|
|
81
|
-
|
|
147
|
+
```bash
|
|
148
|
+
export AVALW_WORKER_TOKEN=your-token-here
|
|
149
|
+
export AVALW_CACHE_SIZE_MB=1024
|
|
150
|
+
export AVALW_MAX_AGE_DAYS=14
|
|
151
|
+
npx @avalw/search-worker
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Programmatic Usage
|
|
82
155
|
|
|
83
156
|
```javascript
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
157
|
+
const { createWorker } = require('@avalw/search-worker');
|
|
158
|
+
|
|
159
|
+
const worker = createWorker({
|
|
160
|
+
workerToken: 'your-token-here',
|
|
161
|
+
|
|
162
|
+
// Cache configuration
|
|
163
|
+
cacheSizeMB: 1024, // 1GB cache
|
|
164
|
+
maxAgeDays: 14, // 14 day retention
|
|
165
|
+
|
|
166
|
+
// Event handlers
|
|
167
|
+
onConnected: (w) => console.log('Connected to coordinator'),
|
|
168
|
+
onDisconnected: (w) => console.log('Disconnected'),
|
|
169
|
+
onCacheHit: (key) => console.log('Served:', key),
|
|
170
|
+
onCacheStore: (key) => console.log('Cached:', key),
|
|
171
|
+
onError: (err) => console.error('Error:', err)
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Connect
|
|
175
|
+
worker.connect();
|
|
176
|
+
|
|
177
|
+
// Get stats
|
|
178
|
+
const stats = worker.getStats();
|
|
179
|
+
console.log(`Cache: ${stats.cache.sizeFormatted} / ${stats.cache.maxSizeFormatted}`);
|
|
180
|
+
console.log(`Hit rate: ${stats.hitRate}%`);
|
|
181
|
+
|
|
182
|
+
// Runtime configuration
|
|
183
|
+
worker.setCacheSize(2048); // Change to 2GB
|
|
184
|
+
worker.setCacheMaxAge(30); // Change to 30 days
|
|
185
|
+
|
|
186
|
+
// Cleanup
|
|
187
|
+
worker.disconnect();
|
|
90
188
|
```
|
|
91
189
|
|
|
92
|
-
|
|
93
|
-
# Python
|
|
94
|
-
import requests
|
|
190
|
+
## API Tiers & Rewards
|
|
95
191
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
192
|
+
Your contribution is measured in Core-Hours:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
┌─────────────────────────────────────────────────────────────────────┐
|
|
196
|
+
│ CORE-HOURS FORMULA │
|
|
197
|
+
├─────────────────────────────────────────────────────────────────────┤
|
|
198
|
+
│ │
|
|
199
|
+
│ Core-Hours = Cores × (CPU Speed ÷ 3.0 GHz) × Usage% × Hours │
|
|
200
|
+
│ │
|
|
201
|
+
│ Example: 8 cores × (3.5 GHz ÷ 3.0 GHz) × 80% × 1 hour │
|
|
202
|
+
│ = 8 × 1.17 × 0.8 × 1 = 7.5 Core-Hours │
|
|
203
|
+
│ │
|
|
204
|
+
└─────────────────────────────────────────────────────────────────────┘
|
|
102
205
|
```
|
|
103
206
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
207
|
+
### Tier Benefits
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
┌─────────────┬────────────┬───────────┬─────────────────┐
|
|
211
|
+
│ Tier │ Core-Hours │ Min Cores │ API Requests │
|
|
212
|
+
├─────────────┼────────────┼───────────┼─────────────────┤
|
|
213
|
+
│ Starter │ 3 │ 3 │ 1,000/day │
|
|
214
|
+
│ Basic │ 12 │ 4 │ 5,000/day │
|
|
215
|
+
│ Pro │ 36 │ 6 │ 20,000/day │
|
|
216
|
+
│ Business │ 72 │ 8 │ 50,000/day │
|
|
217
|
+
│ Enterprise │ 240 │ 16 │ 500,000/day │
|
|
218
|
+
└─────────────┴────────────┴───────────┴─────────────────┘
|
|
107
219
|
```
|
|
108
220
|
|
|
109
|
-
##
|
|
221
|
+
## Intelligent Cache Details
|
|
110
222
|
|
|
111
|
-
###
|
|
223
|
+
### How Eviction Works
|
|
112
224
|
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
|
|
225
|
+
```
|
|
226
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
227
|
+
│ EVICTION PRIORITY │
|
|
228
|
+
├─────────────────────────────────────────────────────────────┤
|
|
229
|
+
│ │
|
|
230
|
+
│ 1. EXPIRED TTL │
|
|
231
|
+
│ └── Items past their time-to-live (5 min default) │
|
|
232
|
+
│ │
|
|
233
|
+
│ 2. MAX AGE EXCEEDED │
|
|
234
|
+
│ └── Items not accessed for N days (7 days default) │
|
|
235
|
+
│ │
|
|
236
|
+
│ 3. LOWEST POPULARITY │
|
|
237
|
+
│ └── Score = log2(accessCount) × recency × stability │
|
|
238
|
+
│ │
|
|
239
|
+
│ Priority: 1 > 2 > 3 (expired items removed first) │
|
|
240
|
+
│ │
|
|
241
|
+
└─────────────────────────────────────────────────────────────┘
|
|
242
|
+
```
|
|
116
243
|
|
|
117
|
-
|
|
118
|
-
pm2 start avalw-worker -- YOUR_WORKER_TOKEN
|
|
244
|
+
### Popularity Scoring
|
|
119
245
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
246
|
+
```
|
|
247
|
+
Score = log2(accessCount + 1) × recencyFactor × stabilityFactor
|
|
248
|
+
|
|
249
|
+
┌─────────────────┬─────────────────────────────────────────┐
|
|
250
|
+
│ Factor │ Description │
|
|
251
|
+
├─────────────────┼─────────────────────────────────────────┤
|
|
252
|
+
│ accessCount │ Number of times the query was accessed │
|
|
253
|
+
│ recencyFactor │ 1.0 → 0.0 over 7 days since last access │
|
|
254
|
+
│ stabilityFactor │ Higher for consistent access patterns │
|
|
255
|
+
└─────────────────┴─────────────────────────────────────────┘
|
|
256
|
+
|
|
257
|
+
Example: Query accessed 100 times, last accessed 1 day ago
|
|
258
|
+
Score = log2(101) × 0.86 × 1.2 = 6.65 × 0.86 × 1.2 = 6.86
|
|
123
259
|
```
|
|
124
260
|
|
|
125
|
-
|
|
261
|
+
## Resource Usage
|
|
126
262
|
|
|
127
|
-
|
|
263
|
+
```
|
|
264
|
+
┌──────────────────────────────────────────────────────────┐
|
|
265
|
+
│ TYPICAL RESOURCE USAGE │
|
|
266
|
+
├──────────────────────────────────────────────────────────┤
|
|
267
|
+
│ │
|
|
268
|
+
│ CPU: 1-5% [▓░░░░░░░░░░░░░░░░░░░] minimal │
|
|
269
|
+
│ RAM: 50-200MB [▓▓▓▓░░░░░░░░░░░░░░░░] light │
|
|
270
|
+
│ Disk: 500MB-2GB [▓▓▓▓▓▓▓▓░░░░░░░░░░░░] configurable │
|
|
271
|
+
│ Network: Low [▓▓░░░░░░░░░░░░░░░░░░] WebSocket │
|
|
272
|
+
│ │
|
|
273
|
+
└──────────────────────────────────────────────────────────┘
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Privacy & Security
|
|
277
|
+
|
|
278
|
+
```
|
|
279
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
280
|
+
│ PRIVACY GUARANTEES │
|
|
281
|
+
├────────────────────────────────────────────────────────────────┤
|
|
282
|
+
│ │
|
|
283
|
+
│ ✓ Workers cache RESULTS only, not the search index │
|
|
284
|
+
│ ✓ No IP addresses are logged │
|
|
285
|
+
│ ✓ Workers don't see who requested a search │
|
|
286
|
+
│ ✓ All communication encrypted (WSS/HTTPS) │
|
|
287
|
+
│ ✓ No access to your local files │
|
|
288
|
+
│ ✓ Open source - audit the code yourself │
|
|
289
|
+
│ │
|
|
290
|
+
└────────────────────────────────────────────────────────────────┘
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Running as a Service
|
|
294
|
+
|
|
295
|
+
### Linux (systemd)
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
# Create service file
|
|
299
|
+
sudo nano /etc/systemd/system/avalw-worker.service
|
|
300
|
+
```
|
|
128
301
|
|
|
129
302
|
```ini
|
|
130
303
|
[Unit]
|
|
@@ -133,8 +306,11 @@ After=network.target
|
|
|
133
306
|
|
|
134
307
|
[Service]
|
|
135
308
|
Type=simple
|
|
136
|
-
User=
|
|
137
|
-
|
|
309
|
+
User=nobody
|
|
310
|
+
Environment=AVALW_WORKER_TOKEN=your-token-here
|
|
311
|
+
Environment=AVALW_CACHE_SIZE_MB=1024
|
|
312
|
+
Environment=AVALW_MAX_AGE_DAYS=14
|
|
313
|
+
ExecStart=/usr/bin/npx @avalw/search-worker
|
|
138
314
|
Restart=always
|
|
139
315
|
RestartSec=10
|
|
140
316
|
|
|
@@ -142,140 +318,103 @@ RestartSec=10
|
|
|
142
318
|
WantedBy=multi-user.target
|
|
143
319
|
```
|
|
144
320
|
|
|
145
|
-
Then:
|
|
146
321
|
```bash
|
|
322
|
+
# Enable and start
|
|
323
|
+
sudo systemctl daemon-reload
|
|
147
324
|
sudo systemctl enable avalw-worker
|
|
148
325
|
sudo systemctl start avalw-worker
|
|
326
|
+
|
|
327
|
+
# Check status
|
|
328
|
+
sudo systemctl status avalw-worker
|
|
149
329
|
```
|
|
150
330
|
|
|
151
|
-
###
|
|
331
|
+
### Docker
|
|
152
332
|
|
|
153
333
|
```dockerfile
|
|
154
|
-
FROM node:
|
|
334
|
+
FROM node:18-alpine
|
|
155
335
|
RUN npm install -g @avalw/search-worker
|
|
156
|
-
|
|
336
|
+
ENV AVALW_WORKER_TOKEN=your-token-here
|
|
337
|
+
ENV AVALW_CACHE_SIZE_MB=1024
|
|
338
|
+
ENV AVALW_MAX_AGE_DAYS=14
|
|
339
|
+
CMD ["avalw-worker"]
|
|
157
340
|
```
|
|
158
341
|
|
|
159
342
|
```bash
|
|
160
343
|
docker build -t avalw-worker .
|
|
161
|
-
docker run -d --name avalw
|
|
344
|
+
docker run -d --name avalw avalw-worker
|
|
162
345
|
```
|
|
163
346
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
You can also use the worker programmatically in your Node.js application:
|
|
167
|
-
|
|
168
|
-
```javascript
|
|
169
|
-
const { AvalwWorker } = require('@avalw/search-worker');
|
|
170
|
-
|
|
171
|
-
const worker = new AvalwWorker('YOUR_WORKER_TOKEN');
|
|
347
|
+
### PM2
|
|
172
348
|
|
|
173
|
-
|
|
174
|
-
|
|
349
|
+
```bash
|
|
350
|
+
pm2 start avalw-worker --name "avalw" -- --token YOUR_TOKEN --cache-size 1024
|
|
351
|
+
pm2 save
|
|
352
|
+
pm2 startup
|
|
353
|
+
```
|
|
175
354
|
|
|
176
|
-
|
|
177
|
-
const info = worker.getSystemInfo();
|
|
178
|
-
console.log(info);
|
|
355
|
+
### Windows (Task Scheduler)
|
|
179
356
|
|
|
180
|
-
|
|
181
|
-
|
|
357
|
+
```batch
|
|
358
|
+
@echo off
|
|
359
|
+
set AVALW_WORKER_TOKEN=your-token-here
|
|
360
|
+
set AVALW_CACHE_SIZE_MB=1024
|
|
361
|
+
npx @avalw/search-worker
|
|
182
362
|
```
|
|
183
363
|
|
|
184
|
-
##
|
|
185
|
-
|
|
186
|
-
### Search Endpoint
|
|
364
|
+
## Troubleshooting
|
|
187
365
|
|
|
188
366
|
```
|
|
189
|
-
|
|
367
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
368
|
+
│ COMMON ISSUES │
|
|
369
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
370
|
+
│ │
|
|
371
|
+
│ "Connection refused" │
|
|
372
|
+
│ └── Check internet connection, firewall settings │
|
|
373
|
+
│ │
|
|
374
|
+
│ "Invalid token" │
|
|
375
|
+
│ └── Get a new token at https://worker.avalw.org │
|
|
376
|
+
│ │
|
|
377
|
+
│ "Cache full, high eviction rate" │
|
|
378
|
+
│ └── Increase --cache-size or decrease --max-age │
|
|
379
|
+
│ │
|
|
380
|
+
│ "Memory usage too high" │
|
|
381
|
+
│ └── Decrease --cache-size (minimum 100MB) │
|
|
382
|
+
│ │
|
|
383
|
+
│ "Worker keeps disconnecting" │
|
|
384
|
+
│ └── Check network stability, worker will auto-reconnect │
|
|
385
|
+
│ │
|
|
386
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
190
387
|
```
|
|
191
388
|
|
|
192
|
-
|
|
193
|
-
| Parameter | Type | Required | Description |
|
|
194
|
-
|-----------|--------|----------|--------------------------------|
|
|
195
|
-
| q | string | Yes | Search query |
|
|
196
|
-
| token | string | Yes | Your worker token |
|
|
197
|
-
| page | number | No | Page number (default: 1) |
|
|
198
|
-
| limit | number | No | Results per page (default: 10) |
|
|
389
|
+
## System Requirements
|
|
199
390
|
|
|
200
|
-
**Response:**
|
|
201
|
-
```json
|
|
202
|
-
{
|
|
203
|
-
"success": true,
|
|
204
|
-
"results": [
|
|
205
|
-
{
|
|
206
|
-
"title": "Example Result",
|
|
207
|
-
"url": "https://example.com",
|
|
208
|
-
"snippet": "This is a snippet..."
|
|
209
|
-
}
|
|
210
|
-
],
|
|
211
|
-
"total": 100,
|
|
212
|
-
"page": 1
|
|
213
|
-
}
|
|
214
391
|
```
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
### API returns "Worker offline"
|
|
228
|
-
- Make sure your worker is running
|
|
229
|
-
- Check the worker console for errors
|
|
230
|
-
- Worker must send heartbeat every 30 seconds
|
|
231
|
-
|
|
232
|
-
### Rate limit exceeded
|
|
233
|
-
- Upgrade to a higher tier for more requests
|
|
234
|
-
- Wait until the daily limit resets (midnight UTC)
|
|
235
|
-
|
|
236
|
-
## Security
|
|
237
|
-
|
|
238
|
-
- **No data collection**: We don't log search queries
|
|
239
|
-
- **No tracking**: No cookies, no fingerprinting
|
|
240
|
-
- **Open protocol**: Transparent heartbeat mechanism
|
|
241
|
-
- **Your server, your control**: Worker runs on your infrastructure
|
|
392
|
+
┌────────────────┬────────────────────────────────────┐
|
|
393
|
+
│ Component │ Requirement │
|
|
394
|
+
├────────────────┼────────────────────────────────────┤
|
|
395
|
+
│ Node.js │ 14.0.0 or higher │
|
|
396
|
+
│ CPU │ 3+ cores for Starter tier │
|
|
397
|
+
│ RAM │ 512MB+ free │
|
|
398
|
+
│ Disk │ 500MB - 2GB for cache │
|
|
399
|
+
│ Network │ Stable internet, WebSocket support │
|
|
400
|
+
│ OS │ Windows, macOS, Linux │
|
|
401
|
+
└────────────────┴────────────────────────────────────┘
|
|
402
|
+
```
|
|
242
403
|
|
|
243
404
|
## Support
|
|
244
405
|
|
|
245
|
-
-
|
|
406
|
+
- Dashboard: [worker.avalw.org](https://worker.avalw.org)
|
|
407
|
+
- Documentation: [worker.avalw.org/protocol](https://worker.avalw.org/protocol)
|
|
246
408
|
- Email: contact@avalw.com
|
|
409
|
+
- Search Engine: [avalw.org](https://avalw.org)
|
|
247
410
|
|
|
248
411
|
## License
|
|
249
412
|
|
|
250
|
-
MIT License
|
|
251
|
-
|
|
252
|
-
Copyright (c) 2026 AVALW
|
|
253
|
-
|
|
254
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
255
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
256
|
-
in the Software without restriction, including without limitation the rights
|
|
257
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
258
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
259
|
-
furnished to do so, subject to the following conditions:
|
|
260
|
-
|
|
261
|
-
The above copyright notice and this permission notice shall be included in all
|
|
262
|
-
copies or substantial portions of the Software.
|
|
263
|
-
|
|
264
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
265
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
266
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
267
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
268
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
269
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
270
|
-
SOFTWARE.
|
|
413
|
+
MIT License - Free to use, modify, and distribute.
|
|
271
414
|
|
|
272
415
|
---
|
|
273
416
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
- [AVALW Search](https://avalw.org) - Privacy-focused search engine
|
|
279
|
-
- [Cronos Browser](https://cronos.avalw.com) - Secure, private browser
|
|
280
|
-
- [AVALW Protocol](https://avalw.com) - Decentralized communication protocol
|
|
281
|
-
- [Worker API](https://worker.avalw.org) - This project
|
|
417
|
+
```
|
|
418
|
+
Made with transparency in mind by AVALW
|
|
419
|
+
https://avalw.com
|
|
420
|
+
```
|