{"id":18812426,"url":"https://github.com/warrant-dev/warrant-demo-app-ts","last_synced_at":"2025-04-13T21:14:08.763Z","repository":{"id":43684894,"uuid":"377633360","full_name":"warrant-dev/warrant-demo-app-ts","owner":"warrant-dev","description":"Example demonstrating how to add end-to-end authorization \u0026 access control to an ExpressJS + React app using Warrant","archived":false,"fork":false,"pushed_at":"2024-06-03T19:06:26.000Z","size":1054,"stargazers_count":4,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-03T22:06:07.408Z","etag":null,"topics":["abac","access-control","acl","attribute-based-access-control","authorization","authz","expressjs","permissions","rbac","react","role-based-access-control"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/warrant-dev.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-06-16T21:34:50.000Z","updated_at":"2024-06-03T19:06:30.000Z","dependencies_parsed_at":"2024-06-03T21:54:58.105Z","dependency_job_id":"fe40313a-1490-492f-bc2d-1755ce9fa542","html_url":"https://github.com/warrant-dev/warrant-demo-app-ts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warrant-dev%2Fwarrant-demo-app-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warrant-dev%2Fwarrant-demo-app-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warrant-dev%2Fwarrant-demo-app-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warrant-dev%2Fwarrant-demo-app-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/warrant-dev","download_url":"https://codeload.github.com/warrant-dev/warrant-demo-app-ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223606120,"owners_count":17172610,"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":["abac","access-control","acl","attribute-based-access-control","authorization","authz","expressjs","permissions","rbac","react","role-based-access-control"],"created_at":"2024-11-07T23:32:57.616Z","updated_at":"2024-11-07T23:32:57.706Z","avatar_url":"https://github.com/warrant-dev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Warrant Demo Application\n\nThis demo application demonstrates how to add full-stack access control (specifically Role Based Access Control) to an ExpressJS + React application. The app uses the [Warrant NodeJS SDK](https://www.npmjs.com/package/@warrantdev/warrant-node) and [Warrant ExpressJS middleware](https://www.npmjs.com/package/@warrantdev/warrant-express-middleware) to control access to the API and data passed to the frontend. The React frontend uses the [Warrant React SDK](https://www.npmjs.com/package/@warrantdev/react-warrant-js) to show/hide components in the UI based on each user's permitted access.\n\n## Get Started\n\nAfter creating a Warrant account [here](https://app.warrant.dev/signup), follow the steps below to get the demo app running locally.\n\n### Create object types\n```bash\ncurl \"https://api.warrant.dev/v1/object-types\" \\\n    -X POST \\\n    -H \"Authorization: ApiKey YOUR_KEY\" \\\n    --data-raw \\\n    '{\n        \"type\": \"group\",\n        \"relations\": {\n            \"member\": {}\n        }\n    }'\n```\n```bash\ncurl \"https://api.warrant.dev/v1/object-types\" \\\n    -X POST \\\n    -H \"Authorization: ApiKey YOUR_KEY\" \\\n    --data-raw \\\n    '{\n        \"type\": \"store\",\n        \"relations\": {\n            \"owner\": {},\n            \"creator\": {},\n            \"editor\": {\n                \"type\": \"anyOf\",\n                \"rules\": [\n                    {\n                        \"type\": \"userset\",\n                        \"relation\": \"owner\"\n                    }\n                ]\n            },\n            \"viewer\": {\n                \"type\": \"anyOf\",\n                \"rules\": [\n                    {\n                        \"type\": \"userset\",\n                        \"relation\": \"editor\"\n                    }\n                ]\n            }\n        }\n    }'\n```\n```bash\ncurl \"https://api.warrant.dev/v1/object-types\" \\\n    -X POST \\\n    -H \"Authorization: ApiKey YOUR_KEY\" \\\n    --data-raw \\\n    '{\n        \"type\": \"item\",\n        \"relations\": {\n            \"parent_store\": {},\n            \"creator\": {},\n            \"editor\": {\n                \"type\": \"anyOf\",\n                \"rules\": [\n                    {\n                        \"type\": \"objectUserset\",\n                        \"relation\": \"parent_store\",\n                        \"userset\": {\n                            \"type\": \"userset\",\n                            \"relation\": \"editor\"\n                        }\n                    }\n                ]\n            },\n            \"viewer\": {\n                \"type\": \"anyOf\",\n                \"rules\": [\n                    {\n                        \"type\": \"userset\",\n                        \"relation\": \"editor\"\n                    }\n                ]\n            }\n        }\n    }'\n```\n\n### API Key\nReplace occurences of `\u003creplace_with_your_api_key\u003e` in `/api/src/index.ts` and `/api/src/scripts/initializeData.js` with your API Key.\n\nReplace occurence of `\u003creplace_with_your_client_key\u003e` in `/client/src/App.jsx` with your Client Key.\n\n### Server (Express)\n```bash\ncd api\nnpm install\nnpm run init # only required the first time you setup the app\nnpm run start\n```\n\n### Client (React)\n```bash\ncd client/react\nnpm install\nnpm run dev\n```\n\n### Client (Vue)\n```bash\ncd client/vue\nnpm install\nnpm run serve\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwarrant-dev%2Fwarrant-demo-app-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwarrant-dev%2Fwarrant-demo-app-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwarrant-dev%2Fwarrant-demo-app-ts/lists"}