Giter Site home page Giter Site logo

grand-stack / grand-stack-starter Goto Github PK

View Code? Open in Web Editor NEW
504.0 21.0 161.0 13.59 MB

Simple starter project for GRANDstack full stack apps

Home Page: https://grandstack.io/docs/getting-started-grand-stack-starter.html

License: Apache License 2.0

JavaScript 30.49% HTML 8.18% CSS 0.42% Dockerfile 0.90% TypeScript 34.07% Kotlin 0.13% Swift 0.39% Objective-C 0.04% Dart 24.75% Shell 0.56% SCSS 0.08%
graphql getting-started starter-project neo4j grandstack apollo react api

grand-stack-starter's People

Contributors

alainlep avatar arel avatar colinskow avatar dependabot[bot] avatar dworthen avatar ed42311 avatar harlandduman avatar iamflowz avatar ibell avatar jexp avatar jkhaui avatar joeflack4 avatar johnymontana avatar joshwooding avatar kirekire95 avatar kiwinode avatar ltwlf avatar mattgyverlee avatar moxious avatar muddybootscode avatar paulogdm avatar rbonthond avatar redian avatar ruslanvs avatar s2000gan avatar tmr08c avatar udaykor avatar voutilad avatar

Stargazers

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

Watchers

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

grand-stack-starter's Issues

Please add LICENSE and Copyright

Hi,

  1. Under which license are you releasing this project?
    Apache 2? Or some other one?

  2. Who owns the copyright of this code?

Thank you in advance for your reply,
Leandro

Cannot make docker-compose work with api and ui .env files settings

I tried to launch the grand-stack-starter project with Docker by following the instructions in the README file but that didn't work.

To make it work, I had to change :
"GRAPHQL_URI=http://api:4000" in api/.env file to "GRAPHQL_URI=http://api:4000"
"REACT_APP_GRAPHQL_URI=http://localhost:4000" in ui/.env file to "REACT_APP_GRAPHQL_URI=http://localhost:4000/graphql"

I think it was because the UI could not send GET or POST requests to the server.
I might have added CORS with Express to make it work. But maybe it works without it too.

GRAND stack is cool

Step 1

I took two hours to carefully read code here, the Grandstack book, docs on grandstack.io.

Step 2

I read docs on graphl-yoga and created my graphql with all the context for a couple of hours.

Step 3

I brought in my resolvers to do some basic stuff including mutations

Step 4

Finally I got a hang of the seed-db

Step 5

I got my hands dirty with firebase + firebase admin SDK with everything learnt.

Step 6

I now see GrandStack at the end of the tunnel

Unknown function 'apoc.cypher.runFirstColumn'

when i try to open http://localhost:3000 the UI shows only the message "Error".
When debugging the XHR i see the attached error message.
I seeded Neo4J with the sample data described in the README:

{
    "data": {
        "users": null
    },
    "errors": [
        {
            "message": "Unknown function 'apoc.cypher.runFirstColumn' (line 1, column 59 (offset: 58))\n\"MATCH (user:User {}) RETURN user { .id , .name ,avgStars: apoc.cypher.runFirstColumn(\"MATCH (this)-[:WROTE]->(r:Review) RETURN toFloat(avg(r.stars))\", {this: user}, false),numReviews: apoc.cypher.runFirstColumn(\"MATCH (this)-[:WROTE]->(r:Review) RETURN COUNT(r)\", {this: user}, false)} AS user SKIP 0 LIMIT 10\"\n                                                           ^",
            "locations": [],
            "path": [
                "users"
            ],
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR",
                "exception": {
                    "code": "Neo.ClientError.Statement.SyntaxError",
                    "name": "Neo4jError",
                    "stacktrace": [
                        "Neo4jError: Unknown function 'apoc.cypher.runFirstColumn' (line 1, column 59 (offset: 58))",
                        "\"MATCH (user:User {}) RETURN user { .id , .name ,avgStars: apoc.cypher.runFirstColumn(\"MATCH (this)-[:WROTE]->(r:Review) RETURN toFloat(avg(r.stars))\", {this: user}, false),numReviews: apoc.cypher.runFirstColumn(\"MATCH (this)-[:WROTE]->(r:Review) RETURN COUNT(r)\", {this: user}, false)} AS user SKIP 0 LIMIT 10\"",
                        "                                                           ^",
                        "",
                        "    at captureStacktrace (/Users/jodok/sandbox/grand-stack-starter/api/node_modules/neo4j-driver/lib/v1/result.js:199:15)",
                        "    at new Result (/Users/jodok/sandbox/grand-stack-starter/api/node_modules/neo4j-driver/lib/v1/result.js:72:19)",
                        "    at Session._run (/Users/jodok/sandbox/grand-stack-starter/api/node_modules/neo4j-driver/lib/v1/session.js:116:14)",
                        "    at Session.run (/Users/jodok/sandbox/grand-stack-starter/api/node_modules/neo4j-driver/lib/v1/session.js:95:19)",
                        "    at _callee$ (/Users/jodok/sandbox/grand-stack-starter/api/node_modules/neo4j-graphql-js/dist/index.js:69:28)",
                        "    at tryCatch (/Users/jodok/sandbox/grand-stack-starter/api/node_modules/regenerator-runtime/runtime.js:62:40)",
                        "    at Generator.invoke [as _invoke] (/Users/jodok/sandbox/grand-stack-starter/api/node_modules/regenerator-runtime/runtime.js:296:22)",
                        "    at Generator.prototype.(anonymous function) [as next] (/Users/jodok/sandbox/grand-stack-starter/api/node_modules/regenerator-runtime/runtime.js:114:21)",
                        "    at step (/Users/jodok/sandbox/grand-stack-starter/api/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)",
                        "    at /Users/jodok/sandbox/grand-stack-starter/api/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14"
                    ]
                }
            }
        }
    ]
}

