{"id":19382727,"url":"https://github.com/authzed/gochugaru","last_synced_at":"2025-07-25T23:40:53.244Z","repository":{"id":217596691,"uuid":"741313126","full_name":"authzed/gochugaru","owner":"authzed","description":"Go client library for SpiceDB that strives to be as ergonomic as possible","archived":false,"fork":false,"pushed_at":"2025-06-04T18:12:37.000Z","size":94,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-22T00:57:11.147Z","etag":null,"topics":["acl","database","fine-grained-authorization","golang","golang-library","grpc","rbac","spicedb","spicedb-client","zanzibar"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/authzed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-01-10T06:12:43.000Z","updated_at":"2025-06-04T18:12:39.000Z","dependencies_parsed_at":"2024-02-19T04:25:05.852Z","dependency_job_id":"06016771-7587-434a-921f-fb890859888f","html_url":"https://github.com/authzed/gochugaru","commit_stats":null,"previous_names":["jzelinskie/gochugaru","authzed/gochugaru"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/authzed/gochugaru","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fgochugaru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fgochugaru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fgochugaru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fgochugaru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/authzed","download_url":"https://codeload.github.com/authzed/gochugaru/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fgochugaru/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262084806,"owners_count":23256297,"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":["acl","database","fine-grained-authorization","golang","golang-library","grpc","rbac","spicedb","spicedb-client","zanzibar"],"created_at":"2024-11-10T09:22:59.055Z","updated_at":"2025-06-26T14:31:48.183Z","avatar_url":"https://github.com/authzed.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg align=\"right\" width=\"100\" height=\"100\" alt=\"DALL·E 2024-01-10 01 10 19 - the go gopher holding a jar of gochugaru\" src=\"https://github.com/authzed/gochugaru/assets/343539/67bb8a28-d425-472f-96ec-2abbe2982ed2\"/\u003e\n\n# gochugaru\n\n[![GoDoc](https://godoc.org/github.com/authzed/gochugaru?status.svg)](https://godoc.org/github.com/authzed/gochugaru)\n[![Docs](https://img.shields.io/badge/docs-authzed.com-%234B4B6C \"Authzed Documentation\")](https://authzed.com/docs)\n[![YouTube](https://img.shields.io/youtube/channel/views/UCFeSgZf0rPqQteiTQNGgTPg?color=%23F40203\u0026logo=youtube\u0026style=flat-square\u0026label=YouTube \"Authzed YouTube Channel\")](https://www.youtube.com/channel/UCFeSgZf0rPqQteiTQNGgTPg)\n[![Discord Server](https://img.shields.io/discord/844600078504951838?color=7289da\u0026logo=discord \"Discord Server\")](https://authzed.com/discord)\n[![Twitter](https://img.shields.io/badge/twitter-%40authzed-1D8EEE?logo=twitter \"@authzed on Twitter\")](https://twitter.com/authzed)\n\nA SpiceDB client library striving to be as ergonomic as possible.\n\nThis library builds upon the official [authzed-go library], but tries to expose an interface that guides folks towards optimal performance and correctness.\n\n[authzed-go library]: https://github.com/authzed/authzed-go\n\n## Roadmap\n\n### UX\n\n- ✅ Security-obvious client constructors\n- ✅ Defaults to SpiceDB's best compression method\n- ✅ Automatic back-off \u0026 retry logic\n- ✅ Check One/Many/Any/All methods\n- ✅ Checks use BulkChecks under the hood\n- ✅ Interfaces for Relationships, Objects\n- ✅ Flattened Relationship-type with Caveats\n- ✅ Transaction-style API for Write\n- ✅ Constructors for consistency arguments\n- ✅ Callback-style API for Watch and ReadRelationships\n- ✅ Atomic and non-atomic Relationship deletion\n- 🔜 Keepalives for watch (if necessary)\n\n### APIs\n\n- ✅ Checks\n- ✅ Schema Read/Write\n- ✅ Relationship Read/Write/Delete\n- 🚧 Import/Export Relationships\n- ✅ Watch\n- 🔜 Request Debugging\n- 🔜 Lookup Resources/Subjects\n- 🔜 Reflection APIs\n\n## Examples\n\n### Clients\n\n```go\nimport \"github.com/authzed/gochugaru/client\"\n\n...\n\n// Various constructors to allocate clients for dev and production environments\n// using the best practices.\nauthz, err := client.NewSystemTLS(\"spicedb.mycluster.local\", presharedKey)\nif err != nil {\n  ...\n}\n```\n\n### Checks\n\n```go\nimport \"github.com/authzed/gochugaru/client\"\nimport \"github.com/authzed/gochugaru/rel\"\n\n...\n\n// Build up a set of relationships to be checked like any other slice.\nvar founders []Relationship\nfor _, founder := range []string{\"jake\", \"joey\", \"jimmy\"} {\n  // There are various constructors for the Relationship type that can\n  // trade-off allocations for legibility and understandability.\n  rel, err := rel.FromTriple(\"company:authzed\", \"founder\", \"user:\"+founder)\n  if err != nil {\n    ...\n  }\n  founders = append(founders, rel)\n}\n\n// Various Check methods can be used to simplify common assertions.\nallAreFounders, err := authz.CheckAll(ctx, consistency.MinLatency(), founders...)\nif err != nil {\n  ...\n} else if !allAreFounders {\n  ...\n}\n```\n\n### Writes\n\n```go\nimport \"github.com/authzed/gochugaru/client\"\nimport \"github.com/authzed/gochugaru/rel\"\n\n...\n\n// Transactions are built up of preconditions that must or must not exist and\n// the set of updates (creates, touches, or deletes) to be applied.\nvar txn rel.Txn\n\n// The preconditions:\nfor _, rival := range []string{\"joey\", \"jake\"} {\n  txn.MustNotMatch(rel.MustFromTriple(\"module:gochugaru\", \"creator\", \"user:\"+rival).Filter())\n}\n\n// The updates:\ntxn.Touch(rel.MustFromTriple(\"module:gochugaru\", \"creator\", \"user:jimmy\"))\ntxn.Touch(rel.MustFromTriple(\"module:gochugaru\", \"maintainer\", \"sam\").\n\tWithCaveat(\"on_tuesday\", map[string]any{\"day\": \"wednesday\"}))\n\nwrittenAt, err := authz.Write(ctx, txn)\n...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthzed%2Fgochugaru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauthzed%2Fgochugaru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthzed%2Fgochugaru/lists"}