{"id":13540948,"url":"https://github.com/genderev/assassin","last_synced_at":"2026-02-27T15:07:42.479Z","repository":{"id":39865665,"uuid":"292049131","full_name":"genderev/assassin","owner":"genderev","description":"Assassin is a decentralized database that uses background threads to kill slow JavaScript.","archived":false,"fork":false,"pushed_at":"2020-09-11T01:15:43.000Z","size":12258,"stargazers_count":84,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-09T12:12:56.600Z","etag":null,"topics":["dat-protocol","database","decentralized","decentralized-database","distributed-systems","web-performance","web-worker","web-workers"],"latest_commit_sha":null,"homepage":"","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/genderev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"ko_fi":"assassindb"}},"created_at":"2020-09-01T16:24:24.000Z","updated_at":"2025-04-25T18:33:53.000Z","dependencies_parsed_at":"2022-09-17T18:43:46.971Z","dependency_job_id":null,"html_url":"https://github.com/genderev/assassin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/genderev/assassin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genderev%2Fassassin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genderev%2Fassassin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genderev%2Fassassin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genderev%2Fassassin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/genderev","download_url":"https://codeload.github.com/genderev/assassin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genderev%2Fassassin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262820183,"owners_count":23369604,"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":["dat-protocol","database","decentralized","decentralized-database","distributed-systems","web-performance","web-worker","web-workers"],"created_at":"2024-08-01T10:00:36.489Z","updated_at":"2026-02-27T15:07:37.458Z","avatar_url":"https://github.com/genderev.png","language":"JavaScript","funding_links":["https://ko-fi.com/assassindb"],"categories":["JavaScript","Using Dat","Modules"],"sub_categories":["Hosting \u0026 Dat Management"],"readme":"\u003cimg alt=\"ASSASSIN\" src=\"https://raw.githubusercontent.com/genderev/assassin/master/assets/assassin.png\"\u003e\n\n\n\n![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)\n![GitHub license1](https://img.shields.io/github/languages/top/genderev/assassin)\n![GitHub license](https://img.shields.io/github/issues-pr-closed-raw/genderev/assassin)\n![GitHub license2](https://img.shields.io/github/languages/code-size/genderev/assassin)\n![GitHub license31](https://img.shields.io/github/issues/genderev/assassin)\n![GitHub license3](https://img.shields.io/github/issues-pr/genderev/assassin)\n![GitHub license4](https://img.shields.io/github/contributors/genderev/assassin)\n![GitHudk](https://img.shields.io/gitter/room/genderev/assassin)\n\n\u003cnav\u003e\n  \u003cp\u003e\u003cstrong\u003eBackground\u003c/strong\u003e\u003c/p\u003e\n  \u003cul\u003e\n    \u003cli\u003e\u003ca href=\"#why-database\"\u003eWhat problem does this solve?\u003c/a\u003e\u003c/li\u003e\n     \u003cli\u003e\u003ca href=\"#what-worker\"\u003eWhat's a web worker?\u003c/a\u003e\u003c/li\u003e\n     \u003cli\u003e\u003ca href=\"#worker-picture\"\u003eWeb Workers Visualized\u003c/a\u003e\u003c/li\u003e\n  \u003c/ul\u003e\n  \n  \u003cp\u003e\u003cstrong\u003eUsage\u003c/strong\u003e\u003c/p\u003e\n  \u003cul\u003e\n     \u003cli\u003e\u003ca href=\"#methods\"\u003eMethods\u003c/a\u003e\u003c/li\u003e\n\n    \n   \u003cli\u003e\u003ca href=\"#install-server\"\u003eServer set up\u003c/a\u003e\u003c/li\u003e\n\n  \u003cli\u003e\u003ca href=\"#install-browser\"\u003eBrowser set up\u003c/a\u003e\u003c/li\u003e\n  \u003c/ul\u003e\n  \n  \n\u003c/nav\u003e\n\n\n\n\n\n\u003carticle\u003e\n\u003ch1 id=\"why-database\"\u003e Why do we need a new database? \u003c/h1\u003e\n\u003cul\u003e\u003cli\u003e \u003cstrong\u003e\u003cem\u003eNo existing decentralized databases\u003c/em\u003e are compatible with \u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers\"\u003eweb workers\u003c/a\u003e.\u003c/strong\u003e \u003c/li\u003e\u003c/ul\u003e\n\u003ch2 id=\"what-worker\"\u003e What are web workers? \u003c/h2\u003e\n  \u003cul\u003e\n\u003cli\u003e \u003cstrong\u003eYou can outsource JavaScript to web workers. \u003c/strong\u003e\u003c/li\u003e\n    \u003cli\u003eWeb workers allow you to run multi-threaded JavaScript.\u003c/li\u003e \n  \u003cli\u003eWhen you run JavaScript in parallel to the main thread, the main thread is free to respond to user input.  \u003c/li\u003e\n    \u003c/ul\u003e\n\u003ch3 id=\"worker-picture\"\u003e Can you explain web workers with a picture? \u003c/h3\u003e\n\u003cp\u003eYou can see in the diagram that without web workers (that's the \"before\" part of the picture), the main thread has to finish processing all JavaScript before responding to user input. With the use of web workers (that's the \"after\" part of the picture), the main thread can send JavaScript to web workers and then focus on updating the UI.\u003c/p\u003e\n\u003cimg alt=\"web worker diagram\" src=\"https://raw.githubusercontent.com/genderev/assassin/master/assets/diagram.png\"\u003e\n\n\u003ch3 id=\"features\"\u003e\n  Features 💥\n\u003c/h3\u003e\n\n\u003cp\u003e💫\u0026nbsp;\u003cstrong\u003e Lightweight\u003c/strong\u003e: Shipped with less than 100 lines of client side code. \u003c/p\u003e\n\n\u003cp\u003e⚖️\u0026nbsp;\u003cstrong\u003e Decentralized\u003c/strong\u003e: Your database has no single point of failure. If the server goes down, your data is easy to retrieve. \u003c/p\u003e\n\n\u003cp\u003e✨\u0026nbsp;\u003cstrong\u003e Works in private browsing\u003c/strong\u003e: I researched databases like LevelDB, PouchDB, and Gun, which rely on \u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\"\u003eIndexedDB\u003c/a\u003e for client-side storage. I wanted these databases to be effective, but I ended up creating this database partly because \u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\"\u003eIndexedDB\u003c/a\u003e is disabled in private browsing, which means none of these databases work for me. \u003c/p\u003e \n\n\u003cp id=\"methods\"\u003e\u003cstrong\u003eMethods:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003e\n  \u003ccode\u003ekiller.connect(url)\u003c/code\u003e - Connect to the server. \u003ccode\u003eurl\u003c/code\u003e refers to the url of the server. You put the server's url into this this function.\u003c/li\u003e\n\u003cli\u003e\n\u003ccode\u003ekiller.create(key,value)\u003c/code\u003e - Add an entry to the database.\u003c/li\u003e\n\u003cli\u003e\n\u003ccode\u003ekiller.update(key,new value)\u003c/code\u003e - Update the value of a key in the database.\u003c/li\u003e\n\u003cli\u003e\n\u003ccode\u003ekiller.delete(key)\u003c/code\u003e - Delete an entry in the database.\u003c/li\u003e\n\u003cli\u003e\n\u003ccode\u003edatabase\u003c/code\u003e - Inside the main thread, you can always access the database through the variable called \u003ccode\u003edatabase\u003c/code\u003e. \u003c/li\u003e\u003c/ul\u003e\n\n\u003ch3 id=\"install-server\"\u003e Get Started: Server \u003c/h3\u003e\nFirst, you need to make a \u003ca href=\"https://fly.io/\"\u003efly.io\u003c/a\u003e account. If you haven't already installed \u003ca href=\"https://dev.to/skaytech/docker-fundamentals-2ibi\"\u003eDocker\u003c/a\u003e, \u003ca href=\"https://docs.docker.com/get-docker/\"\u003einstall it\u003c/a\u003e and have the daemon running while you deploy your server. To deploy your server, type this in your \u003ca href=\"https://www.w3schools.com/whatis/whatis_cli.asp\"\u003eterminal\u003c/a\u003e and hit \"Enter\" after the end of each line.\n\u003cimg alt=\"shell\" src=\"https://raw.githubusercontent.com/genderev/assassin/master/assets/carbon(2).png\"\u003e\n\n\nYou can copy and paste:\n\u003cpre\u003e\ncd /path/to/where_you_want_this_to_be_stored\ngit clone https://github.com/genderev/assassin_server.git\ncd assassin_server\nflyctl init\nflyctl deploy\n\u003c/pre\u003e\n\nYou can also deploy your server to \u003ca href=\"https://buddy.works\"\u003ebuddy.works\u003c/a\u003e or \u003ca href=\"https://begin.com/\"\u003ebegin.com\u003c/a\u003e on your own, if you want.\n\u003ch3 id=\"install-browser\"\u003e Get Started: Browser \u003c/h3\u003e\n\nYou can save this \u003ca href=\"https://raw.githubusercontent.com/genderev/assassin/master/dist/assassin.js\"\u003efile\u003c/a\u003e or you can clone this repo and use \u003ccode\u003eassassin.js\u003c/code\u003e in the \u003ccode\u003edist\u003c/code\u003e folder. \u003ccode\u003eassassin.js\u003c/code\u003e goes inside the web worker that the main thread posts messages to. You can see an example of how to do this in the \u003ca href=\"https://github.com/genderev/assassin/tree/master/demo\"\u003esource code\u003c/a\u003e for the \u003ca href=\"https://assassin-demo.surge.sh/\"\u003edemo\u003c/a\u003e.\n\n\u003ch3 id=\"arch\"\u003eArchitecture:\u003c/h3\u003e\n\n\u003cul\u003e\n\n\u003cli\u003e\u003cstrong\u003eData Model\u003c/strong\u003e: Assassin is a key/value store that supports mapping a key to its corresponding value. \u003c/li\u003e\n\n\u003cli\u003e\u003cstrong\u003e System Architecture\u003c/strong\u003e: The DAT protocol distributes and hosts data between many computers, so there is no one location where data is stored. Assassin relies on the the DAT protocol for data persistence. The metadata of the key-value pairs are stored in a distributed \u003ca href=\"https://en.wikipedia.org/wiki/Trie\"\u003etrie\u003c/a\u003e structure.\u003c/li\u003e\n\n\u003cli\u003e\u003cstrong\u003eIsolation Levels\u003c/strong\u003e: The isolation level is determined by the end user of the database. Assassin is designed to have a low \u003ca href=\"https://en.wikipedia.org/wiki/Isolation_(database_systems)\"\u003eisolation level\u003c/a\u003e.\u003c/li\u003e\n\n\u003cli\u003e\u003cstrong\u003eStorage Model\u003c/strong\u003e: Assassin sends data to the server, which then stores the metadata in the distributed file system \u003ca href=\"https://github.com/hypercore-protocol/hyperdrive\"\u003eHyperdrive,\u003c/a\u003e which is built on the DAT protocol. The data itself is distributed and hosted between multiple peers.\u003c/li\u003e\n\n\u003c/ul\u003e\n\n\u003ch3 id=\"name\"\u003eWhy is it called Assassin?\u003c/h3\u003e\u003cul\u003e\n\u003cli\u003eMy website currently uses the \u003ca href=\"https://gun.eco/\"\u003eGun\u003c/a\u003e database.\u003c/li\u003e \u003cli\u003e Gun has many features I like and the founder is pretty nice. \u003c/li\u003e\u003cli\u003e \u003cstrong\u003eGun stopped working for me.\u003c/strong\u003e\u003c/li\u003e \n\u003cli\u003eGun's  storage adapter \u003ca href=\"https://gun.eco/docs/RAD\"\u003eRAD\u003c/a\u003e relies on IndexedDB, which is \u003cstrong\u003edisabled in private browsing\u003c/strong\u003e. \u003c/li\u003e\u003cli\u003eGun syncs data peer to peer through WebRTC, which \u003cstrong\u003edoesn't function in web workers.\u003c/strong\u003e\u003c/li\u003e\n\u003cli\u003eAssassin is sort of (seriously, very little) like Gun but for web workers.\u003c/li\u003e\u003cli\u003e \u003cstrong\u003eGun + worker = Assassin\u003c/strong\u003e 💥 \u003c/li\u003e\u003c/ul\u003e\n\n\n\n\u003ch4 id=\"demo\"\u003e\n  Demo 🚀 \n\u003c/h4\u003e\n\n\u003cp\u003e\u003ca href=\"https://assassin-demo.surge.sh\"\u003ehttps://assassin-demo.surge.sh\u003c/a\u003e\u003c/p\u003e\n\n\u003ch4 id=\"built-with\"\u003e\n  Built with 🔧\n\u003c/h4\u003e\n\n\u003cul\u003e\n\u003cli\u003e\n\u003ca href=\"https://github.com/hypercore-protocol/hyperdrive\"\u003eHyperdrive\u003c/a\u003e - Thanks for the abstraction layer on top of DAT!\u003c/li\u003e\n\u003cli\u003eHTML - For creating the web demo\u003c/li\u003e\n\u003cli\u003eCSS - For styling the web demo\u003c/li\u003e\n\u003cli\u003eJavaScript - For logic\u003c/li\u003e\n\u003cli\u003e\n\u003ca href=\"https://nodejs.org\"\u003eNode.js\u003c/a\u003e - To serve the logic\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch3 id=\"connect\"\u003eMake sure to share your opinion in:\u003c/h3\u003e\n\n\u003cul\u003e\n\u003cli\u003ethe Assassin \u003ca href=\"https://github.com/genderev/assassin/pulls\"\u003eGitHub pull requests\u003c/a\u003e\n\u003c/li\u003e\n\u003cli\u003ethe \u003ca href=\"https://gitter.im/assassindb/community\"\u003eGitter server\u003c/a\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n     \n\u003cp\u003eAnd if you really want to help make Assassin better, make a \u003ca href=\"https://github.com/genderev/assassin/pulls\"\u003epull request\u003c/a\u003e! I really want to Assassin to have these things, so make a \u003ca href=\"https://github.com/genderev/assassin/pulls\"\u003epull request\u003c/a\u003e showing how to add them:\u003c/p\u003e\n\u003cul\u003e\n  \u003cli\u003e User authentication \u003c/li\u003e\n \u003c/ul\u003e\n \n\n\u003cp\u003e\u003cstrong\u003eAssassin is open source, and always will be.\u003c/strong\u003e\u003c/p\u003e\n\n\u003ch3\u003e\n  \u003cstrong\u003eSupport me on:\u003c/strong\u003e\n\u003c/h3\u003e\n\n\u003cul\u003e\n\n\u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://ko-fi.com/assassindb\"\u003eKo-Fi\u003c/a\u003e\u003c/strong\u003e\u003c/li\u003e\n\n\n\u003c/ul\u003e\n\n\u003cp\u003eStar the repo, \u003ca href=\"https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fgenderev%2Fassassin\u0026text=Assassin%20works%20to%20kill%20slow%20database%20transactions.\"\u003eTweet\u003c/a\u003e, and share among your friends, teams and contacts! \u003c/p\u003e\n\u003c/article\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenderev%2Fassassin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenderev%2Fassassin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenderev%2Fassassin/lists"}