Zeit Now Missing Build Property Error

When I try to deploy api project, Zeit throws an error about a missing build property.

Denniss-Mac-mini:api dennis$ now

Deploying /Applications/grand-stack-starter-master/api under denweth
Using project api
Error! Your package.json file is missing a build property inside the scripts property.
More details: https://zeit.co/docs/v2/platform/frequently-asked-questions#missing-build-script
Denniss-Mac-mini:api dennis$

Here is what is in the api package.json

{
"name": "grand-stack-starter-api",
"version": "0.0.1",
"description": "API app for GRANDstack",
"main": "src/index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "./node_modules/.bin/nodemon --exec babel-node src/index.js",
"seedDb": "./node_modules/.bin/babel-node src/seed/seed-db.js"
},
"author": "William Lyon",
"license": "MIT",
"dependencies": {
"apollo-boost": "^0.1.22",
"apollo-cache-inmemory": "^1.3.11",
"apollo-client": "^2.4.7",
"apollo-link-http": "^1.5.7",
"apollo-server": "^2.2.4",
"dotenv": "^5.0.1",
"graphql-tag": "^2.10.0",
"neo4j-driver": "^1.7.2",
"neo4j-graphql-js": "^2.1.1",
"node-fetch": "^2.3.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0",
"husky": "^1.2.0",
"lint-staged": "^8.1.0",
"nodemon": "^1.18.7"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,json,css,md,graphql": [
"prettier --write",
"git add"
]
}
}

Cant run seedDB

looks like some incompatibility in relations usage here
for example:

type Review {
  id: ID!
  user: User @relation(name: "WROTE", direction: "IN")
}

when seed tried to add relation:

 ar8:AddUserReviews(from:"u4",to:"r8"){id}

a bunch of validation errors happens

 "Unknown argument \"userid\" on field \"AddUserReviews\" of type \"Mutation\"."
"Cannot query field \"id\" on type \"_AddUserReviewsPayload\".",
 "Field \"AddUserReviews\" argument \"from\" of type \"_UserInput!\" is required but not provided.",
"Field \"AddUserReviews\" argument \"to\" of type \"_ReviewInput!\" is required but not provided.",

I inspected schema and its looks like

AddUserReviews(
from: _UserInput!
to: _ReviewInput!
): _AddUserReviewsPayload

Modular/Plugin based graphql schema

The ability to use a modular or plugin based graphql schema would help greatly with using GraphQL in extensible applications using the GRAND stack.

After the update to neo4j-graphql to 2.0 UI is broken

Here's the error:

{
   "errors":[
      {
         "message":"Cannot query field \"users\" on type \"Query\". Did you mean \"User\" or \"Business\"?",
         "locations":[
            {
               "line":2,
               "column":3
            }
         ],
         "extensions":{
            "code":"GRAPHQL_VALIDATION_FAILED",
            "exception":{
               "stacktrace":[
                  "Cannot query field \"users\" on type \"Query\". Did you mean \"User\" or \"Business\"?",
                  "",
                  "GraphQL request (2:3)",
                  "1: query usersPaginateQuery($first: Int, $offset: Int, $orderBy: _UserOrdering) {",
                  "2:   users(first: $first, offset: $offset, orderBy: $orderBy) {",
                  "     ^",
                  "3:     id",
                  "",
                  "    at Object.Field (/app/node_modules/graphql/validation/rules/FieldsOnCorrectType.js:65:31)",
                  "    at Object.enter (/app/node_modules/graphql/language/visitor.js:324:29)",
                  "    at Object.enter (/app/node_modules/graphql/language/visitor.js:366:25)",
                  "    at visit (/app/node_modules/graphql/language/visitor.js:254:26)",
                  "    at visitUsingRules (/app/node_modules/graphql/validation/validate.js:74:22)",
                  "    at Object.validate (/app/node_modules/graphql/validation/validate.js:59:10)",
                  "    at Promise.resolve.then (/app/node_modules/apollo-server-core/src/runQuery.ts:188:30)",
                  "    at process._tickCallback (internal/process/next_tick.js:68:7)"
               ]
            }
         }
      }
   ]
}

