{"id":16835147,"url":"https://github.com/syfaro/bkapi","last_synced_at":"2025-04-08T12:26:42.400Z","repository":{"id":71917001,"uuid":"390487147","full_name":"Syfaro/bkapi","owner":"Syfaro","description":"A fast way to look up the nearest hashes with hamming distance","archived":false,"fork":false,"pushed_at":"2024-06-20T02:29:11.000Z","size":251,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T08:32:54.516Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/Syfaro.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":"2021-07-28T19:58:28.000Z","updated_at":"2024-06-20T02:26:32.000Z","dependencies_parsed_at":"2024-03-23T02:42:09.284Z","dependency_job_id":"55063cd9-d810-4d43-9d8f-23cc9a007976","html_url":"https://github.com/Syfaro/bkapi","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syfaro%2Fbkapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syfaro%2Fbkapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syfaro%2Fbkapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syfaro%2Fbkapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Syfaro","download_url":"https://codeload.github.com/Syfaro/bkapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247840691,"owners_count":21004961,"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":["hacktoberfest"],"created_at":"2024-10-13T12:09:07.316Z","updated_at":"2025-04-08T12:26:42.374Z","avatar_url":"https://github.com/Syfaro.png","language":"Rust","readme":"# bkapi\n\nA fast way to look up hamming distance hashes.\n\n## Querying\n\nThere are two interfaces for querying, both of which can be used simultaneously.\n\n### HTTP\n\nIt provides a single API endpoint, `/search` which takes in a `hash` and\n`distance` query parameter to search for matches. The response looks like this:\n\n```jsonc\n{\n    \"hash\": 8525958787074004077, // Searched hash\n    \"distance\": 3, // Maximum search distance\n    \"hashes\": [ // Results\n        {\"hash\": 8525958787073873005, \"distance\": 1}\n    ]\n}\n```\n\n### NATS\n\nIt listens on `$NATS_PREFIX.bkapi.search` for a payload like:\n\n```json\n[\n    {\"hash\": 12345, \"distance\": 3}\n]\n```\n\nEach input will have a corresponding entry in the response:\n\n```jsonc\n[\n    [ // Results for first input\n        {\"hash\": 8525958787073873005, \"distance\": 1}\n    ]\n]\n```\n\n## Initial Load\n\nThe initial entries are populated through the database query `$DATABASE_QUERY`.\n\n## Listening\n\nIt can be configured to listen to PostgreSQL notifications OR with NATS\nmessages.\n\n### PostgreSQL\n\nIt subscribes to `$DATABASE_SUBSCRIBE`, expecting events to be a JSON object\ncontaining the hash.\n\n### NATS\n\nIt subscribes to `$NATS_PREFIX.bkapi.add`, expecting events to be a JSON object\ncontaining the hash.\n\nJetStream is used to ensure no hashes are lost without having to reload the\nentire tree on a connection error.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyfaro%2Fbkapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyfaro%2Fbkapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyfaro%2Fbkapi/lists"}