cruddl - create a cuddly GraphQL API for your database, using the GraphQL SDL to model your schema.
This TypeScript library creates an executable GraphQL schema from a model definition and provides queries and mutations to access a database. Currently, it supports the multi-model database ArangoDB.
- Schema definition using GraphQL types, fields and directives
- Modelling features like relations, embedded lists and objects
- Query features include filtering, sorting, cursor-based pagination and arbitrary nesting
- Schema validation
- Role-based authorization (field and type-based; static and data-dependent)
- Pluggable database backends (currently supports ArangoDB and an in-memory implementation)
npm install --save cruddle
Install ArangoDB and create a new database.
If you just want to explore the features, you can also use an in-memory database implementation - but don't use this for anything else.
Define your data model and create a project:
Then, create the GraphQL schema and serve it:
;;db.updateSchemaschema; // create missing collections;server.startconsole.log'Server is running on ';
Although the feature set is already quite extensive, this project is still in active development. A number of regression tests helps to avoid unexpected changes in behavior, but they do not yet cover all cases. Documentation is relatively sparse and will be extended in the future. We aim to contribute to the ongoing developments regarding GraphQL database interfaces and might change our API to more closely match these of other implementations in the future.