{"id":15065889,"url":"https://github.com/ojkelly/bunjil","last_synced_at":"2025-10-05T03:30:33.423Z","repository":{"id":57191593,"uuid":"121351070","full_name":"ojkelly/bunjil","owner":"ojkelly","description":"A GraphQL bastion server with schema merging, authentication and authorization with Policy Based Access Control","archived":true,"fork":false,"pushed_at":"2019-06-19T11:54:23.000Z","size":1743,"stargazers_count":25,"open_issues_count":28,"forks_count":5,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-09-26T00:56:22.986Z","etag":null,"topics":["authentication","authorization","bastion","graphql","graphql-server","koa","prisma","public-server","wahn"],"latest_commit_sha":null,"homepage":"https://bunjil.js.org","language":"TypeScript","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/ojkelly.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-13T07:17:46.000Z","updated_at":"2023-01-28T17:51:28.000Z","dependencies_parsed_at":"2022-09-13T02:51:10.877Z","dependency_job_id":null,"html_url":"https://github.com/ojkelly/bunjil","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojkelly%2Fbunjil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojkelly%2Fbunjil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojkelly%2Fbunjil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojkelly%2Fbunjil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ojkelly","download_url":"https://codeload.github.com/ojkelly/bunjil/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219876883,"owners_count":16554798,"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":["authentication","authorization","bastion","graphql","graphql-server","koa","prisma","public-server","wahn"],"created_at":"2024-09-25T00:56:56.853Z","updated_at":"2025-10-05T03:30:28.051Z","avatar_url":"https://github.com/ojkelly.png","language":"TypeScript","funding_links":[],"categories":["\u003ca name=\"TypeScript\"\u003e\u003c/a\u003eTypeScript"],"sub_categories":[],"readme":"# Bunjil\n\n[![View on npm](https://img.shields.io/npm/v/bunjil.svg)](https://npmjs.org/package/bunjil)\n[![npm downloads](https://img.shields.io/npm/dm/bunjil.svg)](https://npmjs.org/package/bunjil)\n[![Dependencies](https://img.shields.io/david/ojkelly/bunjil.svg)](https://david-dm.org/ojkelly/bunjil)\n[![Build Status](https://travis-ci.org/ojkelly/bunjil.svg?branch=master)](https://travis-ci.org/ojkelly/bunjil)\n[![codecov](https://codecov.io/gh/ojkelly/bunjil/branch/master/graph/badge.svg)](https://codecov.io/gh/ojkelly/bunjil)\n[![NSP Status](https://nodesecurity.io/orgs/ojkelly/projects/7f441bdb-76ab-4155-aec9-00777b5adc9a/badge)](https://nodesecurity.io/orgs/ojkelly/projects/7f441bdb-76ab-4155-aec9-00777b5adc9a)[![Known Vulnerabilities](https://snyk.io/test/npm/bunjil/badge.svg)](https://snyk.io/test/npm/bunjil)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fojkelly%2Fbunjil.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fojkelly%2Fbunjil?ref=badge_shield)\n\n[bunjil.js.org](https://bunjil.js.org) | [Getting Started](https://bunjil.js.org/docs/getting-started)\n\nBunjil is a public facing GraphQL server.\n\nIt comes with Policy Based authorization, and hook for your own authentication (Passport.js, Auth0, database).\n\nIt’s purpose is to allow the stitching of one or more private GraphQL Schemas into a public one.\n\n\n# Roadmap\n\n*   [x] Documentation\n*   [x] Merge multiple GraphQL schemas into one public schema\n*   [ ] Ability to hide Types\n*   [ ] Ability to hide fields (masking)\n*   [x] Policy based authorization down to the field/edge level\n*   [x] Ability to deny access to fields based on roles with a policy\n*   [x] Caching, and caching policies down to the field level\n*   [x] Authentication hook\n*   [x] Authorization hook\n\n## Getting Started\n\n`yarn add bunjil`\n\n`npm install bunjil`\n\n```typescript\n// Import Bunjil and the Policy Types\nimport { Bunjil, Policy, PolicyCondition, PolicyEffect } from \"bunjil\";\n\n// Create a schema\n\nconst typeDefs: string = `\n  type User {\n    id: ID\n    name: String\n    password: String\n    posts(limit: Int): [Post]\n  }\n\n  type Post {\n    id: ID\n    title: String\n    views: Int\n    author: User\n  }\n\n  type Query {\n    author(id: ID): User\n    topPosts(limit: Int): [Post]\n  }\n`;\n\n// Resolvers are not shown in this example.\nconst schema = makeExecutableSchema({\n    typeDefs,\n    resolvers,\n});\n\n// Create a simple policy allowing public access to the data\nconst policies: Policy[] = [\n    {\n        id: \"public:read-all\",\n        resources: [\"Query::topPosts\", \"Post::*\", \"User::*\"],\n        actions: [\"query\"],\n        effect: PolicyEffect.Allow,\n        roles: [\"*\"],\n    },\n    {\n        // Explicitly deny access to the password field.\n        // This will superseed any other policy\n        id: \"deny:user::password\",\n        resources: [\"User::password\"],\n        actions: [\"query\"],\n        effect: PolicyEffect.Deny,\n        roles: [\"*\"],\n    },\n];\n\n// Create our bunjil server\nconst bunjil: Bunjil = new Bunjil({\n    // Server config\n    server: {\n        port: 3000,\n        tracing: true,\n        cacheControl: true,\n    },\n    // Optionally in DEV you can enable the GraphQL playground\n    playgroundOptions: {\n        enabled: false,\n    },\n    // Set the endpoints where GraphQL is available at\n    endpoints: {\n        graphQL: \"/graphql\",\n        subscriptions: \"/graphql/subscriptions\",\n        playground: \"/playground\",\n    },\n    policies,\n});\n\n// Add our schema to the Bunjil instance\nbunjil.addSchema({ schemas: [schema] });\n\n// Now start Bunjil\nawait bunjil.start();\n```\n\n### Usage\n\n## Running the tests\n\nUse `yarn test` or `npm run test`.\n\nTests are written with `ava`, and we would strongly like tests with any new functionality.\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](https://github.com/ojkelly/bunjil/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/ojkelly/bunjil/tags).\n\n## Authors\n\n*   **Owen Kelly** - [ojkelly](https://github.com/ojkelly)\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fojkelly%2Fbunjil.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fojkelly%2Fbunjil?ref=badge_large)\n\nThis project is licensed under the MIT License - see the [LICENSE.md](https://github.com/ojkelly/bunjil/LICENSE.md) file for details\n\n## Acknowledgments\n\n*   [Behind the name](https://en.wikipedia.org/wiki/Bunjil)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fojkelly%2Fbunjil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fojkelly%2Fbunjil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fojkelly%2Fbunjil/lists"}