{"id":25315978,"url":"https://github.com/s5no5t/frtrss","last_synced_at":"2026-02-17T05:02:06.831Z","repository":{"id":277053508,"uuid":"929054638","full_name":"s5no5t/frtrss","owner":"s5no5t","description":"TypeScript-Enabled authorization library","archived":false,"fork":false,"pushed_at":"2025-02-22T16:09:03.000Z","size":783,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-28T20:41:56.842Z","etag":null,"topics":["abac","authorization"],"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/s5no5t.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-02-07T18:13:44.000Z","updated_at":"2025-02-22T16:09:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"24ae80cc-1978-484d-a203-84bd57b3e3bb","html_url":"https://github.com/s5no5t/frtrss","commit_stats":null,"previous_names":["s5no5t/frtrss"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/s5no5t/frtrss","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s5no5t%2Ffrtrss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s5no5t%2Ffrtrss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s5no5t%2Ffrtrss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s5no5t%2Ffrtrss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s5no5t","download_url":"https://codeload.github.com/s5no5t/frtrss/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s5no5t%2Ffrtrss/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29534452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T05:00:25.817Z","status":"ssl_error","status_checked_at":"2026-02-17T04:57:16.126Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["abac","authorization"],"created_at":"2025-02-13T18:53:40.827Z","updated_at":"2026-02-17T05:02:06.823Z","avatar_url":"https://github.com/s5no5t.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# frtrss\n\n![frtrss logo](logo.png)\n\nA type-safe attribute-based access control (ABAC) authorization library for TypeScript applications.\n\n## Features\n\n- Type-safe, intuitive API for defining permissions\n- Field-level permissions with nested path support\n- Allow and deny permissions\n- Serialization/deserialization support\n- Optional validation support with [zod](https://github.com/colinhacks/zod)\n- Safe default \"deny all\"\n- Full browser and Node.js compatibility with CommonJS and ES Modules support\n- Tree-shakeable for optimal bundle size\n- Complete TypeScript definitions\n\n## Installation\n\n```bash\nnpm install frtrss\n```\n\nZod is an optional peer dependency. If you want to use schema validation (recommended), install zod:\n\n```bash\nnpm install zod\n```\n\nIf you don't install zod, frtrss will fall back to basic runtime validation.\n\n## Basic Usage\n\n```typescript\nimport { PermissionBuilder, ResourceDefinition } from \"frtrss\";\n\ninterface User {\n  id: string;\n  role: \"admin\" | \"editor\" | \"user\";\n}\n\ninterface Document {\n  id: string;\n  metadata: {\n    title: string;\n    status: \"draft\" | \"published\" | \"archived\";\n    version: number;\n  };\n  content: string;\n}\n\ntype DocumentActions = \"read\" | \"write\";\n\n// Define the object type mapping\ntype Objects = {\n  document: ResourceDefinition\u003cDocument, DocumentActions\u003e;\n};\n\n// Create permissions with allow and deny rules\nconst permissions = new PermissionBuilder\u003cObjects\u003e()\n  // Allow editors to read published documents with version \u003e= 2\n  .allow\u003cUser\u003e({ id: \"1\", role: \"editor\" })\n  .to([\"read\", \"write\"])\n  .on(\"document\") // document name is statically typed\n  .fields([\"metadata.title\", \"content\"])    \n  .when({\n    field: \"metadata.status\", // field name is statically typed\n    operator: \"eq\",\n    value: \"published\",\n  })\n  .when({\n    field: \"metadata.version\",\n    operator: \"gte\",\n    value: 2,\n  })\n  // But deny write access to published documents\n  .deny\u003cUser\u003e({ id: \"1\", role: \"editor\" })\n  .to(\"write\")\n  .on(\"document\")\n  .fields([\"content\"])\n  .when({\n    field: \"metadata.status\",\n    operator: \"eq\",\n    value: \"published\",\n  })\n  .build();\n\n// Check permissions\nconst canRead = permissions.check({\n  subject: { id: \"1\", role: \"editor\" },\n  action: \"read\",\n  object: \"document\",\n  field: \"content\",\n  data: {\n    metadata: { \n      status: \"published\",\n      version: 3\n    },\n  },\n}); // true\n\nconst canWrite = permissions.check({\n  subject: { id: \"1\", role: \"editor\" },\n  action: \"write\",\n  object: \"document\",\n  field: \"content\",\n  data: {\n    metadata: { \n      status: \"published\",\n      version: 3\n    },\n  },\n}); // false - denied by explicit deny rule\n```\n\n## API Documentation \u0026 Use Cases\n\nSee [API.md](./doc/API.md).\n\n## Attribute-Based Access Control (ABAC)\n\nfrtrss implements [Attribute-Based Access Control (ABAC)](https://en.wikipedia.org/wiki/Attribute-based_access_control), a flexible and powerful authorization model that evaluates permissions based on attributes/properties of:\n\n- The subject (user/service requesting access)\n- The action (operation being performed)\n- The object (resource being accessed)\n- The fields (specific properties of the object being accessed)\n- The conditions (context of the request)\n\nThis approach allows for more dynamic and fine-grained access control compared to traditional role-based systems, enabling complex permission rules based on data properties and conditions.\n\n## frtrss vs [casl.js](https://github.com/stalniy/casl)\n\n* simpler and more intuitive API\n* more type safety and developer experience\n* doesn't rely on class reflection for object types\n* more explicit about field-level permissions\n* zod schema validation\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Run tests\nnpm test\n\n# Build the package\nnpm run build\n\n# Run linter\nnpm run lint\n\n# Type check\nnpm run typecheck\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs5no5t%2Ffrtrss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs5no5t%2Ffrtrss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs5no5t%2Ffrtrss/lists"}