{"id":15994367,"url":"https://github.com/oskarrough/localfirst","last_synced_at":"2025-06-10T20:12:16.996Z","repository":{"id":184645259,"uuid":"670802273","full_name":"oskarrough/localfirst","owner":"oskarrough","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-04T09:37:07.000Z","size":561,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T11:36:36.299Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://localfirst.0sk.ar","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oskarrough.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-25T21:51:52.000Z","updated_at":"2024-12-16T09:31:21.000Z","dependencies_parsed_at":"2023-07-29T13:42:28.014Z","dependency_job_id":"e7e8de3f-467c-4176-8ae2-de9aaa8e1101","html_url":"https://github.com/oskarrough/localfirst","commit_stats":null,"previous_names":["oskarrough/localfirst"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Flocalfirst","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Flocalfirst/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Flocalfirst/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Flocalfirst/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oskarrough","download_url":"https://codeload.github.com/oskarrough/localfirst/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Flocalfirst/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259144833,"owners_count":22811926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T07:08:41.009Z","updated_at":"2025-06-10T20:12:16.966Z","avatar_url":"https://github.com/oskarrough.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Experimenting with sqlite in a browser via wasm and web workers.\n\n## SQLite is in the browser\n\nVulcan is one way to load sqlite in browser. It also adds persistence, reactivity and the option to merge multiple sqlite databases.\n\n- https://vlcn.io/docs/js/wasm\n- https://vlcn.io/docs/js/persistence\n- https://vlcn.io/docs/js/reactivity\n- https://observablehq.com/@tantaman/cr-sqlite-basic-setup\n- https://github.com/rhashimoto/wa-sqlite\n\nIf you don't care about reactivity or merging, you can also use the WASM package from SQLite directly. This is what we do at the moment.\n\n- https://sqlite.org/wasm/doc/trunk/index.md\n- https://github.com/sqlite/sqlite-wasm\n- https://sqlite.org/wasm/file/demo-123.js?txt\n\nThe database is defined in a web worker, so it doesn't block the main thread.\n\n- https://github.com/sqlite/sqlite-wasm?tab=readme-ov-file#usage-with-vite\n- https://vitejs.dev/guide/features.html#web-workers\n\nThe worker is exposed to the main thread via `Comcast` dependency. The worker is how you interact with the database. For debugging, use `window.localfirstworker` to test.\n\n## Naive sync engine\n\nYou write all data locally using the worker.\n\nAnd then on top, the user can enable predefined remotes to sync data to. For now, only _pulling_ is implemented. You can't yet _push_ to remotes.\n\nSee `./src/remotes/remote.js` for how to create a remote.\n\nCurrently we support two remotes:\n\n- A Matrix room\n- Radio4000\n\n## UI and components\n\nNot really relevant to this project, but still. To render components I'm using web components via Atomico, just to try something new\n\n- https://atomico.gitbook.io/doc/\n\nTo render a table without much work we can use this\n\n- https://fiduswriter.github.io/simple-datatables/documentation/\n\n@todo how we we export/import the sqlite db?\n\n- https://github.com/vlcn-io/cr-sqlite/discussions/266\n\nOther interesting projects using databases in browser\n\n- https://github.com/nalgeon/sqlime\n\nhttps://sqlite.org/wasm/doc/trunk/cookbook.md\n\n\n## CLI\n\n```\nbun src/cli.ts --slug oskar --folder /mnt/d/Dropbox/Music/Radios --dry-run --download  \n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foskarrough%2Flocalfirst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foskarrough%2Flocalfirst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foskarrough%2Flocalfirst/lists"}