fedify icon indicating copy to clipboard operation
fedify copied to clipboard

Replace `better-sqlite3` with `node:sqlite` in “Creating your own federated microblog” tutorial

Open dahlia opened this issue 5 months ago • 9 comments

Background

The current Creating your own federated microblog tutorial uses better-sqlite3, a third-party package, for SQLite database operations.

With recent developments in JavaScript runtimes providing native SQLite support, we should update the tutorial to use built-in modules instead of external dependencies.

Proposed Solution

Replace better-sqlite3 with Node.js's built-in node:sqlite module (available since v22).

Benefits

  1. Reduced dependencies: Eliminates the need for external packages
  2. Better performance: Native modules typically offer better performance
  3. Simplified setup: No need to install and manage third-party packages
  4. Future-proof: Aligns with the direction of JavaScript runtimes providing built-in database support
  5. Consistency: Matches the approach we're taking in other tutorials

Implementation Notes

  • Update all SQLite-related code to use node:sqlite module
  • Remove better-sqlite3 from package dependencies
  • Update installation and setup instructions
  • Ensure minimum Node.js version requirement is v22+

Impact

This change will modernize the tutorial, reduce external dependencies, and provide a more streamlined developer experience while maintaining full functionality for Node.js users.

dahlia avatar Jul 03 '25 14:07 dahlia

이미 sqlite3로 튜토리얼을 진행하긴했는데 node:sqlite로 다시 하면서 문서 수정해보고 싶습니다! 제가 해봐도될까요?

I already went through the tutorial using sqlite3, i would like to try it again using node:sqlite! Is it okay if I give it a try

hjleee93 avatar Jul 15 '25 10:07 hjleee93

@hjleee93 물론이죠! 이슈 할당해 드렸습니다.

Of course! I've assigned the issue for you.

dahlia avatar Jul 15 '25 10:07 dahlia

Would it be okay to remove all the sqlite3-related parts from the tutorials? or should I leave them? @dahlia

hjleee93 avatar Jul 15 '25 23:07 hjleee93

Are you referring to better-sqlite3 when you say sqlite3?

dahlia avatar Jul 16 '25 00:07 dahlia

I apologize. YES better-sqlite3 starting from line 684. It is already mentioned. but i wanna make sure:)

hjleee93 avatar Jul 16 '25 09:07 hjleee93

Yeah, those examples using better-sqlite3 should be completely replaced by node:sqlite. Note that those two modules have different APIs, so you don't have to only change imports, but also the actual API usages!

dahlia avatar Jul 16 '25 09:07 dahlia

Sure, thank you!! 감사합니다

hjleee93 avatar Jul 16 '25 09:07 hjleee93

@hjleee93 This issue has been assigned for over two weeks without updates. Please provide a status update, or unassign yourself if you're unable to continue working on it.

github-actions[bot] avatar Oct 09 '25 09:10 github-actions[bot]

@hjleee93 This issue has been assigned for over two weeks without updates. Please provide a status update, or unassign yourself if you're unable to continue working on it.

github-actions[bot] avatar Oct 24 '25 01:10 github-actions[bot]