jexidb 2.1.5 → 2.1.7

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 CHANGED
@@ -1,449 +1,460 @@
1
- # JexiDB - Intelligent JavaScript Database for Desktop Apps
2
-
3
- **JEXIDB** = **J**avaScript **EX**tended **I**ntelligent **D**ata**B**ase
4
-
5
- **The Only Pure JS Database with Smart Disk Persistence & Intelligent Memory Management** - Schema-Enforced, Streaming-Ready, No Native Dependencies
6
-
7
- <p align="center">
8
- <img width="270" src="https://edenware.app/jexidb/images/jexidb-logo-icon.jpg" alt="JexiDB - JavaScript EXtended Intelligent DataBase for Node.js and Electron applications" title="JexiDB - JavaScript EXtended Intelligent DataBase logo" />
9
- </p>
10
-
11
- <div align="center">
12
-
13
- [![npm version](https://img.shields.io/npm/v/jexidb.svg?style=flat-square)](https://www.npmjs.com/package/jexidb)
14
- [![npm downloads](https://img.shields.io/npm/dm/jexidb.svg?style=flat-square)](https://www.npmjs.com/package/jexidb)
15
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
16
- [![Node.js Version](https://img.shields.io/node/v/jexidb?style=flat-square)](https://nodejs.org/)
17
- [![GitHub stars](https://img.shields.io/github/stars/EdenwareApps/jexidb?style=flat-square)](https://github.com/EdenwareApps/jexidb)
18
- [![GitHub issues](https://img.shields.io/github/issues/EdenwareApps/jexidb?style=flat-square)](https://github.com/EdenwareApps/jexidb/issues)
19
-
20
- **⚡ High-Performance • 💾 Persistent • 🧠 Memory Efficient • 🚀 Production Ready**
21
-
22
- [📖 Documentation](docs/README.md) • [💡 Examples](docs/EXAMPLES.md) • [🔧 API Reference](docs/API.md) • [🚀 Quick Start](#quick-start---5-minutes-to-database)
23
-
24
- </div>
25
-
26
- ## Table of Contents
27
-
28
- - [Why Developers Choose JexiDB](#why-developers-choose-jexidb)
29
- - [JexiDB vs Other JavaScript Databases](#jexidb-vs-other-javascript-databases)
30
- - [Performance Benchmarks](#performance-benchmarks)
31
- - [Frequently Asked Questions](#frequently-asked-questions)
32
- - [Quick Start - 5 Minutes to Database](#quick-start---5-minutes-to-database)
33
- - [Real-World Use Cases](#real-world-use-cases)
34
- - [Migration Guide](#migration-guide)
35
- - [What's Next - Roadmap](#whats-next---roadmap)
36
-
37
- ---
38
-
39
- ## What Makes JexiDB Unique
40
-
41
- **The Only Pure JS Database with Smart Disk Persistence & Intelligent Memory Management**
42
-
43
- JexiDB stands out among JavaScript databases by combining **pure JavaScript simplicity** with **enterprise-grade data management**. While other JS databases offer basic persistence, JexiDB provides **intelligent memory management** and **structured data enforcement** that traditional document databases lack.
44
-
45
- ### Unique Advantages Over Other JavaScript Databases
46
-
47
- 🚀 **Pure JavaScript, No Compromises** - 100% JavaScript, no native dependencies, WASM, or compilation required. Compatible with both CommonJS and ESM modules
48
- 💾 **Intelligent Disk Persistence** - JSONL files with compressed persistent indexes, not memory-only storage
49
- 📋 **Schema Enforcement** - Structured data model like SQL tables, ensuring data consistency in pure JavaScript
50
- 🧠 **Smart Memory Management** - Point reading and streaming operations, handles millions of records without loading everything into RAM
51
- 🔍 **Advanced Query Optimization** - MongoDB-like operators with automatic term mapping for 77% size reduction
52
- ⚡ **Production-Ready Performance** - Compressed indexes, streaming operations, and automatic optimization
53
- 🖥️ **Desktop-First Design** - Optimized for Electron, NW.js, and local Node.js applications from the ground up
54
-
55
- ### Technical Specifications
56
-
57
- - **Storage Format**: JSONL (JSON Lines) with compressed persistent indexes
58
- - **Memory Strategy**: Point reading + streaming, doesn't require loading entire database
59
- - **Query Language**: Advanced operators ($in, $or, $and, ranges, regex, case-insensitive)
60
- - **Data Types**: string, number, boolean, array (with automatic optimization)
61
- - **Indexing**: Persistent compressed indexes with term mapping for optimal performance
62
- - **Transactions**: Operation queuing with manual save control (auto-save removed for better control)
63
- - **Persistence**: Manual save functionality ensures data integrity and performance
64
- - **File Size**: Typically 25-75% smaller than alternatives for repetitive data
65
-
66
- ## JexiDB vs Other JavaScript Databases
67
-
68
- | Database | Pure JS | Disk Persistence | Memory Usage | Data Structure | Best Use Case |
69
- |----------|---------|------------------|--------------|----------------|---------------|
70
- | **JexiDB** | 100% | JSONL + Compressed Indexes | 🧠 Smart (point reading) | 📋 Schema Required | Desktop apps, Node.js with structured data |
71
- | **NeDB** | ✅ 100% | ✅ JSON files | 📈 High (loads all) | 📄 Document-free | Legacy projects (unmaintained) |
72
- | **Lowdb** | 100% | ✅ JSON files | 📈 High (loads all) | 📄 Document-free | Small configs, simple apps |
73
- | **LokiJS** | ✅ 100% | ⚠️ Adapters only | 📈 High (in-memory primary) | 📄 Document-free | In-memory applications |
74
- | **PouchDB** | 100% | IndexedDB/WebSQL | 🧠 Moderate | 📄 Document-free | Offline-first web apps |
75
- | **SQLite (WASM)** | ❌ WASM required | ✅ SQLite files | 🧠 Moderate | 📊 SQL Tables | Complex relational data |
76
-
77
- ### Why Developers Choose JexiDB
78
-
79
- **Intelligent Memory Management**: Unlike other JS databases that load entire files into memory, JexiDB uses point reading and streaming operations for unlimited dataset sizes.
80
-
81
- **Schema Enforcement**: Provides SQL-like data structure and consistency guarantees in pure JavaScript, without the complexity of traditional databases.
82
-
83
- **Desktop-First Architecture**: Built specifically for Electron and NW.js applications, eliminating native dependency issues that complicate desktop deployment.
84
-
85
- **Enterprise Performance**: Combines disk persistence with in-memory query speed through compressed indexes and automatic term mapping optimization.
86
-
87
- ## Performance Benchmarks
88
-
89
- ### Memory Usage Comparison (100,000 records)
90
-
91
- | Database | Memory Usage | Query Speed | File Size |
92
- |----------|--------------|-------------|-----------|
93
- | **JexiDB** | ~25MB | ~5ms (indexed) | ~15MB (compressed) |
94
- | NeDB | ~80MB | ~20ms | ~45MB |
95
- | Lowdb | ~120MB | ~50ms | ~60MB |
96
- | LokiJS | ~90MB | ~8ms | ~35MB (adapters) |
97
-
98
- *Benchmarks based on typical e-commerce product catalog with repetitive category/tag data*
99
-
100
- ### Size Reduction with Term Mapping
101
-
102
- - **Without term mapping**: 45MB file size
103
- - **With JexiDB term mapping**: 15MB file size
104
- - **Reduction**: Up to 77% for datasets with repetitive strings
105
-
106
- ## Frequently Asked Questions
107
-
108
- ### Is JexiDB suitable for production applications?
109
-
110
- Yes, JexiDB is production-ready with features like:
111
- - Automatic data integrity recovery
112
- - Transaction support with operation queuing
113
- - Comprehensive error handling
114
- - Active maintenance and updates
115
-
116
- ### How does JexiDB handle large datasets?
117
-
118
- JexiDB uses **point reading** - it only loads the specific records needed for your query, not the entire database. Combined with streaming operations via `iterate()` and `walk()`, it can handle millions of records efficiently.
119
-
120
- ### Can JexiDB replace SQLite in my Electron app?
121
-
122
- For many use cases, yes! JexiDB offers:
123
- - ✅ 100% JavaScript (no native SQLite compilation issues)
124
- - Schema enforcement like SQL tables
125
- - ✅ Advanced queries with operators
126
- - Better memory efficiency for large datasets
127
- - ✅ Simpler deployment (no native binaries)
128
-
129
- ### What's the difference between fields and indexes?
130
-
131
- **Fields** define your data structure (schema) - they're required and enforced.
132
- **Indexes** optimize query performance - they're optional and should only be created for fields you query frequently.
133
-
134
- ### How does JexiDB compare to traditional databases?
135
-
136
- JexiDB provides SQL-like structure and data consistency in pure JavaScript, but without the complexity of server setup or native dependencies. It's perfect for applications that need structured data without the overhead of full database systems.
137
-
138
- ## Quick Start - 5 Minutes to Database
139
-
140
- ### Installation
141
-
142
- ```bash
143
- npm install EdenwareApps/jexidb
144
- ```
145
-
146
- ### Create Your First Database
147
-
148
- ```javascript
149
- import { Database } from 'jexidb';
150
-
151
- const db = new Database('users.jdb', {
152
- fields: {
153
- id: 'number',
154
- name: 'string',
155
- email: 'string',
156
- role: 'string',
157
- tags: 'array:string'
158
- },
159
- indexes: {
160
- email: 'string', // Fast email lookups
161
- role: 'string', // Filter by role
162
- tags: 'array:string' // Search by tags
163
- }
164
- });
165
-
166
- // Initialize and use
167
- await db.init();
168
-
169
- // Insert data
170
- await db.insert({
171
- id: 1,
172
- name: 'John Doe',
173
- email: 'john@example.com',
174
- role: 'admin',
175
- tags: ['developer', 'team-lead']
176
- });
177
-
178
- // Query data
179
- const users = await db.find({ role: 'admin' });
180
- const devs = await db.find({ tags: 'developer' });
181
-
182
- // Save changes
183
- await db.save();
184
- ```
185
-
186
- **That's it!** Your data is now persisted to `users.jdb` file.
187
-
188
- ## Real-World Use Cases
189
-
190
- ### ✅ Electron Desktop Applications
191
- ```javascript
192
- // User management in Electron app
193
- const userDb = new Database('users.jdb', {
194
- fields: { id: 'number', email: 'string', profile: 'object' },
195
- indexes: { email: 'string' }
196
- });
197
-
198
- // Works offline, no server required
199
- const user = await userDb.findOne({ email: 'user@example.com' });
200
- ```
201
-
202
- ### ✅ Local Node.js Applications
203
- ```javascript
204
- // Configuration storage
205
- const configDb = new Database('config.jdb', {
206
- fields: { key: 'string', value: 'string' },
207
- indexes: { key: 'string' }
208
- });
209
-
210
- // Persist app settings locally
211
- await configDb.insert({ key: 'theme', value: 'dark' });
212
- ```
213
-
214
- ### ✅ Data Processing Scripts
215
- ```javascript
216
- // Process large CSV files
217
- const dataDb = new Database('processed.jdb', {
218
- fields: { id: 'number', data: 'object' }
219
- });
220
-
221
- // Handle millions of records efficiently
222
- for await (const record of dataDb.iterate({ processed: false })) {
223
- // Process record
224
- record.processed = true;
225
- record.timestamp = Date.now();
226
- }
227
- await dataDb.save();
228
- ```
229
-
230
- ### NW.js Applications
231
- ```javascript
232
- // Product catalog for desktop POS system
233
- const productsDb = new Database('products.jdb', {
234
- fields: {
235
- sku: 'string',
236
- name: 'string',
237
- price: 'number',
238
- category: 'string',
239
- tags: 'array:string'
240
- },
241
- indexes: {
242
- sku: 'string',
243
- category: 'string',
244
- tags: 'array:string'
245
- }
246
- });
247
- ```
248
-
249
- ## Perfect Use Cases for JexiDB
250
-
251
- ### ✅ Ideal For:
252
- - **Desktop Applications** (Electron, NW.js, Tauri) - No native dependency issues
253
- - **Local Node.js Applications** - Simple deployment without database servers
254
- - **Offline-First Apps** - Works completely offline with local persistence
255
- - **Data Processing Scripts** - Handle large datasets with streaming operations
256
- - **Configuration Storage** - Simple key-value storage with schema validation
257
- - **Prototyping** - Quick setup with real persistence and advanced queries
258
-
259
- ### Less Ideal For:
260
- - **Multi-user web applications** - Use database servers instead
261
- - **Heavy concurrent writes** - JexiDB is single-writer optimized
262
- - **Complex relational data** - Consider traditional SQL databases
263
- - **Browser-only applications** - Use IndexedDB/PouchDB for web
264
-
265
- ## Bulk Operations with `iterate()`
266
-
267
- The `iterate()` method provides high-performance bulk update capabilities with streaming support:
268
-
269
- ```javascript
270
- // Basic bulk update
271
- for await (const product of db.iterate({ category: 'electronics' })) {
272
- product.price = product.price * 1.1; // 10% increase
273
- product.updatedAt = new Date().toISOString();
274
- }
275
-
276
- // With progress tracking
277
- for await (const item of db.iterate(
278
- { status: 'active' },
279
- {
280
- chunkSize: 1000,
281
- progressCallback: (progress) => {
282
- console.log(`Processed: ${progress.processed}, Modified: ${progress.modified}`);
283
- }
284
- }
285
- )) {
286
- item.processed = true;
287
- }
288
- ```
289
-
290
- **Benefits:**
291
- - **Streaming Performance**: Process large datasets without loading everything into memory
292
- - **Bulk Updates**: Modify multiple records in a single operation
293
- - **Automatic Change Detection**: Automatically detects modified records
294
- - **Progress Tracking**: Optional progress callbacks for long-running operations
295
-
296
- ## Advanced Queries
297
-
298
- ```javascript
299
- // Multiple conditions (automatic AND)
300
- const results = await db.find({
301
- age: { '>': 18, '<': 65 },
302
- status: 'active',
303
- category: { '$in': ['premium', 'vip'] }
304
- });
305
-
306
- // Logical operators
307
- const complex = await db.find({
308
- '$or': [
309
- { type: 'admin' },
310
- { '$and': [
311
- { type: 'user' },
312
- { verified: true }
313
- ]}
314
- ]
315
- });
316
-
317
- // Arrays
318
- const withTags = await db.find({
319
- tags: 'javascript', // Contains 'javascript'
320
- tags: { '$all': ['js', 'node'] } // Contains all values
321
- });
322
- ```
323
-
324
- ## Testes
325
-
326
- JexiDB inclui uma suíte completa de testes com Jest:
327
-
328
- ```bash
329
- npm test # Executa todos os testes
330
- npm run test:watch # Modo watch para desenvolvimento
331
- npm run test:coverage # Relatório de cobertura
332
- ```
333
-
334
- ## 📚 Documentation
335
-
336
- - **[📖 Full Documentation](docs/README.md)** - Complete documentation index
337
- - **[🔧 API Reference](docs/API.md)** - Detailed API documentation
338
- - **[💡 Examples](docs/EXAMPLES.md)** - Practical examples and use cases
339
- - **[🚀 Getting Started](docs/README.md#quick-start)** - Quick start guide
340
-
341
- ## Migration Guide
342
-
343
- ### Coming from Other Databases
344
-
345
- #### From NeDB/Lowdb
346
- ```javascript
347
- // Before (NeDB)
348
- const Datastore = require('nedb');
349
- const db = new Datastore({ filename: 'data.db' });
350
-
351
- // After (JexiDB)
352
- import { Database } from 'jexidb';
353
- const db = new Database('data.jdb', {
354
- fields: { /* define your schema */ },
355
- indexes: { /* define indexes */ }
356
- });
357
- await db.init(); // Required!
358
- ```
359
-
360
- #### From SQLite
361
- ```javascript
362
- // SQLite requires native compilation
363
- const sqlite3 = require('sqlite3').verbose();
364
- const db = new sqlite3.Database('data.db');
365
-
366
- // JexiDB - pure JavaScript, no compilation
367
- import { Database } from 'jexidb';
368
- const db = new Database('data.jdb', { /* config */ });
369
- ```
370
-
371
- #### From LocalStorage/IndexedDB
372
- ```javascript
373
- // Browser storage limitations
374
- localStorage.setItem('data', JSON.stringify(largeDataset));
375
-
376
- // JexiDB - true file persistence
377
- const db = new Database('data.jdb', { /* config */ });
378
- await db.insert(largeDataset);
379
- await db.save();
380
- ```
381
-
382
- ## Community & Support
383
-
384
- ### Get Help
385
- - 📖 **[Full Documentation](docs/README.md)** - Complete guides and API reference
386
- - 💬 **[GitHub Issues](https://github.com/EdenwareApps/jexidb/issues)** - Bug reports and feature requests
387
- - 💡 **[Examples](docs/EXAMPLES.md)** - Real-world usage patterns
388
-
389
- ### Contributing
390
- Found a bug or want to contribute? We welcome pull requests!
391
-
392
- 1. Fork the repository
393
- 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
394
- 3. Commit your changes (`git commit -m 'Add amazing feature'`)
395
- 4. Push to the branch (`git push origin feature/amazing-feature`)
396
- 5. Open a Pull Request
397
-
398
- ### License
399
- MIT License - see the [LICENSE](LICENSE) file for details.
400
-
401
- ## What's Next - Roadmap
402
-
403
- ### Planned Features
404
- - 🚀 **SQL-like Query Builder** - More intuitive query construction
405
- - 📊 **Built-in Aggregation Functions** - Count, sum, average operations
406
- - 🔐 **Encryption Support** - Optional data encryption at rest
407
- - 📱 **React Native Support** - Mobile database capabilities
408
- - 🌐 **Multi-threading** - Better concurrent operation handling
409
- - 📈 **Advanced Analytics** - Built-in data analysis tools
410
-
411
- ### Recent Updates
412
- - **v2.1.0** - Term mapping auto-detection, 77% size reduction
413
- - **Schema Enforcement** - Mandatory fields for data consistency
414
- - ✅ **Streaming Operations** - Memory-efficient bulk operations
415
- - ✅ **Compressed Indexes** - Persistent indexing with compression
416
-
417
- ---
418
-
419
- <p align="center">
420
- <img width="380" src="https://edenware.app/jexidb/images/jexidb-mascot3.jpg" alt="JexiDB mascot - JavaScript EXtended Intelligent DataBase for desktop applications" title="JexiDB - JavaScript EXtended Intelligent DataBase mascot" />
421
- </p>
422
-
423
- ## Support the Project
424
-
425
- If JexiDB helps your project, consider supporting its development:
426
-
427
- - ⭐ **Star on GitHub** - Show your support
428
- - 🐛 **Report Issues** - Help improve stability
429
- - 💝 **Donate** - [PayPal](https://www.paypal.com/donate/?item_name=megacubo.tv&cmd=_donations&business=efox.web%40gmail.com)
430
-
431
- **The Only Pure JS Database with Smart Disk Persistence & Intelligent Memory Management**
432
-
433
- **Built with ❤️ for the JavaScript community**
434
-
435
- ---
436
-
437
- ---
438
-
439
- ## Links & Resources
440
-
441
- - **🏠 Homepage**: [edenware.app/jexidb](https://edenware.app/jexidb)
442
- - **📦 NPM Package**: [npmjs.com/package/jexidb](https://www.npmjs.com/package/jexidb)
443
- - **📚 Documentation**: [docs/README.md](docs/README.md)
444
- - **💬 Issues**: [github.com/EdenwareApps/jexidb/issues](https://github.com/EdenwareApps/jexidb/issues)
445
- - **⭐ GitHub**: [github.com/EdenwareApps/jexidb](https://github.com/EdenwareApps/jexidb)
446
-
447
- ## Keywords & Tags
448
-
449
- javascript database, nodejs database, electron database, pure javascript database, embedded database, nosql database, json database, desktop database, local database, schema database, streaming database, memory efficient database, persistent database, term mapping, point reading, schema enforced database, jsonl database, compressed indexes
1
+ # JexiDB - Intelligent JavaScript Database for Desktop Apps
2
+
3
+ **JEXIDB** = **J**avaScript **EX**tended **I**ntelligent **D**ata**B**ase
4
+
5
+ **The Only Pure JS Database with Smart Disk Persistence & Intelligent Memory Management** - Schema-Enforced, Streaming-Ready, No Native Dependencies
6
+
7
+ <p align="center">
8
+ <img width="270" src="https://edenware.app/jexidb/images/jexidb-logo-icon.jpg" alt="JexiDB - JavaScript EXtended Intelligent DataBase for Node.js and Electron applications" title="JexiDB - JavaScript EXtended Intelligent DataBase logo" />
9
+ </p>
10
+
11
+ <div align="center">
12
+
13
+ [![npm version](https://img.shields.io/npm/v/jexidb.svg?style=flat-square)](https://www.npmjs.com/package/jexidb)
14
+ [![npm downloads](https://img.shields.io/npm/dm/jexidb.svg?style=flat-square)](https://www.npmjs.com/package/jexidb)
15
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
16
+ [![Node.js Version](https://img.shields.io/node/v/jexidb?style=flat-square)](https://nodejs.org/)
17
+ [![GitHub stars](https://img.shields.io/github/stars/EdenwareApps/jexidb?style=flat-square)](https://github.com/EdenwareApps/jexidb)
18
+ [![GitHub issues](https://img.shields.io/github/issues/EdenwareApps/jexidb?style=flat-square)](https://github.com/EdenwareApps/jexidb/issues)
19
+
20
+ **⚡ High-Performance • 💾 Persistent • 🧠 Memory Efficient • 🚀 Production Ready**
21
+
22
+ [📖 Documentation](docs/README.md) • [💡 Examples](docs/EXAMPLES.md) • [🔧 API Reference](docs/API.md) • [🚀 Quick Start](#quick-start---5-minutes-to-database)
23
+
24
+ </div>
25
+
26
+ ## Table of Contents
27
+
28
+ - [Why Developers Choose JexiDB](#why-developers-choose-jexidb)
29
+ - [JexiDB vs Other JavaScript Databases](#jexidb-vs-other-javascript-databases)
30
+ - [Performance Benchmarks](#performance-benchmarks)
31
+ - [Frequently Asked Questions](#frequently-asked-questions)
32
+ - [Quick Start - 5 Minutes to Database](#quick-start---5-minutes-to-database)
33
+ - [Real-World Use Cases](#real-world-use-cases)
34
+ - [Migration Guide](#migration-guide)
35
+ - [What's Next - Roadmap](#whats-next---roadmap)
36
+
37
+ ---
38
+
39
+ ## What Makes JexiDB Unique
40
+
41
+ **The Only Pure JS Database with Smart Disk Persistence & Intelligent Memory Management**
42
+
43
+ JexiDB stands out among JavaScript databases by combining **pure JavaScript simplicity** with **enterprise-grade data management**. While other JS databases offer basic persistence, JexiDB provides **intelligent memory management** and **structured data enforcement** that traditional document databases lack.
44
+
45
+ ### Unique Advantages Over Other JavaScript Databases
46
+
47
+ 🚀 **Pure JavaScript, No Compromises** - 100% JavaScript, no native dependencies, WASM, or compilation required. Compatible with both CommonJS and ESM modules
48
+
49
+ 💾 **Intelligent Disk Persistence** - JSONL files with compressed persistent indexes, not memory-only storage
50
+
51
+ 📋 **Schema Enforcement** - Structured data model like SQL tables, ensuring data consistency in pure JavaScript
52
+
53
+ 🧠 **Smart Memory Management** - Point reading and streaming operations, handles millions of records without loading everything into RAM
54
+
55
+ 🔍 **Advanced Query Optimization** - MongoDB-like operators with automatic term mapping for 77% size reduction
56
+
57
+ ⚡ **Production-Ready Performance** - Compressed indexes, streaming operations, and automatic optimization
58
+
59
+ 🖥️ **Desktop-First Design** - Optimized for Electron, NW.js, and local Node.js applications from the ground up
60
+
61
+ ### Technical Specifications
62
+
63
+ - **Storage Format**: JSONL (JSON Lines) with compressed persistent indexes
64
+ - **Memory Strategy**: Point reading + streaming, doesn't require loading entire database
65
+ - **Query Language**: Advanced operators ($in, $or, $and, ranges, regex, case-insensitive)
66
+ - **Data Types**: string, number, boolean, array (with automatic optimization)
67
+ - **Indexing**: Persistent compressed indexes with term mapping for optimal performance
68
+ - **Transactions**: Operation queuing with manual save control (auto-save removed for better control)
69
+ - **Persistence**: Manual save functionality ensures data integrity and performance
70
+ - **File Size**: Typically 25-75% smaller than alternatives for repetitive data
71
+
72
+ ## JexiDB vs Other JavaScript Databases
73
+
74
+ | Database | Pure JS | Disk Persistence | Memory Usage | Data Structure | Best Use Case |
75
+ |----------|---------|------------------|--------------|----------------|---------------|
76
+ | **JexiDB** | ✅ 100% | ✅ JSONL + Compressed Indexes | 🧠 Smart (point reading) | 📋 Schema Required | Desktop apps, Node.js with structured data |
77
+ | **NeDB** | 100% | ✅ JSON files | 📈 High (loads all) | 📄 Document-free | Legacy projects (unmaintained) |
78
+ | **Lowdb** | ✅ 100% | ✅ JSON files | 📈 High (loads all) | 📄 Document-free | Small configs, simple apps |
79
+ | **LokiJS** | 100% | ⚠️ Adapters only | 📈 High (in-memory primary) | 📄 Document-free | In-memory applications |
80
+ | **PouchDB** | ✅ 100% | ✅ IndexedDB/WebSQL | 🧠 Moderate | 📄 Document-free | Offline-first web apps |
81
+ | **SQLite (WASM)** | WASM required | SQLite files | 🧠 Moderate | 📊 SQL Tables | Complex relational data |
82
+
83
+ ### Why Developers Choose JexiDB
84
+
85
+ **Intelligent Memory Management**: Unlike other JS databases that load entire files into memory, JexiDB uses point reading and streaming operations for unlimited dataset sizes.
86
+
87
+ **Schema Enforcement**: Provides SQL-like data structure and consistency guarantees in pure JavaScript, without the complexity of traditional databases.
88
+
89
+ **Desktop-First Architecture**: Built specifically for Electron and NW.js applications, eliminating native dependency issues that complicate desktop deployment.
90
+
91
+ **Enterprise Performance**: Combines disk persistence with in-memory query speed through compressed indexes and automatic term mapping optimization.
92
+
93
+ ## Performance Benchmarks
94
+
95
+ ### Memory Usage Comparison (100,000 records)
96
+
97
+ | Database | Memory Usage | Query Speed | File Size |
98
+ |----------|--------------|-------------|-----------|
99
+ | **JexiDB** | ~25MB | ~5ms (indexed) | ~15MB (compressed) |
100
+ | NeDB | ~80MB | ~20ms | ~45MB |
101
+ | Lowdb | ~120MB | ~50ms | ~60MB |
102
+ | LokiJS | ~90MB | ~8ms | ~35MB (adapters) |
103
+
104
+ *Benchmarks based on typical e-commerce product catalog with repetitive category/tag data*
105
+
106
+ ### Size Reduction with Term Mapping
107
+
108
+ - **Without term mapping**: 45MB file size
109
+ - **With JexiDB term mapping**: 15MB file size
110
+ - **Reduction**: Up to 77% for datasets with repetitive strings
111
+
112
+ ## Frequently Asked Questions
113
+
114
+ ### Is JexiDB suitable for production applications?
115
+
116
+ Yes, JexiDB is production-ready with features like:
117
+ - Automatic data integrity recovery
118
+ - Transaction support with operation queuing
119
+ - Comprehensive error handling
120
+ - Active maintenance and updates
121
+
122
+ ### How does JexiDB handle large datasets?
123
+
124
+ JexiDB uses **point reading** - it only loads the specific records needed for your query, not the entire database. Combined with streaming operations via `iterate()` and `walk()`, it can handle millions of records efficiently.
125
+
126
+ ### Can JexiDB replace SQLite in my Electron app?
127
+
128
+ For many use cases, yes! JexiDB offers:
129
+ - 100% JavaScript (no native SQLite compilation issues)
130
+ - ✅ Schema enforcement like SQL tables
131
+ - Advanced queries with operators
132
+ - Better memory efficiency for large datasets
133
+ - ✅ Simpler deployment (no native binaries)
134
+
135
+ ### What's the difference between fields and indexes?
136
+
137
+ **Fields** define your data structure (schema) - they're required and enforced.
138
+ **Indexes** optimize query performance - they're optional and should only be created for fields you query frequently.
139
+
140
+ ### How does JexiDB compare to traditional databases?
141
+
142
+ JexiDB provides SQL-like structure and data consistency in pure JavaScript, but without the complexity of server setup or native dependencies. It's perfect for applications that need structured data without the overhead of full database systems.
143
+
144
+ ## Quick Start - 5 Minutes to Database
145
+
146
+ ### Installation
147
+
148
+ ```bash
149
+ npm install EdenwareApps/jexidb
150
+ ```
151
+
152
+ ### Create Your First Database
153
+
154
+ ```javascript
155
+ import { Database } from 'jexidb';
156
+
157
+ const db = new Database('users.jdb', {
158
+ fields: {
159
+ id: 'number',
160
+ name: 'string',
161
+ email: 'string',
162
+ role: 'string',
163
+ tags: 'array:string'
164
+ },
165
+ indexes: {
166
+ email: 'string', // Fast email lookups
167
+ role: 'string', // Filter by role
168
+ tags: 'array:string' // Search by tags
169
+ }
170
+ });
171
+
172
+ // Initialize and use
173
+ await db.init();
174
+
175
+ // Insert data
176
+ await db.insert({
177
+ id: 1,
178
+ name: 'John Doe',
179
+ email: 'john@example.com',
180
+ role: 'admin',
181
+ tags: ['developer', 'team-lead']
182
+ });
183
+
184
+ // Query data
185
+ const users = await db.find({ role: 'admin' });
186
+ const devs = await db.find({ tags: 'developer' });
187
+
188
+ // Save changes
189
+ await db.save();
190
+ ```
191
+
192
+ **That's it!** Your data is now persisted to `users.jdb` file.
193
+
194
+ ## Real-World Use Cases
195
+
196
+ ### ✅ Electron Desktop Applications
197
+ ```javascript
198
+ // User management in Electron app
199
+ const userDb = new Database('users.jdb', {
200
+ fields: { id: 'number', email: 'string', profile: 'object' },
201
+ indexes: { email: 'string' }
202
+ });
203
+
204
+ // Works offline, no server required
205
+ const user = await userDb.findOne({ email: 'user@example.com' });
206
+ ```
207
+
208
+ ### ✅ Local Node.js Applications
209
+ ```javascript
210
+ // Configuration storage
211
+ const configDb = new Database('config.jdb', {
212
+ fields: { key: 'string', value: 'string' },
213
+ indexes: { key: 'string' }
214
+ });
215
+
216
+ // Persist app settings locally
217
+ await configDb.insert({ key: 'theme', value: 'dark' });
218
+ ```
219
+
220
+ ### ✅ Data Processing Scripts
221
+ ```javascript
222
+ // Process large CSV files
223
+ const dataDb = new Database('processed.jdb', {
224
+ fields: { id: 'number', data: 'object' }
225
+ });
226
+
227
+ // Handle millions of records efficiently
228
+ for await (const record of dataDb.iterate({ processed: false })) {
229
+ // Process record
230
+ record.processed = true;
231
+ record.timestamp = Date.now();
232
+ }
233
+ await dataDb.save();
234
+ ```
235
+
236
+ ### ✅ NW.js Applications
237
+ ```javascript
238
+ // Product catalog for desktop POS system
239
+ const productsDb = new Database('products.jdb', {
240
+ fields: {
241
+ sku: 'string',
242
+ name: 'string',
243
+ price: 'number',
244
+ category: 'string',
245
+ tags: 'array:string'
246
+ },
247
+ indexes: {
248
+ sku: 'string',
249
+ category: 'string',
250
+ tags: 'array:string'
251
+ }
252
+ });
253
+ ```
254
+
255
+ ## Perfect Use Cases for JexiDB
256
+
257
+ ### Ideal For:
258
+ - **Desktop Applications** (Electron, NW.js, Tauri) - No native dependency issues
259
+ - **Local Node.js Applications** - Simple deployment without database servers
260
+ - **Offline-First Apps** - Works completely offline with local persistence
261
+ - **Data Processing Scripts** - Handle large datasets with streaming operations
262
+ - **Configuration Storage** - Simple key-value storage with schema validation
263
+ - **Prototyping** - Quick setup with real persistence and advanced queries
264
+
265
+ ### Less Ideal For:
266
+ - **Multi-user web applications** - Use database servers instead
267
+ - **Heavy concurrent writes** - JexiDB is single-writer optimized
268
+ - **Complex relational data** - Consider traditional SQL databases
269
+ - **Browser-only applications** - Use IndexedDB/PouchDB for web
270
+
271
+ ## Bulk Operations with `iterate()`
272
+
273
+ The `iterate()` method provides high-performance bulk update capabilities with streaming support:
274
+
275
+ ```javascript
276
+ // Basic bulk update
277
+ for await (const product of db.iterate({ category: 'electronics' })) {
278
+ product.price = product.price * 1.1; // 10% increase
279
+ product.updatedAt = new Date().toISOString();
280
+ }
281
+
282
+ // With progress tracking
283
+ for await (const item of db.iterate(
284
+ { status: 'active' },
285
+ {
286
+ chunkSize: 1000,
287
+ progressCallback: (progress) => {
288
+ console.log(`Processed: ${progress.processed}, Modified: ${progress.modified}`);
289
+ }
290
+ }
291
+ )) {
292
+ item.processed = true;
293
+ }
294
+ ```
295
+
296
+ **Benefits:**
297
+ - **Streaming Performance**: Process large datasets without loading everything into memory
298
+ - **Bulk Updates**: Modify multiple records in a single operation
299
+ - **Automatic Change Detection**: Automatically detects modified records
300
+ - **Progress Tracking**: Optional progress callbacks for long-running operations
301
+
302
+ ## Advanced Queries
303
+
304
+ ```javascript
305
+ // Multiple conditions (automatic AND)
306
+ const results = await db.find({
307
+ age: { '>': 18, '<': 65 },
308
+ status: 'active',
309
+ category: { '$in': ['premium', 'vip'] }
310
+ });
311
+
312
+ // Logical operators
313
+ const complex = await db.find({
314
+ '$or': [
315
+ { type: 'admin' },
316
+ { '$and': [
317
+ { type: 'user' },
318
+ { verified: true }
319
+ ]}
320
+ ]
321
+ });
322
+
323
+ // Arrays
324
+ const withTags = await db.find({
325
+ tags: 'javascript', // Contains 'javascript'
326
+ tags: { '$all': ['js', 'node'] } // Contains all values
327
+ });
328
+
329
+ // Coverage analysis with filtering
330
+ const liveCoverage = await db.coverage('tags', [
331
+ { terms: ['javascript'], excludes: [] },
332
+ { terms: ['react', 'vue'], excludes: ['angular'] }
333
+ ], { mediaType: 'live' }) // Only analyze live content
334
+
335
+ // Multi-value filtering (OR logic)
336
+ const multiTypeCoverage = await db.coverage('tags', [
337
+ { terms: ['tutorial'] }
338
+ ], { mediaType: ['live', 'vod'] }) // Live OR VOD content
339
+ ```
340
+
341
+ ## Testes
342
+
343
+ JexiDB inclui uma suíte completa de testes com Jest:
344
+
345
+ ```bash
346
+ npm test # Executa todos os testes
347
+ npm run test:watch # Modo watch para desenvolvimento
348
+ npm run test:coverage # Relatório de cobertura
349
+ ```
350
+
351
+ ## 📚 Documentation
352
+
353
+ - **[📖 Full Documentation](docs/README.md)** - Complete documentation index
354
+ - **[🔧 API Reference](docs/API.md)** - Detailed API documentation
355
+ - **[💡 Examples](docs/EXAMPLES.md)** - Practical examples and use cases
356
+ - **[🚀 Getting Started](docs/README.md#quick-start)** - Quick start guide
357
+
358
+ ## Migration Guide
359
+
360
+ ### Coming from Other Databases
361
+
362
+ #### From NeDB/Lowdb
363
+ ```javascript
364
+ // Before (NeDB)
365
+ const Datastore = require('nedb');
366
+ const db = new Datastore({ filename: 'data.db' });
367
+
368
+ // After (JexiDB)
369
+ import { Database } from 'jexidb';
370
+ const db = new Database('data.jdb', {
371
+ fields: { /* define your schema */ },
372
+ indexes: { /* define indexes */ }
373
+ });
374
+ await db.init(); // Required!
375
+ ```
376
+
377
+ #### From SQLite
378
+ ```javascript
379
+ // SQLite requires native compilation
380
+ const sqlite3 = require('sqlite3').verbose();
381
+ const db = new sqlite3.Database('data.db');
382
+
383
+ // JexiDB - pure JavaScript, no compilation
384
+ import { Database } from 'jexidb';
385
+ const db = new Database('data.jdb', { /* config */ });
386
+ ```
387
+
388
+ #### From LocalStorage/IndexedDB
389
+ ```javascript
390
+ // Browser storage limitations
391
+ localStorage.setItem('data', JSON.stringify(largeDataset));
392
+
393
+ // JexiDB - true file persistence
394
+ const db = new Database('data.jdb', { /* config */ });
395
+ await db.insert(largeDataset);
396
+ await db.save();
397
+ ```
398
+
399
+ ## Community & Support
400
+
401
+ ### Get Help
402
+ - 📖 **[Full Documentation](docs/README.md)** - Complete guides and API reference
403
+ - 💬 **[GitHub Issues](https://github.com/EdenwareApps/jexidb/issues)** - Bug reports and feature requests
404
+ - 💡 **[Examples](docs/EXAMPLES.md)** - Real-world usage patterns
405
+
406
+ ### Contributing
407
+ Found a bug or want to contribute? We welcome pull requests!
408
+
409
+ 1. Fork the repository
410
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
411
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
412
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
413
+ 5. Open a Pull Request
414
+
415
+ ### License
416
+ MIT License - see the [LICENSE](LICENSE) file for details.
417
+
418
+ ## What's Next - Roadmap
419
+
420
+ ### Planned Features
421
+ - 🚀 **SQL-like Query Builder** - More intuitive query construction
422
+ - 📊 **Built-in Aggregation Functions** - Count, sum, average operations
423
+ - 🔐 **Encryption Support** - Optional data encryption at rest
424
+ - 📱 **React Native Support** - Mobile database capabilities
425
+ - 🌐 **Multi-threading** - Better concurrent operation handling
426
+ - 📈 **Advanced Analytics** - Built-in data analysis tools
427
+
428
+ ### Recent Updates
429
+ - **v2.1.0** - Term mapping auto-detection, 77% size reduction
430
+ - ✅ **Schema Enforcement** - Mandatory fields for data consistency
431
+ - **Streaming Operations** - Memory-efficient bulk operations
432
+ - ✅ **Compressed Indexes** - Persistent indexing with compression
433
+
434
+ ---
435
+
436
+ <p align="center">
437
+ <img width="380" src="https://edenware.app/jexidb/images/jexidb-mascot3.jpg" alt="JexiDB mascot - JavaScript EXtended Intelligent DataBase for desktop applications" title="JexiDB - JavaScript EXtended Intelligent DataBase mascot" />
438
+ </p>
439
+
440
+ ## Support the Project
441
+
442
+ If JexiDB helps your project, consider supporting its development:
443
+
444
+ - **Star on GitHub** - Show your support
445
+ - 🐛 **Report Issues** - Help improve stability
446
+ - 💝 **Donate** - [PayPal](https://www.paypal.com/donate/?item_name=megacubo.tv&cmd=_donations&business=efox.web%40gmail.com)
447
+
448
+ **The Only Pure JS Database with Smart Disk Persistence & Intelligent Memory Management**
449
+
450
+ **Built with ❤️ for the JavaScript community**
451
+
452
+ ---
453
+
454
+ ---
455
+
456
+ ## Links & Resources
457
+
458
+ - **📦 NPM Package**: [npmjs.com/package/jexidb](https://www.npmjs.com/package/jexidb)
459
+ - **📚 Documentation**: [docs/README.md](docs/README.md)
460
+ - **💬 Issues**: [github.com/EdenwareApps/jexidb/issues](https://github.com/EdenwareApps/jexidb/issues)