René's URL Explorer Experiment


Title: Replace better-sqlite3 with sql.js for cross-platform compatibility · Issue #92 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub

Open Graph Title: Replace better-sqlite3 with sql.js for cross-platform compatibility · Issue #92 · JavaScriptSolidServer/JavaScriptSolidServer

X Title: Replace better-sqlite3 with sql.js for cross-platform compatibility · Issue #92 · JavaScriptSolidServer/JavaScriptSolidServer

Description: Problem After fixing bcrypt → bcryptjs in #91, the next blocker for Android/Termux compatibility is better-sqlite3, which also requires native C++ compilation. Current Error on Termux gyp: Undefined variable android_ndk_path in binding.g...

Open Graph Description: Problem After fixing bcrypt → bcryptjs in #91, the next blocker for Android/Termux compatibility is better-sqlite3, which also requires native C++ compilation. Current Error on Termux gyp: Undefine...

X Description: Problem After fixing bcrypt → bcryptjs in #91, the next blocker for Android/Termux compatibility is better-sqlite3, which also requires native C++ compilation. Current Error on Termux gyp: Undefine...

Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/92

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Replace better-sqlite3 with sql.js for cross-platform compatibility","articleBody":"## Problem\n\nAfter fixing bcrypt → bcryptjs in #91, the next blocker for Android/Termux compatibility is `better-sqlite3`, which also requires native C++ compilation.\n\n### Current Error on Termux\n\n```\ngyp: Undefined variable android_ndk_path in binding.gyp\ngyp ERR! configure error \ngyp ERR! cwd .../node_modules/better-sqlite3\nnpm ERR! code 1\n```\n\n### Platforms Affected\n\nSame platforms as the bcrypt issue:\n- ✅ **Termux/Android** - Fails with `gyp: Undefined variable android_ndk_path`\n- ✅ **Windows** - Common node-gyp compilation errors\n- ✅ **ARM devices** - Various build issues\n- ✅ **Restricted environments** - No build tools available\n\n## Proposed Solution\n\n**Switch to sql.js as the primary SQLite implementation.**\n\n### Why This Makes Sense\n\n1. **Already a Dependency**\n   - `sql.js` is already in package.json (line 41)\n   - Just need to use it instead of better-sqlite3\n   - No new dependencies required\n\n2. **Performance Impact is Minimal**\n   \n   JavaScriptSolidServer uses SQLite for:\n   - Nostr relay event storage (when `--nostr` enabled)\n   - ActivityPub/federation data (when ActivityPub enabled)\n   - **NOT used for main pod storage** (that's filesystem-based)\n\n   Performance difference:\n   - better-sqlite3 (C++): ~0.1-0.5ms per query\n   - sql.js (WASM): ~0.2-1ms per query\n   - Difference: Sub-millisecond for infrequent federation operations\n\n3. **Real-World Usage**\n   - SQLite is only used for optional federation features\n   - Main pod operations (GET/PUT/POST/DELETE files) use the filesystem\n   - Federation queries happen rarely compared to file operations\n   - The performance difference is negligible\n\n4. **Cross-Platform Benefits**\n   - Works everywhere JavaScript runs\n   - No compilation step = faster npm install\n   - Better user experience\n\n## Implementation\n\nSimilar to the bcrypt fix:\n\n**Before:**\n```javascript\nimport Database from 'better-sqlite3';\nconst db = new Database('data.db');\n```\n\n**After:**\n```javascript\nimport initSqlJs from 'sql.js';\nconst SQL = await initSqlJs();\nconst db = new SQL.Database();\n```\n\nNeed to update:\n- `package.json` - Remove better-sqlite3, keep sql.js\n- `src/ap/store.js` - ActivityPub storage\n- `src/nostr/relay.js` - Nostr event storage\n- Any other files using better-sqlite3\n\n## Testing Required\n\nTest that federation features still work:\n- Nostr relay event storage\n- ActivityPub inbox/outbox operations\n- Database persistence (sql.js needs file I/O wrapper)\n\n## Note on Persistence\n\n`sql.js` runs in-memory by default. For persistence, we need to:\n1. Load database from file on startup\n2. Save database to file periodically or on writes\n3. Use `fs.readFileSync()` / `fs.writeFileSync()` wrapper\n\nThis is straightforward but needs careful implementation to avoid data loss.\n\n## Alternative Approach\n\nCould also use a try/catch fallback like we originally had for bcrypt:\n\n```javascript\nlet Database;\ntry {\n  Database = (await import('better-sqlite3')).default;\n} catch {\n  // Use sql.js fallback\n  const initSqlJs = (await import('sql.js')).default;\n  Database = await createSqlJsWrapper(initSqlJs);\n}\n```\n\nBut based on the bcrypt experience, it's simpler to just use sql.js everywhere.\n\n## Impact\n\nThis would enable:\n- 📱 Running full Solid+Nostr+ActivityPub server on Android/Termux\n- 💻 Easier installation on Windows\n- 🌍 Universal compatibility\n- ⚡ Faster npm install (no compilation)\n\nCombined with the bcrypt fix, this would make JavaScriptSolidServer truly \"just works\" on all platforms.\n\n## Related\n\n- Closes after bcrypt fix #91\n- Builds on the cross-platform compatibility work\n\n## Testing on Termux\n\nAfter bcrypt fix (#91), installation now fails on better-sqlite3:\n\n```bash\n$ npx javascript-solid-server@latest --version\n# ✅ bcrypt passes (using bcryptjs)\n# ❌ better-sqlite3 fails (native compilation)\n```\n\nWith this fix, the entire stack would work.","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-01-16T12:14:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/92/JavaScriptSolidServer/issues/92"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:aafb6865-0187-3518-635e-aa454610bb8c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAE5E:112FA5:D01A53:1126517:697C03C7
html-safe-nonce8c48c343f5080bab3c67a55b25c1d67cd519f261476748b45316dedcfca11469
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTVFOjExMkZBNTpEMDFBNTM6MTEyNjUxNzo2OTdDMDNDNyIsInZpc2l0b3JfaWQiOiI3NTY4OTkwNjQ4MTIwNjQwNDU1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3e1971da70e8267d2d6010be1bcaa6936cfb1fdfe68aa5555860faca6a5c729b
hovercard-subject-tagissue:3821794498
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptSolidServer/JavaScriptSolidServer/92/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5c889cc53ddbc51b17b1ec7cead7afb0c09f6228398fda9c47e4234866fda1dc/JavaScriptSolidServer/JavaScriptSolidServer/issues/92
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5c889cc53ddbc51b17b1ec7cead7afb0c09f6228398fda9c47e4234866fda1dc/JavaScriptSolidServer/JavaScriptSolidServer/issues/92
og:image:altProblem After fixing bcrypt → bcryptjs in #91, the next blocker for Android/Termux compatibility is better-sqlite3, which also requires native C++ compilation. Current Error on Termux gyp: Undefine...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemelvincarvalho
hostnamegithub.com
expected-hostnamegithub.com
Noneda4f0ee56809799586f8ee546b27f94fe9b5893edfbf87732e82be45be013b52
turbo-cache-controlno-preview
go-importgithub.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git
octolytics-dimension-user_id205442424
octolytics-dimension-user_loginJavaScriptSolidServer
octolytics-dimension-repository_id958025407
octolytics-dimension-repository_nwoJavaScriptSolidServer/JavaScriptSolidServer
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id958025407
octolytics-dimension-repository_network_root_nwoJavaScriptSolidServer/JavaScriptSolidServer
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2d0972e08a3f8dfff1c4bf1f3d026a7d3a209c26
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/92#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJavaScriptSolidServer%2FJavaScriptSolidServer%2Fissues%2F92
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJavaScriptSolidServer%2FJavaScriptSolidServer%2Fissues%2F92
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=JavaScriptSolidServer%2FJavaScriptSolidServer
Reloadhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/92
Reloadhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/92
Reloadhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/92
JavaScriptSolidServer https://github.com/JavaScriptSolidServer
JavaScriptSolidServerhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer
Notifications https://github.com/login?return_to=%2FJavaScriptSolidServer%2FJavaScriptSolidServer
Fork 4 https://github.com/login?return_to=%2FJavaScriptSolidServer%2FJavaScriptSolidServer
Star 4 https://github.com/login?return_to=%2FJavaScriptSolidServer%2FJavaScriptSolidServer
Code https://github.com/JavaScriptSolidServer/JavaScriptSolidServer
Issues 70 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues
Pull requests 6 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pulls
Actions https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/actions
Projects 0 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/projects
Security 0 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/security
Insights https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pulse
Code https://github.com/JavaScriptSolidServer/JavaScriptSolidServer
Issues https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues
Pull requests https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pulls
Actions https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/actions
Projects https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/projects
Security https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/security
Insights https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pulse
New issuehttps://github.com/login?return_to=https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/92
New issuehttps://github.com/login?return_to=https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/92
#93https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/93
Replace better-sqlite3 with sql.js for cross-platform compatibilityhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/92#top
#93https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/93
https://github.com/melvincarvalho
https://github.com/melvincarvalho
melvincarvalhohttps://github.com/melvincarvalho
on Jan 16, 2026https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/92#issue-3821794498
#91https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/91
Replace bcrypt with bcryptjs for cross-platform compatibility #91https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/91
#91https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/91
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.