All Projects → brandonbloom → Jseg

brandonbloom / Jseg

A super simple, in-memory, JS graph database.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Jseg

Graphql.js
A Simple and Isomorphic GraphQL Client for JavaScript
Stars: ✭ 2,206 (+541.28%)
Mutual labels:  graphql, relay
Awesome Relay
Awesome resources for Relay
Stars: ✭ 246 (-28.49%)
Mutual labels:  graphql, relay
Relay Workshop
Material for my Relay Workshop
Stars: ✭ 197 (-42.73%)
Mutual labels:  graphql, relay
Awesome Graphql
Awesome list of GraphQL
Stars: ✭ 13,020 (+3684.88%)
Mutual labels:  graphql, relay
Jobs
Come and join the Entria team
Stars: ✭ 292 (-15.12%)
Mutual labels:  graphql, relay
Json To Simple Graphql Schema
Transforms JSON input into a GraphQL schema
Stars: ✭ 185 (-46.22%)
Mutual labels:  graphql, json
Rescript Relay
Use Relay with ReasonML.
Stars: ✭ 214 (-37.79%)
Mutual labels:  graphql, relay
Absinthe relay
Absinthe support for the Relay framework
Stars: ✭ 143 (-58.43%)
Mutual labels:  graphql, relay
Dgraph
Native GraphQL Database with graph backend
Stars: ✭ 17,127 (+4878.78%)
Mutual labels:  graphql, graph-database
Graphik
Graphik is a Backend as a Service implemented as an identity-aware document & graph database with support for gRPC and graphQL
Stars: ✭ 277 (-19.48%)
Mutual labels:  graphql, graph-database
Reactconfbr
Public infos and issues about React Conf Brasil organization
Stars: ✭ 156 (-54.65%)
Mutual labels:  graphql, relay
Relay Modern Course
Relay Modern Course
Stars: ✭ 310 (-9.88%)
Mutual labels:  graphql, relay
Relay Authentication
An example app demonstrating role based authentication and file upload with Relay and GraphQL.
Stars: ✭ 153 (-55.52%)
Mutual labels:  graphql, relay
Autoserver
Create a full-featured REST/GraphQL API from a configuration file
Stars: ✭ 188 (-45.35%)
Mutual labels:  graphql, json
Laravel Graphql
Facebook GraphQL for Laravel 5. It supports Relay, eloquent models, validation and GraphiQL.
Stars: ✭ 1,793 (+421.22%)
Mutual labels:  graphql, relay
Django Graphql Auth
Django registration and authentication with GraphQL.
Stars: ✭ 200 (-41.86%)
Mutual labels:  graphql, relay
Framework
Strongly-typed JavaScript object with support for validation and error handling.
Stars: ✭ 136 (-60.47%)
Mutual labels:  graphql, json
Relay Rails Blog
A graphql, relay and standard rails application powered demo weblog. We are using Graphql server and relay for our react component data needs.
Stars: ✭ 140 (-59.3%)
Mutual labels:  graphql, relay
Dotnet Fake Json Server
Fake JSON Server is a Fake REST API that can be used as a Back End for prototyping or as a template for a CRUD Back End.
Stars: ✭ 265 (-22.97%)
Mutual labels:  graphql, json
Graphql Starter
💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, and Material UI.
Stars: ✭ 3,377 (+881.69%)
Mutual labels:  graphql, relay

JavaScript Entity Graph

A in-memory graph database for JavaScript data.

Overview

  • Entity/Attribute/Value graph-based information model.
    • Schema enforces relationships, provides unique indexes, and validates data.
  • Operates on plain-old JavaScript objects.
    • Hierarchical data is flattened on put and reconstituted on get.
    • Not necessarily just JSON (allows dates, etc).
  • No spooky action at a distance.
    • Every graph operation makes an implicit defensive copy.
    • Many of the benefits of immutability without loss of JavaScript idioms.

Status

This is version 2 with lots of new/improved stuff and is deployed in at least one real product. I'm not personally working on that product anymore, but this version has been pretty stable and useful there, so I don't expect much if any churn. I'm unlikely to consider major feature requests, but bug fixes are still welcome.

See the v1 readme for rationale, background, goals, etc.

Usage

This is just a taste. See docs for more details.

let jseg = require('jseg');

let [builder, types] = jseg.newSchema();

builder.entity('User');
builder.trait('Likeable');
builder.entity('Comment', types.Likeable);
builder.entity('Link', types.Likeable);

builder.finalize({

  attributes: {

    User: {
      name: types.Text,
    },

    Comment: {
      createdAt: types.Time,
      message: types.Text,
    },

    Link: {
      href: types.Key,
    },

  },

  relationships: [

    [[types.Likeable, 'many', 'likers'],
     [types.User, 'many', 'likes']],

    [[types.Comment, 'one', 'author'],
     [types.User, 'many', 'comments', {
       compare: (a, b) => Math.sign(a.createdAt - b.createdAt)
     }]],

  ],

});


let graph = new jseg.Graph(types);

graph.put({

  type: 'User',
  lid: 'user:brandonbloom',
  name: 'Brandon Bloom',

  comments: [
    {
      type: 'Comment',
      lid: 'comment-1',
      createdAt: new Date('Sat May 21 2016 12:59:48 GMT-0700 (PDT)'),
      message: 'It is kind of weird to like your own comments.',
    },
    {
      type: 'Comment',
      lid: 'comment-2',
      createdAt: new Date('Sat May 21 2016 12:59:51 GMT-0700 (PDT)'),
      message: 'This is a very important comment.',
    },
  ],

  likes: [
    {
      type: 'Link',
      lid: 'link-1',
      href: 'example.com',
    },
    {
      type: 'Comment',
      lid: 'comment-1',
    }
  ],

});

console.log(graph.get('user:brandonbloom'));

console.log(graph.get('comment-1', {depth: 3, json: true}));

console.log(graph.lookup('Link', 'href', 'example.com'));

graph.destroy('comment-2');
console.log(graph.get('comment-2'));
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].