Code Monkey home page Code Monkey logo

rel's Introduction

rel's People

Contributors

ian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rel's Issues

Custom HTTP endpoints

I suggest we have a endpoints folder where the user is able to add custom functions where GraphQL is not the answer. We might add the generated GraphQL client there for them to use it too.

Auto-generate GQL client

Let's include an auto-generated client library to be regenerated anytime the schema changes.

Options:

  • GenQL
  • Zeus
  • others?

Command not found: rel

Following the quickstart, go thru the CLI and set up the project.

โžœ  mkdir rel-playground
โžœ  cd rel-playground
โžœ  rel-playground npm init --y
Wrote to /Users/danielstarns/code/rel-playground/package.json:

{
  "name": "rel-playground",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}


โžœ  rel-playground npx rel-cmd@latest init

Need to install the following packages:
  rel-cmd@latest
Ok to proceed? (y) y

  ___     _
 | _ \___| |
 |   / -_) |
 |_|_\___|_| Installer

 Rel is the zero-config backend framework for Javascripters.

? What's the name of your project? api

โœ” Rel packages installed

? Base directory for Rel project? .


Success! Created reljs at directory /Users/danielstarns/code/rel-playground/api
Next steps:

1. Run rel dev and visit https://localhost:4000
2. Edit ./schema.graphql to update your schema.
3. Read more documentation at https://rel.run/docs

The following files are generated:

โžœ  rel-playground ls
api          package.json
โžœ  rel-playground ls api
node_modules      package.json      schema.graphql
package-lock.json rel.config.json
โžœ  rel-playground

Then when I run rel dev I get an error stating:

zsh: command not found: rel

Guards

Add in support for graphql-shield and add directives / custom guards support.

Add Neo4j support

All of our CYPHER is Neo4j compliant, so there's no reason we can't support Neo4j backends. This will likely cripple background jobs without a Redis server but that's easily to add.

@fake directive

Add a @fake directive to type definition so the user can prototype something fast. Need to investigate what library is good now that faker.js is gone

Sort by multiple fields

Currently the API supports only one field for sorting, should be a array and leveraging the enum we are generating now for aggregations.

@http directive

This will be helpful to connect to remote endpoints, or even the custom endpoints the user creates on his side, through GraphQL.

Docs

Finish documentation - in progress.

Inspiration:
CleanShot 2021-12-27 at 13 02 54@2x
CleanShot 2021-12-27 at 13 02 56@2x
CleanShot 2021-12-27 at 13 01 23@2x

CLI

At some point we want to invest in our CLI tooling.

TODO:

  • rel init or npx create-rel-app whichever feels better
  • rel dev

@constraint annotation

""" @model """
type Note {
  id: ID!
  """ @constraint(min: 10, max: 100) """
  title: String!
  description: String
  """ @constraint(default: 0) """
  likes: Int
}

This will be a central directive to add traditional DB checks like UNIQUE and DEFAULT, and also validate content if the user needs something outside graphql-scalars which we already support.
The custom validations will probably leverage fastest-validator and validator

Rethink relationships

The Graphback annotations don't make justice to the potential a graph database has. We should think about a @relation annotation suited to RedisGraph strengths.

Relationships

We support the rel directive for relationships but need to add add support for mutations:

  • create: Create and relate entries
  • connect: Connect additional existing entries by unique field
  • update: Update the connected entries
  • upsert: Create or update connected entries
  • disconnect: Disconnect connected relations by unique field
  • delete: Delete all connected entries
  • set: Override all connected entries

@stateMachine annotation

@thelinuxlich found a cool SM library that would be really easy to integrate as a Rel extension:

https://github.com/StoneCypher/jssm

What if we expose this as a directive. Consider:

type Post {
  state: String! @stateMachine('draft -> published -> archived')
}

This would produce:

type Post {
  id: ID!
  state: String!
}

type Mutation {
  nextStateMachineForPost(id: ID!): Post
  prevStateMachineForPost(id: ID!): Post
  setStateMachineForPost(id: ID!): Post
}

Auth

Migrate auth code over, use a lot of the providers from next-auth.

Computed/Calculated/Derived fields

A @lambda annotation would allow a transient and derived field available only on queries:

"""@model"""
type User {
  id: ID!
  name: String!
  lastName: String!
  """@lambda"""
  fullName: String!
}

Then Rel would scan at startup a lambda folder and use fullName.js to derive the field on queries:

// fullName.js

export default (entity) => entity.name + " " + entity.lastName

Cached counts

For example, Post has many Comments, therefore it could have a comments_count field automatically generated and maintained by Rel.

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.