|
| 1 | +--- |
| 2 | +name: Clean Up DB Requirements Doc |
| 3 | +overview: Transform the raw prompt in `new-core-dbs.md` into a structured requirements document with clear sections for background, requirements, constraints, and a placeholder for research results. |
| 4 | +todos: |
| 5 | + - id: rewrite-doc |
| 6 | + content: Rewrite new-core-dbs.md with proper requirements document structure |
| 7 | + status: completed |
| 8 | +isProject: false |
| 9 | +--- |
| 10 | + |
| 11 | +# New Core Database Requirements Document Cleanup |
| 12 | + |
| 13 | +## Current State |
| 14 | + |
| 15 | +The file [`docs/new-core-dbs.md`](docs/new-core-dbs.md) contains a raw research prompt with the following key information embedded: |
| 16 | + |
| 17 | +- **Target**: edge-core-js library |
| 18 | +- **Current storage**: disklet library (bridges to native on mobile, localStorage on web, filesystem on Node) |
| 19 | +- **Environments**: iOS/Android webview, Node.js, web browser |
| 20 | +- **Goal**: Add SQL or NoSQL database that's fast and efficient |
| 21 | + |
| 22 | +## Proposed Structure |
| 23 | + |
| 24 | +Rewrite as a proper requirements document: |
| 25 | + |
| 26 | +```markdown |
| 27 | +# Edge Core JS Database Requirements |
| 28 | + |
| 29 | +## Background |
| 30 | + |
| 31 | +Brief context about edge-core-js and why a database is needed. |
| 32 | + |
| 33 | +## Current Architecture |
| 34 | + |
| 35 | +- Disklet library overview |
| 36 | +- Platform bridging details |
| 37 | + |
| 38 | +## Requirements |
| 39 | + |
| 40 | +### Platform Support |
| 41 | +- iOS (headless WebView) |
| 42 | +- Android (headless WebView) |
| 43 | +- Node.js |
| 44 | +- Web browser |
| 45 | + |
| 46 | +### Performance |
| 47 | +- Fast read/write operations |
| 48 | +- Efficient storage |
| 49 | + |
| 50 | +### API Style |
| 51 | +- SQL or NoSQL (flexible) |
| 52 | + |
| 53 | +## Constraints |
| 54 | + |
| 55 | +- Must work within WebView JavaScript context on mobile |
| 56 | +- Must integrate with existing disklet architecture or replace it |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +## Research Results |
| 61 | + |
| 62 | +(To be completed) |
| 63 | + |
| 64 | +For each database option, include: |
| 65 | +- Platform compatibility details |
| 66 | +- Query capabilities (what types of queries are supported) |
| 67 | +- Performance characteristics |
| 68 | +- Integration complexity |
| 69 | +``` |
| 70 | + |
| 71 | +## Changes |
| 72 | + |
| 73 | +1. Add proper markdown heading |
| 74 | +2. Extract background context into its own section |
| 75 | +3. Break out platform requirements explicitly |
| 76 | +4. Add constraints section based on the architectural details mentioned |
| 77 | +5. Add empty "Research Results" section at the end for future use |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## Execution Log |
| 82 | + |
| 83 | +**Completed**: Rewrote `new-core-dbs.md` as a structured requirements document. |
| 84 | + |
| 85 | +**Changes made**: |
| 86 | +- Added proper title: "Edge Core JS Database Requirements" |
| 87 | +- Created Background section explaining edge-core-js purpose and need for database |
| 88 | +- Created Current Architecture section detailing disklet library and platform bridging |
| 89 | +- Created Requirements section with subsections: |
| 90 | + - Platform Support (iOS/Android WebView, Node.js, Web browser) |
| 91 | + - Performance (fast read/write, efficient storage, concurrent access) |
| 92 | + - API Style (SQL/NoSQL flexible, JS/TS API, Promise-based) |
| 93 | + - Query Capabilities (key-value, range queries, filtering, indexing) |
| 94 | +- Created Constraints section (WebView compatibility, disklet integration, offline-first, persistence) |
| 95 | +- Added Research Results placeholder with template for documenting each option |
| 96 | + |
| 97 | +--- |
| 98 | + |
| 99 | +**Completed**: Added research results for 5 database options. |
| 100 | + |
| 101 | +**Databases Researched**: |
| 102 | +1. **Dexie.js** - IndexedDB wrapper, excellent cross-platform, NoSQL queries |
| 103 | +2. **sql.js** - SQLite via WebAssembly, full SQL support, manual persistence |
| 104 | +3. **PouchDB** - Document store with CouchDB sync, largest community |
| 105 | +4. **RxDB** - Reactive NoSQL, multiple backends, higher complexity |
| 106 | +5. **LokiJS** - In-memory database, fast but limited maintenance |
| 107 | + |
| 108 | +**Top Recommendations**: |
| 109 | +- Dexie.js for simplicity and balance |
| 110 | +- sql.js if full SQL is required |
| 111 | +- PouchDB if sync capabilities are needed later |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +**Completed**: Added Cordova WebView Migration Proposal. |
| 116 | + |
| 117 | +**Proposal Summary**: |
| 118 | +- Analyzed current architecture (custom WKWebView/WebView with bespoke message handlers) |
| 119 | +- Documented current native methods: disklet (6 methods), fetch, randomBytes, scrypt |
| 120 | +- Proposed migration to Cordova WebView for plugin ecosystem access |
| 121 | +- Outlined 3-phase migration: Cordova integration → SQLite integration → Testing |
| 122 | +- Identified challenges: RN+Cordova bridge, scrypt porting, migration complexity |
| 123 | +- Added alternative "Custom SQLite Bridge" approach as lighter option |
| 124 | +- Recommendation: Custom SQLite Bridge for database-only needs; full Cordova for broader plugin access |
0 commit comments