{"id":31287910,"url":"https://github.com/dylan-gluck/simple-graph-bun","last_synced_at":"2026-05-08T06:52:09.312Z","repository":{"id":316349828,"uuid":"1063006356","full_name":"dylan-gluck/simple-graph-bun","owner":"dylan-gluck","description":"SQLite graph database for the bun runtime","archived":false,"fork":false,"pushed_at":"2025-09-24T03:43:13.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T05:29:17.349Z","etag":null,"topics":["bun","graph-database","knowledge-graph","sqlite","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/dylan-gluck.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-24T03:28:00.000Z","updated_at":"2025-09-24T04:06:18.000Z","dependencies_parsed_at":"2025-09-24T05:39:31.679Z","dependency_job_id":null,"html_url":"https://github.com/dylan-gluck/simple-graph-bun","commit_stats":null,"previous_names":["dylan-gluck/simple-graph-bun"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/dylan-gluck/simple-graph-bun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylan-gluck%2Fsimple-graph-bun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylan-gluck%2Fsimple-graph-bun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylan-gluck%2Fsimple-graph-bun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylan-gluck%2Fsimple-graph-bun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dylan-gluck","download_url":"https://codeload.github.com/dylan-gluck/simple-graph-bun/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylan-gluck%2Fsimple-graph-bun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276738924,"owners_count":25696025,"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","status":"online","status_checked_at":"2025-09-24T02:00:09.776Z","response_time":97,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bun","graph-database","knowledge-graph","sqlite","typescript"],"created_at":"2025-09-24T11:32:22.069Z","updated_at":"2025-09-24T11:32:32.180Z","avatar_url":"https://github.com/dylan-gluck.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple-graph-bun\n\nA SQLite graph database for the [bun](https://github.com/oven-sh/bun) runtime with zero-dependency TypeScript template system for dynamic SQL generation.\n\n## Installation\n\n```bash\nbun add simple-graph-bun\n```\n\n## Usage\n\n```typescript\nimport { createGraph } from 'simple-graph-bun'\n\n// Create graph database instance\nconst graph = createGraph('graph.db')\n\n// Add nodes\ngraph.addNode({ name: 'Alice', type: 'user' }, 'user-1')\ngraph.addNode({ name: 'Bob', type: 'user' }, 'user-2')\n\n// Connect nodes\ngraph.connectNodesWithProperties('user-1', 'user-2', { type: 'follows' })\n\n// Query nodes\nconst alice = graph.findNode('user-1')\nconst aliceConnections = graph.connections('user-1')\n\n// Search nodes using template system\nconst users = graph.findNodes({\n  key: 'type',\n  searchClauses: [\n    buildWhereClause({ keyValue: true, key: 'type', predicate: '=' })\n  ]\n})\n\n// Graph traversal\nconst network = graph.traverse('user-1', {\n  withBodies: true,\n  outbound: true,\n  maxDepth: 2\n})\n\n// Multiple databases\nconst userGraph = createGraph('users.db')\nconst contentGraph = createGraph('content.db')\n\n// In-memory database\nconst memoryGraph = createGraph()\n```\n\n## Features\n\n- **Zero Dependencies**: Uses only native TypeScript and bun:sqlite\n- **Type Safety**: Compile-time checking of query parameters with TypeScript templates\n- **High Performance**: No runtime template parsing overhead\n- **Factory Pattern**: Clean API with multiple database support\n- **JSON Flexibility**: Nodes stored as flexible JSON documents\n- **Graph Traversal**: Recursive CTE-based traversal with configurable depth\n- **Bulk Operations**: Optimized bulk insert/update operations\n\n## Template System\n\nSimpleGraph uses TypeScript template functions instead of external template libraries:\n\n```typescript\nimport { buildWhereClause, buildSearchQuery } from 'simple-graph-bun/templates'\n\n// Build dynamic WHERE clauses\nconst whereClause = buildWhereClause({\n  keyValue: true,\n  key: 'status',\n  predicate: 'LIKE'\n})\n\n// Generate search queries\nconst searchQuery = buildSearchQuery({\n  resultColumn: 'body',\n  tree: true,\n  searchClauses: [whereClause]\n})\n```\n\n## Architecture\n\n- **Factory Pattern**: `createGraph(database)` returns configured instance\n- **Virtual Columns**: ID extraction using SQLite JSON functions\n- **Template Functions**: Type-safe SQL generation with zero dependencies\n- **Atomic Transactions**: Each operation wrapped in SQLite transactions\n\n## References\n\n* Inspired by [simple-graph](https://github.com/dpapathanasiou/simple-graph)\n* Python [SDK](https://github.com/dpapathanasiou/simple-graph-pypi)\n* Go [SDK](https://github.com/dpapathanasiou/simple-graph-go)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylan-gluck%2Fsimple-graph-bun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdylan-gluck%2Fsimple-graph-bun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylan-gluck%2Fsimple-graph-bun/lists"}