App not accessing Neo4j World Cup Database

So I do as directed, however when I fire up the graphql server and check out the schema, I get queries like Review , User etc which I suspect point to the Yelp dataset. Also the React App just renders error and the console shows the following:

[GraphQL error]: Message: The client is unauthorized due to authentication failure., Location: [object Object], Path: User

apoc.cypher.runFirstColumn

Did you help with this error?
I'm fascinated by this Nietzsche combination, a powerful technology bomb. I'm trying to upload everything to see how it works and do this project here in GRANDstack.
https://github.com/DevJoseWeb/SIMPLUS
video that I recorded with the error:
https://www.youtube.com/watch?v=QOZJZ1Rft1c&feature=youtu.be
my java project that I'm going to migrate to GRANDstack
https://www.youtube.com/watch?v=EBKLgGdJ-LA
my erro:
[GraphQL error]: Message: Failed to invoke function apoc.cypher.runFirstColumn: Caused by: java.lang.IllegalArgumentException: Can not be converted to long: org.neo4j.kernel.impl.core.NodeProxy, Location: [object Object], Path: users
service-worker.js:1 Uncaught (in promise) Error: Request for https://grand-stack-starter-ui-fycyjljinn.now.sh/index.html?_sw-precache=8f144f72c04160c31b6abb5e5553f4db returned a response with status 301
at service-worker.js:1
(anonymous) @ service-worker.js:1

Unable to build api, babel-node is not recognized

I am attempting to build the starter api, but it fails each time I attempt to use npm start

>nodemon --exec babel-node src/index.js

[nodemon] 1.18.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `babel-node src/index.js`
'babel-node' is not recognized as an internal or external command,
operable program or batch file.
[nodemon] app crashed - waiting for file changes before starting...

Note, I did run npm i beforehand. I also attempted to install babel-node directly, it failed with:

