airgql: Automatically generate a GraphQL API for an SQLite database

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

AirGQL automatically generates a GraphQL API for SQLite databases. It analyses the database schema and builds the corresponding GraphQL introspection and data resolvers.

The generated API supports all basic CRUD operations and even complex queries and mutations including filters and pagination. It's the perferct solution for easily integrating GraphQL support into existing Haskell servers.

AirGQL is part of the Airsequel project, which provides a complete solution for building web applications on top of SQLite databases.


[Skip to Readme]

Properties

Versions 0.7.1.0, 0.7.1.0, 0.7.1.1, 0.7.1.2, 0.7.1.3
Change log None available
Dependencies aeson (>=2.2.1 && <2.3), airgql, base (>=4.18.2 && <4.19), blaze-markup (>=0.8.3 && <0.9), bytestring (>=0.11.5 && <0.12), cmdargs (>=0.10.22 && <0.11), conduit (>=1.3.5 && <1.4), directory (>=1.3.8 && <1.4), double-x-encoding (>=1.2.1 && <1.3), exceptions (>=0.10.7 && <0.11), extra (>=1.7.14 && <1.8), filepath (>=1.4.200 && <1.5), githash (>=0.1.7 && <0.2), graphql (>=1.3.0 && <1.4), graphql-spice (>=1.0.2 && <1.1), http-client (>=0.7.17 && <0.8), http-types (>=0.12.4 && <0.13), process (>=1.6.17 && <1.7), protolude (>=0.3.4 && <0.4), scientific (>=0.3.7 && <0.4), servant (>=0.20.1 && <0.21), servant-blaze (>=0.9.1 && <0.10), servant-docs (>=0.13 && <0.14), servant-multipart (>=0.12.1 && <0.13), servant-server (>=0.20 && <0.21), simple-sql-parser (>=0.7.1 && <0.8), sqlite-simple (>=0.4.19 && <0.5), template-haskell (>=2.20.0 && <2.21), text (>=2.0.2 && <2.1), time (>=1.12.2 && <1.13), typed-process (>=0.2.11 && <0.3), unix (>=2.8.4 && <2.9), unordered-containers (>=0.2.20 && <0.3), wai (>=3.2.4 && <3.3), wai-cors (>=0.2.7 && <0.3), wai-extra (>=3.1.14 && <3.2), warp (>=3.3.31 && <3.4) [details]
License AGPL-3.0-or-later
Copyright 2024 Feram GmbH
Author Feram GmbH
Maintainer adrian@feram.io
Category Web, Database, SQL, SQLite, GraphQL, Servant, CLI Tool
Home page https://github.com/Airsequel/AirGQL
Uploaded by adrian at 2024-05-02T19:48:58Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for airgql-0.7.1.0

[back to package description]

AirGQL

Automatically generate a GraphQL API for an SQLite database.

Diagram of SQL to GraphQL conversion

How It Works

It analyses the database schema and builds the corresponding GraphQL introspection and data resolvers.

The generated API supports all basic CRUD operations and even complex queries and mutations including filters and pagination.

It is designed to be either used a Haskell library for integrating GraphQL support into existing servers or as a standalone CLI app for quickly spinning up a backend.

AirGQL is the core component of Airsequel, which provides a complete solution for building web applications on top of SQLite databases.

Installation

CLI Tool

You can install the CLI app using Stack:

git clone https://github.com/Airsequel/AirGQL
cd AirGQL
make install

Library

You can also use AirGQL in your Haskell project by adding the Hackage package as a dependency to your package.yaml or your *.cabal file:

dependencies:
  - airgql
  - …

Usage

CLI App

Run following command to start a GraphQL API server for an existing SQLite database:

stack run -- serve tests/example.sqlite

Then you can query the API like this:

http POST http://localhost:4189/graphql \
  query='query {
    songs(limit: 2) {
      id
      title
    }
  }'

It also supports mutations:

http POST http://localhost:4189/graphql \
  query='mutation {
    insert_songs(objects: [{ title: "New Song" }]) {
      returning {
        id
        title
      }
    }
  }'

Check out the documentation at docs.airsequel.com/graphql-api for more details on how to use all of its GraphQL features.

Library

Check out the code in app/Main.hs file for an example of how to build a simple Servant server leveraging AirGQL.