SQLite is an open-source, zero-configuration, self-contained, stand-alone, transaction relational database engine designed to be embedded into an application. Graphback Knex Provider package provides instant integration to your SQLite database, giving you implementation of the CRUD API.
SQLite is a good choice for testing or development purposes. We do not recommend using it in production environment. For a production setup, you can use PostgreSQL.
Install with npm:
Install with yarn:
Configuring the Database
The following code shows how a SQLite database can be configured.
Visit Knex Connection Options to learn more about the different connection options.
Using Knex Provider
The provider exposes a
SQLiteKnexDBDataProvider API, which can be used to create a SQLite data providers for each of your data models.
The code below shows how to create a data provider creator for a SQLite database and how to use it in
The highlighted code does the following:
- Define connection configuration to the database.
- Create a connection to SQLite database using Knex.
- Define the user model.
- Perform the migrations using GraphQL Migrations to create the
- And finally, create a data provider creator which will be applied to our model, using the
The rest of the code uses
buildGraphbackAPI to create Graphback CRUD API based on the defined
Visit Data Models to learn more about how to design your business models.