All Projects → sysgears → domain-schema

sysgears / domain-schema

Licence: MIT License
Domain Driven Design Schema for JavaScript

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to domain-schema

thema
A CUE-based framework for portable, evolvable schema
Stars: ✭ 41 (+86.36%)
Mutual labels:  schema
bluepine
A DSL for defining API schemas/endpoints, validating, serializing and generating Open API v3
Stars: ✭ 21 (-4.55%)
Mutual labels:  schema
gql
This is a GraphQL server written in Go
Stars: ✭ 31 (+40.91%)
Mutual labels:  schema
attribute-events
🔥 Fire events on attribute changes of your Eloquent model
Stars: ✭ 198 (+800%)
Mutual labels:  domain-driven-design
craftql
A CLI tool to visualize GraphQL schemas and to output a graph data structure as a graphviz .dot format
Stars: ✭ 75 (+240.91%)
Mutual labels:  schema
game 01
Scalable MMORPG game server based on entity control
Stars: ✭ 19 (-13.64%)
Mutual labels:  domain-driven-design
linkedin-to-jsonresume
Browser extension to turn a LinkedIn profile page into a JSON Resume export.
Stars: ✭ 93 (+322.73%)
Mutual labels:  schema
graphql-tutorial
Tutorial for GraphQL
Stars: ✭ 24 (+9.09%)
Mutual labels:  schema
haskell-schema
A library for describing Haskell data types and obtain free generators, JSON codecs, pretty printers, etc.
Stars: ✭ 16 (-27.27%)
Mutual labels:  schema
ddd-net-ef-core
Self study: DDD, .net core, entity framework core
Stars: ✭ 41 (+86.36%)
Mutual labels:  domain-driven-design
flycouchdb
Migration tool for CouchDB
Stars: ✭ 20 (-9.09%)
Mutual labels:  schema
Clockwork
A roleplaying framework developed by Cloud Sixteen for the people.
Stars: ✭ 37 (+68.18%)
Mutual labels:  schema
data-models
Collection of various biomedical data models in parseable formats.
Stars: ✭ 23 (+4.55%)
Mutual labels:  schema
pathway
Define your business logic in simple steps
Stars: ✭ 45 (+104.55%)
Mutual labels:  domain-driven-design
ddd-example-ecommerce
Domain-driven design example in Java with Spring framework
Stars: ✭ 73 (+231.82%)
Mutual labels:  domain-driven-design
ddd-for-python
A domain-driven design framework for Python.
Stars: ✭ 30 (+36.36%)
Mutual labels:  domain-driven-design
ci4-album
🔥 CodeIgniter 4 example Album module uses Domain Driven Design Architecture with Tactical Pattern
Stars: ✭ 67 (+204.55%)
Mutual labels:  domain-driven-design
fefe
Validate, sanitize and transform values with proper TypeScript types and zero dependencies.
Stars: ✭ 34 (+54.55%)
Mutual labels:  schema
schemawax
🧬 Tiny typed data decoder—get to the DNA of your data
Stars: ✭ 45 (+104.55%)
Mutual labels:  schema
the schema is
ActiveRecord schema annotations done right
Stars: ✭ 44 (+100%)
Mutual labels:  schema

Domain Schema

Twitter Follow

Domain Schema is a set of packages that let you design your application using Domain Driven Design Principles. You create your schemas with any fields your application needs. Then use them as a single source of truth in the application to generate database schemas, forms, GraphQL types, etc. Domain Schema set of packages try to help you with this task, not stay on your way, by imposing minimal limitations on the shape of your domain schemas, not the fields and the meaning you can use.

Example Domain Schema using ES6 syntax:

class AuthCertificate extends Schema {
  __ = { name: 'AuthCertificate' };
  serial = {
    type: String,
    unique: true
  };
}

class AuthFacebook extends Schema {
  __ = { name: 'AuthFacebook' };
  fbId = {
    type: String,
    unique: true
  };
  displayName = {
    type: String,
    optional: true
  };
}

class UserProfile extends Schema {
  __ = { name: 'UserProfile' };
  firstName = {
    type: String,
    optional: true
  };
  lastName = {
    type: String,
    optional: true
  };
  fullName = {
    type: String,
    optional: true,
    transient: true
  };
  notes = [String];
}

class UserAuth extends Schema {
  __ = { name: 'UserAuth', transient: true };
  certificate = {
    type: AuthCertificate,
    optional: true
  };
  facebook = {
    type: AuthFacebook,
    optional: true
  };
}

export const User = new DomainSchema(
  class User extends Schema {
    __ = { name: 'User' };
    id = DomainSchema.Integer;
    username = {
      type: String,
      unique: true
    };
    email = {
      type: String,
      unique: true
    };
    password = {
      type: String,
      private: true
    };
    role = {
      type: String,
      default: 'user'
    };
    isActive = {
      type: Boolean,
      default: false,
      optional: true
    };
    auth = {
      type: [UserAuth],
      optional: true
    };
    profile = {
      type: [UserProfile],
      optional: true
    };
  }
);

Example cyclic Domain Schema definition

class Product extends Schema {
  __ = { name: 'Product' };
  id = DomainSchema.Integer;
  name = String;
  category = Category;
}

class Category extends Schema {
  __ = { name: 'Category' };
  public id = DomainSchema.Integer;
  name = String;
  products = [Product];
}

const ProductSchema = new DomainSchema(Product);

Such cyclic dependencies must be contained in one file.

Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

License

Copyright © 2017 SysGears INC. This source code is licensed under the MIT license.

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].