{"id":44688085,"url":"https://github.com/joris-gallot/grantify","last_synced_at":"2026-02-15T06:35:09.062Z","repository":{"id":322150907,"uuid":"1088359817","full_name":"joris-gallot/grantify","owner":"joris-gallot","description":"Lightweight framework-agnostic RBAC and permission management toolkit","archived":false,"fork":false,"pushed_at":"2025-11-02T20:40:43.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-02T22:14:10.147Z","etag":null,"topics":["access-control","acl","auth","authorization","permissions","rbac","roles","security"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/joris-gallot.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-02T20:18:20.000Z","updated_at":"2025-11-02T20:40:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/joris-gallot/grantify","commit_stats":null,"previous_names":["joris-gallot/grantify"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/joris-gallot/grantify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joris-gallot%2Fgrantify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joris-gallot%2Fgrantify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joris-gallot%2Fgrantify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joris-gallot%2Fgrantify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joris-gallot","download_url":"https://codeload.github.com/joris-gallot/grantify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joris-gallot%2Fgrantify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29471946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T05:26:30.465Z","status":"ssl_error","status_checked_at":"2026-02-15T05:26:21.858Z","response_time":118,"last_error":"SSL_read: 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":["access-control","acl","auth","authorization","permissions","rbac","roles","security"],"created_at":"2026-02-15T06:35:08.210Z","updated_at":"2026-02-15T06:35:09.049Z","avatar_url":"https://github.com/joris-gallot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Grantify\n\nGrantify is a lightweight, framework-agnostic access-control toolkit, it provides a simple and fully typed API for managing permissions.\n\n## Usage\n\n```typescript\nimport { createGrantify } from '@grantify/core'\n\nconst { defineRule } = createGrantify({\n  permissions: ['post:create', 'post:edit', 'post:delete'] as const,\n  user: { id: 1, isAdmin: false },\n})\n\nconst grantify = defineRule('post:create', user =\u003e user.id === 1)\n  .defineRule('post:edit', (user, ctx: { isOwner: boolean } | undefined) =\u003e\n    Boolean(user.isAdmin || ctx?.isOwner)\n  )\n  .defineRule('post:delete', async () =\u003e await Promise.resolve(true))\n  .build()\n\nconst canEdit = grantify.can('post:edit', { id: 2, isAdmin: false }, { isOwner: true })\n// Returns: true\n\nconst canDelete = await grantify.can('post:delete')\n// Returns: true (async rule)\n```\n\n## API\n\n### `can(permission, user?, context?)`\n\nCheck if a user has permission to perform an action.\n\n**Parameters:**\n- `permission` (required): The permission string to check (must be one of the defined permissions)\n- `user` (optional): The user object to check permissions for, if omitted, uses the default user provided in `createGrantify()`\n- `context` (optional): Additional context data required by the rule, the type is inferred based on the rule definition\n\n**Returns:**\n- `boolean` for synchronous rules\n- `Promise\u003cboolean\u003e` for asynchronous rules\n\n**Examples:**\n\n```typescript\n// Check with default user (no additional parameters)\ngrantify.can('post:create')\n\n// Check with custom user\ngrantify.can('post:create', { id: 2, isAdmin: true })\n\n// Check with custom user and context\ngrantify.can('post:edit', { id: 3, isAdmin: false }, { isOwner: true })\n\n// Async rules return a Promise\nawait grantify.can('post:delete')\n```\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoris-gallot%2Fgrantify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoris-gallot%2Fgrantify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoris-gallot%2Fgrantify/lists"}