Graphback allows you to add a GraphQL API to your application without generating any code. Graphback package can be imported and used directly from your code or serverless handlers. Schema and resolvers are created in-code and are passed to an Apollo GraphQL or GraphQL.js server instance.
Adding runtime layer to your application
buildGraphbackAPI method creates a schema, resolvers and CRUD services at runtime using your data model and some minimal configuration. The example below shows how you can use Graphback with Apollo and a Postgres database.
If you prefer to use MongoDb:
By default, Graphback will create a CRUDService with default configuration for each model. You can customise at runtime:
GraphbackAPIbuildGraphbackAPI(model, config) ⇒
|Data model as a string or GraphQL schema. Used to generate the Graphback API resolvers, services and database|
|Creator class specifying which default CRUD service should be created for each model.|
|Creator class specifying which default database provider should be created for each model.|
|Global CRUD configuration for the Graphback API.|
|[config.plugins]||Array.<GraphbackPlugin>||Schema plugins to perform automatic changes to the generated schema|
To change the default application configuration see Graphback Config.
See Defining your Data model for how to design your data model.
Graphback provides a number of different data sources which can be configured at application runtime. See Data Sources.
You can migrate your database to match your schema. See Database Migrations for more.*
Run your application! 🚀
NOTE: Database migrations only supports PostgreSQL databases.