{"id":22281437,"url":"https://github.com/aeb-labs/cruddl","last_synced_at":"2025-05-16T11:06:12.975Z","repository":{"id":29962275,"uuid":"123331232","full_name":"AEB-labs/cruddl","owner":"AEB-labs","description":"Create a GraphQL API for your database, using the GraphQL SDL to model your schema.","archived":false,"fork":false,"pushed_at":"2025-05-15T08:51:48.000Z","size":15055,"stargazers_count":132,"open_issues_count":35,"forks_count":16,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-05-16T11:05:59.736Z","etag":null,"topics":["arangodb","graphql","graphql-js","hacktoberfest","typescript"],"latest_commit_sha":null,"homepage":"https://aeb-labs.github.io/cruddl/","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/AEB-labs.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-02-28T19:22:50.000Z","updated_at":"2025-05-15T08:51:53.000Z","dependencies_parsed_at":"2023-11-07T17:51:29.191Z","dependency_job_id":"d12b1c23-8a1e-45a6-aabb-792395a38bd7","html_url":"https://github.com/AEB-labs/cruddl","commit_stats":null,"previous_names":[],"tags_count":204,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AEB-labs%2Fcruddl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AEB-labs%2Fcruddl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AEB-labs%2Fcruddl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AEB-labs%2Fcruddl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AEB-labs","download_url":"https://codeload.github.com/AEB-labs/cruddl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518383,"owners_count":22084374,"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":["arangodb","graphql","graphql-js","hacktoberfest","typescript"],"created_at":"2024-12-03T16:18:09.854Z","updated_at":"2025-05-16T11:06:07.957Z","avatar_url":"https://github.com/AEB-labs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cruddl\n\n[![npm version](https://badge.fury.io/js/cruddl.svg)](https://npmjs.org/cruddl)\n[![Build Status](https://github.com/AEB-labs/cruddl/workflows/CI/badge.svg)](https://github.com/AEB-labs/cruddl/actions?query=branch%3Amain)\n[![Package Quality](https://npm.packagequality.com/shield/cruddl.svg)](https://packagequality.com/#?package=cruddl)\n\n**cruddl** - create a cuddly GraphQL API for your database, using the GraphQL SDL to model your\nschema.\n\nThis TypeScript library creates an executable GraphQL schema from a model definition and provides\nqueries and mutations to access a database. Currently, it supports the multi-model database\n[ArangoDB](https://www.arangodb.com/). The concept being inspired by existing projects like\n[prisma](https://github.com/graphcool/prisma) and\n[join-monster](https://github.com/stems/join-monster), cruddl exploits the expressiveness of the\nArango Query Language (AQL) to generate one tailored query for each GraphQL request.\n\n**[Try it online](https://aeb-labs.github.io/cruddl/)**\n\n## Features\n\n-   Schema definition using GraphQL types, fields and directives\n-   Modelling features like relations, embedded lists and objects\n-   Query features include filtering, sorting, cursor-based pagination and arbitrary nesting\n-   Schema validation\n-   Role-based authorization (field and type-based; static and data-dependent)\n-   Pluggable database backends (currently supports ArangoDB and an in-memory implementation)\n\n## Usage\n\n```\nnpm install --save cruddl\n```\n\nInstall [ArangoDB](https://www.arangodb.com/) and create a new database.\n\n```typescript\nimport { ArangoDBAdapter } from 'cruddl';\nconst db = new ArangoDBAdapter({\n    databaseName: 'databaseName',\n    url: 'http://root:@localhost:8529',\n    user: 'root',\n    password: '',\n});\n```\n\nIf you just want to explore the features, you can also use an in-memory database implementation -\nbut don't use this for anything else.\n\n```typescript\nimport { InMemoryAdapter } from 'cruddl';\nconst db = new InMemoryAdapter();\n```\n\nDefine your data model and create a project:\n\n```typescript\nimport { Project } from 'cruddl';\nconst project = new Project({\n    sources: [\n        {\n            name: 'schema.graphqls',\n            body: `\n            type Movie @rootEntity {\n              title: String\n              actors: Actor @relation\n            }\n            \n            type Actor @rootEntity {\n              name: String\n              movies: Movie @relation(inverseOf: \"actors\")\n            }`,\n        },\n        {\n            name: 'permission-profiles.json',\n            body: JSON.stringify({\n                permissionProfiles: {\n                    default: {\n                        permissions: [\n                            {\n                                roles: ['users'],\n                                access: 'readWrite',\n                            },\n                        ],\n                    },\n                },\n            }),\n        },\n    ],\n    getExecutionOptions: ({ context }) =\u003e ({ authContext: { authRoles: ['users'] } }),\n    getOperationIdentifier: ({ context }) =\u003e context as object, // each operation is executed with an unique context object\n});\n```\n\nThen, create the GraphQL schema and serve it:\n\n```typescript\nimport { ApolloServer } from 'apollo-server';\nconst schema = project.createSchema(db);\ndb.updateSchema(project.getModel()); // create missing collections\nconst server = new ApolloServer({\n    schema,\n    context: ({ req }) =\u003e req, // pass request as context so we have a unique context object for each operation\n});\nserver.listen(4000, () =\u003e console.log('Server is running on http://localhost:4000/'));\n```\n\nSee the [modelling guide](docs/modelling.md) and the [api documentation](docs/api.md) for details.\n\n### Usage in a browser environment\n\nThe core of cruddl perfectly works in a browser (e.g., using webpack), and this can be useful to\ngenerate a mock GraphQL schema on the fly or to validate a cruddl project. However, the ArangoDB\nadapter only works with node imports like `path`. Unless you configure webpack to provide mock\nmodules for them, you will get an error when you import `cruddl` in a webpack environment. To solve\nthis, you can import the core symbols from `cruddl/core` and the `InMemoryAdapter` from\n`cruddl/inmemory`.\n\n## Running Tests\n\nFor consistency, tests shall be run against a single arangodb node:\n\n1. npm i\n2. npm run start_arangodb\n3. ensure you have access to console at http://localhost:8529\n4. npm run test\n\nWhen done, stop the instance with `npm run stop_arangodb`\n\n## Documentation\n\n-   [Modelling guide](docs/modelling.md)\n-   [GraphQL API](docs/api.md)\n-   [I18n](docs/i18n.md)\n\n## Supported versions\n\ncruddl currently supports the following versions of ArangoDB:\n\n-   3.11\n-   3.12\n\nArangoDB 3.8 is still included in the CI tests, but no longer supported officially, and the CI tests\nwill be removed in a future minor or patch release.\n\nStarting with ArangoDB 3.12, the default locale for new databases has been changed from `en_US` to\n`en_US_POSIX`. cruddl does not support `en_US_POSIX` at the moment. If you don't have a locale\nconfigured on your operating system (`LANG` is not set), you need to change the locale to `en_US`.\nYou can either configure the locale on the operating system, or use the `--default-language=en_US`\noption. Do _not_ use `--icu-language`, as this will change the behavior in a different way, which is\nalso currently not supported by cruddl.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faeb-labs%2Fcruddl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faeb-labs%2Fcruddl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faeb-labs%2Fcruddl/lists"}