A lightweight GraphQL server which use SQLite3 as data source.
It will be deployable in Cloudflare Workers (WIP).
You can define your SQLite3 schema in a single YAML file (or generate YAML from existing SQLite3 database).
- Define SQLite3 schema in the YAML file.
- Generate YAML file from existing SQLite Database (incomplete).
- Hasura-like query/mutation language (Subscriptions are planned), but not all features are supported, see Limitations And Caveats.
- "Environment" Independent Design, the core component doesn't even depend on any SQLite3 binding, so it can be ported to many js runtime environments (like Cloudflare Workers and Deno Deploy).
npm i -g @qlite/cli@latest
Sample Config File
tables:
books:
columns:
id: {type: integer, primary_key: true}
title: {type: text, not_null: true}
url: {type: text}
created_at: {type: timestamp}
relations:
authors:
type: array
remote_table: book_author_maps
mappings:
id: book_id
book_author_maps:
columns:
book_id: {type: integer, primary_key: true}
author_id: {type: integer, primary_key: true}
relations:
book:
type: object
remote_table: books
mappings:
book_id: id
author:
type: object
remote_table: authors
mappings:
author_id: id
authors:
columns:
id: {type: integer, primary_key: true}
name: {type: text, not_null: true}
created_at: {type: timestamp}
relations:
books:
type: array
remote_table: book_author_maps
mappings:
id: author_id
Starting a dev server:
qlite serve x.yaml
And now you can play with the GraphiQL via http://127.0.0.1:9000/graphql
This project aimed to provide some level of hasura compatibility, but full compatibility with it is not the goal.
Supported features list:
- Simple Object Queries (note the json support is still lack)
- Nested Object Queries
- Aggregation Queries
- Basic Filter Query Results / Search Queries
- Sort Query Results
- Paginate Query Results
- (builtin) Use Multiple Arguments in a Query
- (builtin) Multiple Queries in a Request
- Use Variables / Aliases / Fragments / Directives in Queries
- Filter based on nested objects' fields
Incomplete/Unsupported features list:
- Not all comparison operators and aggregate functions are supported, but some of them will be supported in future releases
- distinct_on are not supported.
- on_conflict type has different syntax
- (TODO) JSON related feature
- (TODO) Insert an object along with its related objects through relationships