> [email protected] postinstall [project_path]\api\node_modules\babel-node
> node message.js; sleep 10; exit 1;

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module '[project_path]\api\node_modules\babel-node\message.js;'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:282:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node message.js; sleep 10; exit 1;`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I don't know if this is a problem specifically with my PC or not, but any help would be appreciated

Machine spec:

  • Fresh install of windows 10 home 1803
  • I7-8750H
  • NPMv 6.4.1
  • Node.js v10.14.2

Problem deploying with Zeit Now/Vercel

I've run into an issue with deploying to Zeit now. They updated their platform to v2 and now when I deploy I just get a set of static files on Zeit now.

grandstack with neo4j enterprise

Hi,

I'm struggling to setup a local docker environment using a neo4j enterprise image.

A local environment without docker seems to work:

  • neo4j-enterprise 4.0.0-1 running with systemctl start neo4j
  • neo4j-browser AppImage that connects to neo4j@bolt://localhost:7687
  • in /api/, run npm start, then from another pane npm run seedDb
{
  data: {
    u1: { id: 'u1', name: 'Will', __typename: 'User' },
    ...
  }
}

And I can query the data from the graphql playground.

A mixed solution with API in docker connecting to local systemd neo4j fails. That's because my API docker container's localhost is different from my host localhost, and cannot query it. Not sure how to fix it, but I'd rather not end up with this solution.

When I try to use your docker-compose.yml example with neo4j and API containers, and replace the neo4j image with enterprise (also needed to add curl that's removed from the enterprise image), I fail to start the local fleet:

files & errors

docker-compose.yml

# Lint with: docker-compose config
---
version: '3.8'  # 2020/04/28: Docker 19.03 & docker-comose 1.25.5

services:

  neo4j:
    build: ./neo4j_db
    ports:
      # use 49152~65535 range to avoid conflicts with host services
      - 57473:7473  # HTTPS
      - 57474:7474  # HTTP
      - 57687:7687  # BOLT
    environment:
      - NEO4J_dbms_security_procedures_unrestricted=apoc.*
      - NEO4J_apoc_import_file_enabled=true
      - NEO4J_apoc_export_file_enabled=true
      - NEO4J_dbms_shell_enabled=true
      - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
    #volumes:
      #- neo4j_db:/data
      #- neo4j_logs:/logs

  api:
    build: ./api_server
    ports:
      - 54001:4001
    environment:
      - NEO4J_URI=bolt://neo4j:57687
      - NEO4J_USER=neo4j
      - NEO4J_PASSWORD=custom
      - GRAPHQL_LISTEN_PORT=4001
      - GRAPHQL_URI=http://api:54001/graphql
    links:
      - neo4j
    depends_on:
      - neo4j

networks:
  default:

#volumes:
  #neo4j_db:
  #neo4j_logs:

neo4j/Dockerfile

FROM neo4j:3.5.17-enterprise

# Note: set NEO4J_USER=neo4j NEO4J_PASSWORD=custom in api_server/.env
ENV NEO4J_AUTH=neo4j/custom \
    APOC_VERSION=3.5.0.11 \
    GRAPHQL_VERSION=3.5.0.4 \
    APOC_URI=https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/${APOC_VERSION}/apoc-${APOC_VERSION}-all.jar \
    GRAPHQL_URI=https://github.com/neo4j-graphql/neo4j-graphql/releases/download/${GRAPHQL_VERSION}/neo4j-graphql-${GRAPHQL_VERSION}.jar

RUN apt update \
    && apt install -y curl \
    && sh -c 'cd /var/lib/neo4j/plugins && curl -L -O "${APOC_URI}"' \
    && sh -c 'cd /var/lib/neo4j/plugins && curl -L -O "${GRAPHQL_URI}"' \
    && apt-get -y purge --auto-remove curl

EXPOSE 7474 7473 7687

CMD ["neo4j"]

docker-compose up

Attaching to platform_v2_neo4j_1, platform_v2_api_1
api_1    |
api_1    | > [email protected] start /app
api_1    | > npm run build && node build/index.js
api_1    |
neo4j_1  | Changed password for user 'neo4j'.
api_1    |
api_1    | > [email protected] build /app
api_1    | > babel src -d build && shx cp .env build && shx cp src/schema.graphql build
api_1    |
neo4j_1  | Active database: graph.db
neo4j_1  | Directories in use:
neo4j_1  |   home:         /var/lib/neo4j
neo4j_1  |   config:       /var/lib/neo4j/conf
neo4j_1  |   logs:         /logs
neo4j_1  |   plugins:      /var/lib/neo4j/plugins
neo4j_1  |   import:       /var/lib/neo4j/import
neo4j_1  |   data:         /var/lib/neo4j/data
neo4j_1  |   certificates: /var/lib/neo4j/certificates
neo4j_1  |   run:          /var/lib/neo4j/run
neo4j_1  | Starting Neo4j.
api_1    | src/graphql-schema.js -> build/graphql-schema.js
api_1    | src/index.js -> build/index.js
api_1    | src/seed/seed-db.js -> build/seed/seed-db.js
api_1    | src/seed/seed-mutations.js -> build/seed/seed-mutations.js
api_1    | GraphQL server ready at http://localhost:4001/graphql
neo4j_1  | 2020-05-01 04:36:53.974+0000 WARN  Unknown config option: dbms.shell.enabled
neo4j_1  | 2020-05-01 04:36:53.994+0000 INFO  ======== Neo4j 3.5.17 ========
neo4j_1  | 2020-05-01 04:36:53.999+0000 INFO  Starting...
neo4j_1  | 2020-05-01 04:36:54.843+0000 INFO  Initiating metrics...
neo4j_1  | 2020-05-01 04:36:55.732+0000 ERROR Failed to start Neo4j: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@64b7225f' was successfully initialized, but failed to start. Please see the attached cause exception "Some jar procedure files are invalid, see log for details.". Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@64b7225f' was successfully initialized, but failed to start. Please see the attached cause exception "Some jar procedure files are invalid, see log for details.".
neo4j_1  | org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@64b7225f' was successfully initialized, but failed to start. Please see the attached cause exception "Some jar procedure files are invalid, see log for details.".
neo4j_1  |      at org.neo4j.server.exception.ServerStartupErrors.translateToServerStartupError(ServerStartupErrors.java:45)
neo4j_1  |      at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:187)
neo4j_1  |      at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:124)
neo4j_1  |      at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:91)
neo4j_1  |      at com.neo4j.server.enterprise.CommercialEntryPoint.main(CommercialEntryPoint.java:22)
neo4j_1  | Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.server.database.LifecycleManagingDatabase@64b7225f' was successfully initialized, but failed to start. Please see the attached cause exception "Some jar procedure files are invalid, see log for details.".
neo4j_1  |      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:473)
neo4j_1  |      at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
neo4j_1  |      at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:180)
neo4j_1  |      ... 3 more
neo4j_1  | Caused by: java.lang.RuntimeException: Error starting org.neo4j.graphdb.facade.GraphDatabaseFacadeFactory, /data/databases
neo4j_1  |      at org.neo4j.graphdb.facade.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:232)
neo4j_1  |      at com.neo4j.commercial.edition.CommercialGraphDatabase.<init>(CommercialGraphDatabase.java:20)
neo4j_1  |      at com.neo4j.server.database.CommercialGraphFactory.newGraphDatabase(CommercialGraphFactory.java:40)
neo4j_1  |      at org.neo4j.server.database.LifecycleManagingDatabase.start(LifecycleManagingDatabase.java:90)
neo4j_1  |      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:452)
neo4j_1  |      ... 5 more
neo4j_1  | Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.proc.Procedures@af9a89f' was successfully initialized, but failed to start. Please see the attached cause exception "Some jar procedure files are invalid, see log for details.".
neo4j_1  |      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:473)
neo4j_1  |      at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
neo4j_1  |      at org.neo4j.graphdb.facade.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:227)
neo4j_1  |      ... 9 more
neo4j_1  | Caused by: java.util.zip.ZipException: Some jar procedure files are invalid, see log for details.
neo4j_1  |      at org.neo4j.kernel.impl.proc.ProcedureJarLoader.loadProceduresFromDir(ProcedureJarLoader.java:76)
neo4j_1  |      at org.neo4j.kernel.impl.proc.Procedures.start(Procedures.java:323)
neo4j_1  |      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:452)
neo4j_1  |      ... 11 more
neo4j_1  | 2020-05-01 04:36:55.732+0000 INFO  Neo4j Server shutdown initiated by request
platform_v2_neo4j_1 exited with code 1

The java traceback error makes very little sense to me. I first thought it was due to file permissions when using volumes, but commenting that part didn't change the error.
Any idea how should I debug this?

Unable to use custom scalar with this starter

I'm following the documentation on custom scalars from packages and trying to add the JSON scalar to the grand-stack-starter. I am getting an error whenever I try to start the api:

Error: Type "JSON" not found in document.
    at ASTDefinitionBuilder._resolveType (/app/node_modules/graphql/utilities/buildASTSchema.js:134:11)

The only changes I made to the starter are those outlined in the docs: added a scalar JSON to the schema and a new resolver:

schema.graphql

scalar JSON

type Foo {
  aField: JSON
}

type User {
  id: ID!
  name: String
  friends: [User] @relation(name: "FRIENDS", direction: "BOTH")
  reviews: [Review] @relation(name: "WROTE", direction: "OUT")
  avgStars: Float @cypher(statement: "MATCH (this)-[:WROTE]->(r:Review) RETURN toFloat(avg(r.stars))")
  numReviews: Int @cypher(statement: "MATCH (this)-[:WROTE]->(r:Review) RETURN COUNT(r)")
}

type Business {
  id: ID!
  name: String
  address: String
  city: String
  state: String
  reviews: [Review] @relation(name: "REVIEWS", direction: "IN")
  categories: [Category] @relation(name: "IN_CATEGORY", direction: "OUT")
}

type Review {
  id: ID!
  stars: Int
  text: String
  business: Business @relation(name: "REVIEWS", direction: "OUT")
  user: User @relation(name: "WROTE", direction: "IN")
}

type Category {
  name: ID!
  businesses: [Business] @relation(name: "IN_CATEGORY", direction: "IN")
}

type Query {
    usersBySubstring(substring: String, first: Int = 10, offset: Int = 0): [User] @cypher(statement: "MATCH (u:User) WHERE u.name CONTAINS $substring RETURN u")
}

graphql-schema.js

import { neo4jgraphql } from "neo4j-graphql-js";
import GraphQLJSON from 'graphql-type-json';
import fs from "fs";
import path from "path";

export const typeDefs = fs
    .readFileSync(
        process.env.GRAPHQL_SCHEMA || path.join(__dirname, "schema.graphql")
    )
    .toString("utf-8");

export const resolvers = {
    JSON: GraphQLJSON,
    Query: {
        usersBySubstring: neo4jgraphql
    }
};

What am I doing wrong here?

Add deploy to Codesandbox

Codesandbox can host both node.js and React apps, but I'm not sure how it handles monorepos. Perhaps deploys as two separate codesandboxes?

could not add custom dateTime

Hello , i'm trying to add dateTime scalar, i followed this tuto https://www.okgrow.com/posts/using-scalar-types-to-improve-graphql-schemas , i populated my seeder with data, added a dateTime field to my type and inserted some data with created_at as dateTime but when i execute npm start i get the following error " throw new Error('Type "' + typeRef.name.value + '" not found in document.');
^

Error: Type "DateTime" not found in document."
I can't figure out what causes this error.

Connection Error (api project)

Hi
I am running a latest neo4j 4.x.x database in docker container. I can connect from neo4j browser without any issues(create, delete, fetch etc... all works) with bolt driver but not able connect to from the node js grandstack api project.
NOTE: It was working fine with the older version and I have upgraded the database and downloaded the latest API code from this repo.

ERROR #1: Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0. Caused by: connect EADDRNOTAVAIL 255.255.255.255:7687

Another issue: After default installation of the GRAND stack(out of the box) on windows OS, npm start is giving me an error as below. I had to split the commands( in windows bash (build separately then copy..) and run to make it to work (work around)

ERROR #2:
: Successfully compiled 6 files with Babel.
The system cannot find the path specified.
':' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: babel src --out-dir build && shx cp .env build 2>/dev/null || : && shx cp src/schema.graphql build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Shashikanth.r\AppData\Roaming\npm-cache_logs\2020-06-13T23_38_32_349Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: npm run build && node build/index.js "run"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Shashikanth.r\AppData\Roaming\npm-cache_logs\2020-06-13T23_38_32_427Z-debug.log

Starter UI query is incorrect.

I downloaded and started using the GRANDstack docker-compose.yml file -- thank you for such a quick start!

I ran into a problem in the UI: the initial "usersPaginateQuery" query is written incorrectly. As it is written, it encounters this HTTP 400 error at the API:

Query:

query usersPaginateQuery(
  $first: Int
  $offset: Int
  $orderBy: _UserOrdering
) {
  User(first: $first, offset: $offset, orderBy: $orderBy) {
    id
    name
    avgStars
    numReviews
  }
}

Response:

Variable \"$orderBy\" of type \"_UserOrdering\" used in position expecting type \"[_UserOrdering]\"

By adding [ and ] around "_UserOrdering" in the query, it then begins working. The correct query is:

query usersPaginateQuery(
  $first: Int
  $offset: Int
  $orderBy: [_UserOrdering]
) {
  User(first: $first, offset: $offset, orderBy: $orderBy) {
    id
    name
    avgStars
    numReviews
  }
}

[inferSchema] Use NEO4J_ENCRYPTED and NEO4J_DATABASE env vars

Currently the inferSchema.js script (which is used by npm run inferschema:write) ignores the NEO4J_ENCRYPTED environment variable and just defaults to unencrypted:

https://github.com/grand-stack/grand-stack-starter/blob/master/scripts/inferSchema.js#L9

Take into account the encryption flag and the NEO4J_DATABASE env var when running this script

As a workaround --encrypted can be manually appended to the call to the grandstack cli if encrypted connection is needed, for example:

node_modules/.bin/grandstack graphql inferschema --neo4j-uri neo4j://07de346a.databases.neo4j.io --neo4j-user summit --neo4j-password summit --schema-file ./api/src/schema.graphql --encrypted

Example using authentication in GRANDstack??

I am trying to set up Authentication in my GrandStack starter. I have scoured the docs and graphql-auth-directives readme but I still can not set up authentication correctly. Is there a FULL working example using authentication in grandstack anywhere?? This would be SOOOO helpful. In the docs there are several different solutions mentioned but I have no idea how to set any of them up correctly. Any example of a fully working using authentication (signup/login) would go a long way.

sorting with aliases

I used an alias in my graphql query but all the react queries failed
because the sorting has to contain the original name not the alias.
Not sure if that's an issue with react passing the order by as a parameter, I think rather that neo4j-graphql-js should take the alias into account.

const GET_USER = gql`
  query usersPaginateQuery(
    $first: Int
    $offset: Int
    $orderBy: [_UserOrdering]
    $filter: _UserFilter
  ) {
    User(first: $first, offset: $offset, orderBy: $orderBy, filter: $filter) {
      id
      name: display_name
      reputation
    }
  }
