Giter Club home page Giter Club logo

experimental-stuff's Introduction

Experiment

This repo demonstrate a local GraphQL layer on top of SQLite, with the capability of managing multiple data stores that are dynamically created, and can be queried/mutated dynamically with GraphQL CRUD operations.

Architecture

flowchart TB
    app_api[Application API]-->|Static GraphQL|app_db
    store_api[Store API]-->|Dynamic GraphQL|store_db

    subgraph "Application Flow"
    mobile_app[Mobile App]-->|blocks,pages,store info|app_api
    ui_comp[UI Table Component]-->|create store|app_api
    ui_comp-->|access store|store_api
    end

    subgraph "Storage"
    app_db[Local SQLite]
    store_db[...N stores]
    end

Notes

  1. The application data management is a hand-written GraphQL schema, it makes it easier to adjust to the app needs, instead of depending on a generated schema.
  2. There are multiple SQLite databases here: one for the app, and N amount of databases created per each store.
  3. The application database holds records of all pages, blocks and everything else needed for managing the data. The block of type Table is a good reference for a table that has it's own data model.
  4. The type=table datamodel is represented with a Subgraph definition, stored as part of the table block.
  5. When the app needs to interact with a specific type=table block, it asks the application API for a store object. The store object provides a dynamically created GraphQL schema and a new SQLite created for that store. This way the Subgraph is always the source of truth for the store model. This could be also useful with a simple CRUD API, to simplify the need to generate queries, it can be as simple as: getStore("store_store").entity("purpose").create({...}).
  6. Using the Subgraph definition as the source of truth gives us the following possibilites in the future:
    1. We can easily sync it remotely with other databases.
    2. We can use graphql-inspector to detect breaking changes in the data model, and have better visibility on the changes.
    3. We can reuse the definition later for more purposes.

experimental-stuff's People

Contributors

dotansimha avatar

Stargazers

Roman avatar Sadaf Amini-nia avatar

Watchers

James Cloos avatar Uri Goldshtein avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.