Motivation

These are the 4 main reasons that motivated this project at Blitz

  1. We believe that, even more important than data centralization, is definition (schemas) centralization.
  2. We believe that the business logic, should be included in that definitions of centralization.
  3. We find that some top modern graph databases like typeDB and dgraph are still hard to use.
  4. The only "graph" in GraphQL is in its name 😅 and Edges in GraphQL are second class citizens.

Definitions

BlitzORM (Borm)

Blitz ORM is an ORM Object-Relational mapping for (mainly) graph databases. Blitz acts as an interface between your logic and the database to abstract their differences.

It also adds lots of layers to the databases, like auth management, data validation, pre-insertion data transformation and post-insertion data transformation.

BlitzQL (BQL)

BlitzQL is a query language, similar to graphQL but in JSON format with some enhancements. BQL is the language that Borm understands for retrieving, updating, modifying or deleting data in your databases.

Example graphQL

type Author {
	id: ID;
	name: String;
	rank: Number;
	writtenBooks: [Book];
}

type Reviewer {
	id: ID;
	name: String;
	revisedBooks: [Book];
}

type Book {
	id: ID;
	title: String;
	writtenBy: [Author] @hasInverse(field: 'writtenBooks');
	reviewedBy: [Reviewer] @hasInverse(field: 'revisedBooks');
	chapters: [Chapters] @hasInverse(field: 'inBook')
}

type Chapters @rules([deleteOnParentDeletion]) {
	id: ID;
	name: String;
	inBook: Book; @parent
	description: String
}

Equivalent BlitzORM schema

Shared data-fields

The field name is used in multiple types, so it’s a shared field

const name = {
	shared: true,
	dbConnector: {id:'db1', path:'name'}, // if not specified, uses the one configured at the entity level
	cardinality: 'one',
  // as this field is a shared one, the uniqueness is also "shared" (not even for two different types the id can be the same)
  contentType: 'text',
	validations: { required: true },
}

const id = {
	shared: true,
	dbConnector: {id:'db1', path:'id'},
	cardinality: 'one',
  // as this field is a shared one, the uniqueness is also "shared" (not even for two different types the id can be the same)
	default: { type: 'function', value: () => uuidv4() },
	contentType: 'uuid',
  validations: { required: true, unique: true },
}