`

changes I had to make (from "name" to display_name

function UserList(props) {
  const { classes } = props
  const [order, setOrder] = React.useState('asc')
  const [orderBy, setOrderBy] = React.useState('display_name') // <- here
              <TableCell
                key="name"
                sortDirection={orderBy === 'name' ? order : false}
              >
                <Tooltip title="Sort" placement="bottom-start" enterDelay={300}>
                  <TableSortLabel
                    active={orderBy === 'name'}
                    direction={order}
                    onClick={() => handleSortRequest('display_name')} <!-- here -->
                  >
                    Name
                  </TableSortLabel>
                </Tooltip>
              </TableCell>

this makes it kinda inconsistent and hard to reason about.

##Also Error Handling

When the errors occurred I only saw Error in the UI, no error message, not even in chrome debug tools

I had to run the query with the params from the react app manually against the graphql api to see the error message

it was also no error output in the terminal of api or web-react, even as it was running in dev-mode.

Bildschirmfoto 2020-05-27 um 12 20 23

And no "errors" response data, but an HTTP 400

Bildschirmfoto 2020-05-27 um 12 34 22

add an inferSchema npm tasks to the API

the default schema will not be compatible with existing databases
(should probably check that, or that the db is empty)

an npm run inferSchema that updates the schema file would be good

Graph Manager - Unknown directive "cypher"

While following the Apollo basics tutorial, I tried to run

$ npx apollo service:push --graph=neo4j --key=user:<user>:<hash> --localSchemaFile=src/schema.graphql

from my repo created by following grand-stack-starter.

It fails with the following error:

Is it not possible to use the Apollo Graph Manager with a GRANDstack? Or could you explain how to configure the graph manager with these neo4j-graphql specific directives?

Multiple datasources

First off, thanks for this project! I had taken a few tutorials and mashed them together and had a somewhat working Neo4j backed GraphQL API running. However, this project has closed a lot of missing parts.

Is there any guidance on how to add additional data sources?

I can't seem to figure out how to have makeAugmentedSchema work with other sources.

The api is not working

I downloaded the latest repo and have been unable to get localhost:4000 to resolve. This should start the GraphQL API in the foreground. Instead, the error is 'Unable to connect'. After reviewing the git page, it appears work was done on ui (last update was 8 days ago). However, the api has not been updated for 2 months.

Under the Docker Compose section of the README the instructions says to make changes to the api/.env. Does that still apply after the latest commit?

Incorrect port setup in UI .env file

Just tried the docker-compose route for spinning up the master branch, which fails out of the box just now because .env is pointing to localhost:4001 instead of localhost:4000. Was committed in April, am assuming it relates to work in progress or something?

Changing back to localhost:4000 gives you a working app.

Graphql variables in nested types

Got error while playing with graphql API in worldcup branch.

Error :
{
  "data": {
    "worldcups": null
  },
  "errors": [
    {
      "message": "Cannot read property 'replace' of undefined",
      "locations": [],
      "path": [
        "worldcups"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "errors": [
            {
              "message": "Cannot read property 'replace' of undefined",
              "locations": [],
              "path": [
                "worldcups"
              ]
            }
          ],
          "stacktrace": [
            "Error: Cannot read property 'replace' of undefined",
            "    at new CombinedError (/home/nowuser/src/node_modules/graphql-tools/src/stitching/errors.ts:85:5)",
            "    at Object.checkResultAndHandleErrors (/home/nowuser/src/node_modules/graphql-tools/src/stitching/errors.ts:107:11)",
            "    at CheckResultAndHandleErrors.transformResult (/home/nowuser/src/node_modules/graphql-tools/src/transforms/CheckResultAndHandleErrors.ts:15:12)",
            "    at /home/nowuser/src/node_modules/graphql-tools/src/transforms/transforms.ts:37:45",
            "    at Array.reduce (<anonymous>)",
            "    at applyResultTransforms (/home/nowuser/src/node_modules/graphql-tools/src/transforms/transforms.ts:35:21)",
            "    at /home/nowuser/src/node_modules/graphql-tools/src/stitching/delegateToSchema.ts:81:12",
            "    at step (/home/nowuser/src/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:32:23)",
            "    at Object.next (/home/nowuser/src/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:13:53)",
            "    at fulfilled (/home/nowuser/src/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:4:58)"
          ]
        }
      }
    }
  ]
}

while running following query :

query Matches($year: Int!, $round: String) {
  worldcups(year: $year) {
    name 
    matches(round: $round) {
      round
      description
      homeScore
      awayScore
    }
  }
}

with variables :

{
  "year": 2018,
  "round": "Group matches - Group C"
}

"docker-compose up" fails to start.

Starting the grand-stack-starter via docker-compose up fails to start the react app with the following error:

ui_1     | 
ui_1     | > [email protected] start /app
ui_1     | > react-scripts start
ui_1     | 
ui_1     | [HPM] Proxy created: /  -> http://api:4001/graphql
ui_1     | ℹ 「wds」: Project is running at http://172.20.0.4/
ui_1     | ℹ 「wds」: webpack output is served from 
ui_1     | ℹ 「wds」: Content not from webpack is served from /app/public
ui_1     | ℹ 「wds」: 404s will fallback to /
ui_1     | Starting the development server...
ui_1     | 
grand-stack-starter_ui_1 exited with code 0

I believe this has to do with running the create-react-app development server without an interactive shell. For instance, setting:

    stdin_open: true
    tty: true

in the docker-compose.yml file works. Based on the discussion here: facebook/create-react-app#8688 it appears that the preferred solution is to set the environment variable CI=true to tell react-scripts to not expect an interactive session.

Error: Failed to connect to server in WSL

App and Neo4j sandbox are running condition
npm run seedDb cause following error on WSL:

Error: Error: GraphQL error: Failed to connect to server. Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0. Caused by: Server certificate is not trusted. If you trust the database you are connecting to, use TRUST_CUSTOM_CA_SIGNED_CERTIFICATES and add the signing certificate, or the server certificate, to the list of certificates trusted by this driver using `neo4j.driver(.., { trustedCertificates:['path/to/certificate.crt']}). This  is a security measure to protect against man-in-the-middle attacks. If you are just trying  Neo4j out and are not concerned about encryption, simply disable it using `encrypted="ENCRYPTION_OFF"` in the driver options. Socket responded with: DEPTH_ZERO_SELF_SIGNED_CERT
GraphQL error: Failed to connect to server. Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0. Caused by: Server certificate is not trusted. If you trust the database you are connecting to, use TRUST_CUSTOM_CA_SIGNED_CERTIFICATES and add the signing certificate, or the server certificate, to the list of certificates trusted by this driver using `neo4j.driver(.., { trustedCertificates:['path/to/certificate.crt']}). This  is a security measure to protect against man-in-the-middle attacks. If you are just trying  Neo4j out and are not concerned about encryption, simply disable it using `encrypted="ENCRYPTION_OFF"` in the driver options. Socket responded with: DEPTH_ZERO_SELF_SIGNED_CERT
GraphQL error: Failed to connect to server. Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0. Caused by: Server certificate is not trusted. If you trust the database you are connecting to, use TRUST_CUSTOM_CA_SIGNED_CERTIFICATES and add the signing certificate, or the server certificate, to the list of certificates trusted by this driver using `neo4j.driver(.., { trustedCertificates:['path/to/certificate.crt']}). This  is a security measure to protect against man-in-the-middle attacks. If you are just trying  Neo4j out and are not concerned about encryption, simply disable it using `encrypted="ENCRYPTION_OFF"` in the driver options. Socket responded with: DEPTH_ZERO_SELF_SIGNED_CERT
GraphQL error: Failed to connect to server. Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0. Caused by: Server certificate is not trusted. If you trust the database you are connecting to, use TRUST_CUSTOM_CA_SIGNED_CERTIFICATES and add the signing certificate, or the server certificate, to the list of certificates trusted by this driver using `neo4j.driver(.., { trustedCertificates:['path/to/certificate.crt']}). This  is a security measure to protect against man-in-the-middle attacks. If you are just trying  Neo4j out and are not concerned about encryption, simply disable it using `encrypted="ENCRYPTION_OFF"` in the driver options. Socket responded with: DEPTH_ZERO_SELF_SIGNED_CERT
GraphQL error: Failed to connect to server. Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0. Caused by: Server certificate is not trusted. If you trust the database you are connecting to, use TRUST_CUSTOM_CA_SIGNED_CERTIFICATES and add the signing certificate, or the server certificate, to the list of certificates trusted by this driver using `neo4j.driver(.., { trustedCertificates:['path/to/certificate.crt']}). This  is a security measure to protect against man-in-the-middle attacks. If you are just trying  Neo4j out and are not concerned about encryption, simply disable it using `encrypted="ENCRYPTION_OFF"` in the driver options. Socket responded with: DEPTH_ZERO_SELF_SIGNED_CERT
GraphQL error: Failed to connect to server. Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0. Caused by: Server certificate is not trusted. If you trust the database you are connecting to, use TRUST_CUSTOM_CA_SIGNED_CERTIFICATES and add the signing certificate, or the server certificate, to the list of certificates trusted by this driver using `neo4j.driver(.., { trustedCertificates:['path/to/certificate.crt']}). This  is a security measure to protect against man-in-the-middle attacks. If you are just trying  Neo4j out and are not concerned about encryption, simply disable it using `encrypted="ENCRYPTION_OFF"` in the driver options. Socket responded with: DEPTH_ZERO_SELF_SIGNED_CERT

Verify angular client

The GraphQL schema was updated slightly - ensure the Angular client works with the updated schema.

Cannot depoy with zeit now.

Cannot depoy grandstack starter with zeit now. These are logs:

2019-12-19T16:31:25.150Z cp: cannot stat ‘.env’: No such file or directory
2019-12-19T16:31:25.160Z Error: No output directory named "public" found.
2019-12-19T16:31:25.160Z More details: https://zeit.co/docs/v2/platform/frequently-asked-questions#missing-public-directory
2019-12-19T16:31:25.160Z at validateDistDir (/zeit/f51a0a4251865668/.build-utils/.builder/node_modules/@now/static-build/dist/index.js:329:15)
2019-12-19T16:31:25.160Z at Object.build (/zeit/f51a0a4251865668/.build-utils/.builder/node_modules/@now/static-build/dist/index.js:533:13)
2019-12-19T16:31:25.160Z at
2019-12-19T16:31:25.160Z at process._tickDomainCallback (internal/process/next_tick.js:228:7)

I tried adding "--output public" to "build", but it didn't help.

Windows failure for npm start

From Vincent:

For anyone on Windows: NPM run start will fail due to " DEBUG=neo4j-graphql-js " in /api/package.json
Use something like: "start:dev": "SET DEBUG=neo4j-graphql-js && nodemon --watch src --ext js,graphql --exec babel-node  src/index.js"

[Solved] npm start fails on Win 10

Installation of requirements works,
however, start fails on Windows 10:

Looks like a unix -like environment with cp is assumed. Any idea what to fix and how?

cp doesn't exist. build; doesn't exist. build doesn't exist
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `babel src -d build; cp .env build; cp src/schema.graphql build`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\marvi\AppData\Roaming\npm-cache\_logs\2019-10-23T17_33_35_021Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] start: `npm run build && node build/index.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

dependencies require manual install

npm WARN [email protected] requires a peer of [email protected] - 0.13.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 0.13.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.11.3 || ^0.12.3 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 0.13.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 0.13.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.13.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 0.13.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.

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.