Giter Club home page Giter Club logo

willow-grandstack's Introduction

Deploy to Netlify Deploy to Vercel Provision Neo4j

Willow: A real estate search application built using GRANDstack

Willow

A real estate search application built using GRANDstack: GraphQL, React, Apollo, and Neo4j Database while being livestreamed! Check out the YouTube Playlist to catch up on all the videos or select from the list below:

Functionality

Search View

Search view

Dashboard View

Dashboard view

Architecture

Architecture diagram

Data Model

Arrows markup

Markup for defining data model using the Arrows graph diagraming tool

<ul
  class="graph-diagram-markup"
  data-internal-scale="1"
  data-external-scale="1"
>
  <li
    class="node"
    data-node-id="0"
    data-x="-1713.637451171875"
    data-y="317.54315185546875"
  >
    <span class="caption">User</span>
    <dl class="properties">
      <dt>id</dt>
      <dd>String</dd>
      <dt>name</dt>
      <dd>String</dd>
    </dl>
  </li>
  <li
    class="node"
    data-node-id="1"
    data-x="-729.3491363525391"
    data-y="1243.0390625"
  >
    <span class="caption">Listing</span>
    <dl class="properties">
      <dt>createdAt</dt>
      <dd>DateTime</dd>
      <dt>listingId</dt>
      <dd>String</dd>
      <dt>askingPrice</dt>
      <dd>Int</dd>
      <dt>bedRooms</dt>
      <dd>Int</dd>
      <dt>bathRooms</dt>
      <dd>Int</dd>
      <dt>squareFootage</dt>
      <dd>Int</dd>
    </dl>
  </li>
  <li
    class="node"
    data-node-id="2"
    data-x="1083.0440673828125"
    data-y="-459.44090270996094"
  >
    <span class="caption">City</span>
    <dl class="properties">
      <dt>name</dt>
      <dd>String</dd>
    </dl>
  </li>
  <li
    class="node"
    data-node-id="3"
    data-x="28.259565114974976"
    data-y="458.7174263000488"
  >
    <span class="caption">Property</span>
    <dl class="properties">
      <dt>id</dt>
      <dd>String</dd>
      <dt>address</dt>
      <dd>String</dd>
      <dt>location</dt>
      <dd>Point</dd>
      <dt>bounds</dt>
      <dd>[Point]</dd>
    </dl>
  </li>
  <li
    class="node"
    data-node-id="4"
    data-x="1409.7587890625"
    data-y="554.8055877685547"
  >
    <span class="caption">Listing</span>
    <dl class="properties">
      <dt>createdAt</dt>
      <dd>DateTime</dd>
      <dt>active</dt>
      <dd>Bool</dd>
      <dt>askingPrice</dt>
      <dd>Int</dd>
    </dl>
  </li>
  <li
    class="node"
    data-node-id="5"
    data-x="252.71633911132812"
    data-y="-393.4471435546875"
  >
    <span class="caption">Neighborhood</span>
    <dl class="properties">
      <dt>name</dt>
      <dd>String</dd>
    </dl>
  </li>
  <li
    class="node"
    data-node-id="6"
    data-x="-729.3491363525391"
    data-y="-348.6604309082031"
  >
    <span class="caption">Subdivision</span>
    <dl class="properties">
      <dt>name</dt>
      <dd>String</dd>
    </dl>
  </li>
  <li
    class="node"
    data-node-id="7"
    data-x="682.1227416992188"
    data-y="1032.9970703125"
  >
    <span class="caption">Appraisal</span>
    <dl class="properties">
      <dt>property_id</dt>
      <dd>String,</dd>
      <dt>year</dt>
      <dd>Int,</dd>
      <dt>land</dt>
      <dd>Int,</dd>
      <dt>building</dt>
      <dd>Int,</dd>
      <dt>total</dt>
      <dd>Int,</dd>
      <dt>method</dt>
      <dd>String</dd>
    </dl>
  </li>
  <li
    class="node"
    data-node-id="8"
    data-x="28.259565114974976"
    data-y="1112.759033203125"
  >
    <span class="caption">Appraisal</span>
    <dl class="properties">
      <dt>property_id</dt>
      <dd>String,</dd>
      <dt>year</dt>
      <dd>Int,</dd>
      <dt>land</dt>
      <dd>Int,</dd>
      <dt>building</dt>
      <dd>Int,</dd>
      <dt>total</dt>
      <dd>Int,</dd>
      <dt>method</dt>
      <dd>String</dd>
    </dl>
  </li>
  <li class="relationship" data-from="0" data-to="1">
    <span class="type">SAVED</span>
    <dl class="properties">
      <dt>createdAt</dt>
      <dd>DateTime</dd>
    </dl>
  </li>
  <li class="relationship" data-from="1" data-to="3">
    <span class="type">OF</span>
  </li>
  <li class="relationship" data-from="4" data-to="3">
    <span class="type">OF</span>
  </li>
  <li class="relationship" data-from="3" data-to="2">
    <span class="type">IN_CITY</span>
  </li>
  <li class="relationship" data-from="3" data-to="5">
    <span class="type">:IN_NEIGHBORHOOD</span>
  </li>
  <li class="relationship" data-from="3" data-to="6">
    <span class="type">:IN_SUBDIVISION</span>
  </li>
  <li class="relationship" data-from="3" data-to="7">
    <span class="type">HAS_APPRAISAL</span>
  </li>
  <li class="relationship" data-from="3" data-to="8">
    <span class="type">HAS_APPRAISAL</span>
  </li>
</ul>

Graph data model

Requirements

  • As a user I want to search for properties for sale by city so that I can view property details.
MATCH (l:Listing)-[:OF]-(p:Property)-[:IN]->(c:City)
WHERE c.name = "San Mateo"
  • As a user I want to limit my search to properties with certain attributes or range of attributes so that I can narrow the results to those relevant to me.
  • As a user searching for properties I want to view property details so I can learn more about the listing.

GRANDstack Starter

This project was created using the GRANDstack Starter.

npx create-grandstack-app myNewApp

This project is a starter for building a GRANDstack (GraphQL, React, Apollo, Neo4j Database) application. There are two components to the starter, the web frontend application (in React and Angular flavors) and the API app (GraphQL server).

Hands On With The GRANDstack Starter

Hands On With The GRANDstack Starter Video

Quickstart

The easiest way to get started with the GRANDstack Starter is to create a Neo4j Sandbox instance and use the create-grandstack-app command line tool.

1. Create A Neo4j Sandbox Instance

Neo4j Sandbox allows you to create a free hosted Neo4j instance private to you that can be used for development.

After singing in to Neo4j Sandbox, click the + New Project button and select the "Blank Sandbox" option. In the next step we'll use the connection credentials from the "Connection details" tab to connect our GraphQL API to this Neo4j instance.

Neo4j Sandbox connection details

2. Run the create-grandstack-app CLI

npx create-grandstack-app myNewApp

or with Yarn

yarn create grandstack-app myNewApp

create grandstack app output

This will create a new directory myNewApp, download the latest release of the GRANDstack Starter, install dependencies and prompt for your connection credentials for Neo4j to connect to the GraphQL API.

3. Seed the database (optional)

Once the application is running, in another terminal run

npm run seedDb

or with Yarn

yarn run seedDb

4. Open In Browser

Grandstack app running in browser

Overview

The GRANDstack Starter is a monorepo that includes a GraphQL API application and client web applications for React (default) and Angular.

/ - Project Root

The root directory contains some global configuration and scripts:

  • npm run start and npm run build
  • ESLint (.eslintrc.json) for code linting
  • Prettier (.prettierrc.json) for code formatting
  • Git hooks for applying formatting on commit

This directory contains the GraphQL API application using Apollo Server and neo4j-graphql.js.

  • Change environment variable settings in .env:
# Use this file to set environment variables with credentials and configuration options
# This file is provided as an example and should be replaced with your own values
# You probably don't want to check this into version control!

NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=letmein

# Uncomment this line to enable encrypted driver connection for Neo4j
#NEO4J_ENCRYPTED=true

# Uncomment this line to specify a specific Neo4j database (v4.x+ only)
#NEO4J_DATABASE=neo4j

GRAPHQL_SERVER_HOST=0.0.0.0
GRAPHQL_SERVER_PORT=4001
GRAPHQL_SERVER_PATH=/graphql

The frontend React web application is found in this directory.

It includes:

  • Material UI
  • React router
  • Apollo Client / React Hooks
  • Create React App

A UI built with Angular, Apollo and the Clarity Design System is also available.

Start the Angular UI server

cd ./web-angular && npm start

See the project releases for the changelog.

Deployment

Netlify

This monorepo can be deployed to Netlify. The frontend application will be served over Netlify's CDN and the GraphQL API will be provisioned as a serverless GraphQL API lambda function deployed to AWS (via Netlify). A netlify.toml file is included with the necessary build configurations. The following environment variables must be set in Netlify (either via the Netlify web UI or via the command line tool)

NEO4J_URI
NEO4J_USER
NEO4J_PASSWORD

See the "Hands On With The GRANDStack Starter" video linked at the beginning of this README for a walkthrough of deploying to Netlify.

Vercel / Zeit Now

Zeit Now v2 can be used with monorepos such as grand-stack-starter. now.json defines the configuration for deploying with Zeit Now v2.

  1. Set the now secrets for your Neo4j instance:
now secret add grand_stack_starter_neo4j_uri bolt://<YOUR_NEO4J_INSTANCE_HERE>
now secret add grand_stack_starter_neo4j_user <YOUR_DATABASE_USERNAME_HERE>
now secret add grand_stack_starter_neo4j_password <YOUR_DATABASE_USER_PASSWORD_HERE>
  1. Run now

Docker Compose

You can quickly start via:

docker-compose up -d

If you want to load the example DB after the services have been started:

docker-compose run api npm run seedDb

You can find instructions for other ways to use Neo4j (Neo4j Desktop, Neo4j Aura, and other cloud services) in the Neo4j directory README.

This project is licensed under the Apache License v2. Copyright (c) 2020 Neo4j, Inc.

willow-grandstack's People

Contributors

johnymontana 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

willow-grandstack's Issues

inferschema:write

I'm following YouTUbe playlist part 2, after running inferschema:write, I'm not able to access GraphQL playground via http://localhost:4001/graphql with below error:

start
node scripts/start-dev.js

12:14:29 React |
12:14:29 React | > [email protected] start
12:14:29 React | > react-scripts start
12:14:29 React |
12:14:29 api |
12:14:29 api | > [email protected] start:dev
12:14:29 api | > ./node_modules/.bin/nodemon --watch src --ext js,graphql --exec babel-node src/index.js
12:14:29 api |
12:14:30 api | [nodemon] 1.19.4
12:14:30 api | [nodemon] to restart at any time, enter rs
12:14:30 api | [nodemon] watching dir(s): src/**/*
12:14:30 api | [nodemon] watching extensions: js,graphql
12:14:30 api | [nodemon] starting babel-node src/index.js
12:14:32 api | /Users/kincheonglau/Sites/pillow-grandstack/api/node_modules/graphql-compose/lib/TypeStorage.js:44
12:14:32 api | throw new Error(Type with name ${(0, _misc.inspect)(typeName)} does not exists);
12:14:32 api | ^
12:14:32 api |
12:14:32 api | Error: Type with name "Long" does not exists
12:14:32 api | at SchemaComposer.get (/Users/kincheonglau/Sites/pillow-grandstack/api/node_modules/graphql-compose/lib/TypeStorage.js:44:13)
12:14:32 api | at ThunkComposer._thunk (/Users/kincheonglau/Sites/pillow-grandstack/api/node_modules/graphql-compose/lib/TypeMapper.js:585:34)
12:14:32 api | at ThunkComposer.get ofType [as ofType] (/Users/kincheonglau/Sites/pillow-grandstack/api/node_modules/graphql-compose/lib/ThunkComposer.js:20:34)
12:14:32 api | at NonNullComposer.getUnwrappedTC (/Users/kincheonglau/Sites/pillow-grandstack/api/node_modules/graphql-compose/lib/NonNullComposer.js:38:15)
12:14:32 api | at unwrapTC (/Users/kincheonglau/Sites/pillow-grandstack/api/node_modules/graphql-compose/lib/utils/typeHelpers.js:208:31)
12:14:32 api | at unwrapOutputTC (/Users/kincheonglau/Sites/pillow-grandstack/api/node_modules/graphql-compose/lib/utils/typeHelpers.js:220:10)
12:14:32 api | at ObjectTypeComposer.getFieldTC (/Users/kincheonglau/Sites/pillow-grandstack/api/node_modules/graphql-compose/lib/ObjectTypeComposer.js:380:44)
12:14:32 api | at /Users/kincheonglau/Sites/pillow-grandstack/api/node_modules/graphql-compose/lib/ObjectTypeComposer.js:1460:23
12:14:32 api | at Array.forEach ()
12:14:32 api | at ObjectTypeComposer.getNestedTCs (/Users/kincheonglau/Sites/pillow-grandstack/api/node_modules/graphql-compose/lib/ObjectTypeComposer.js:1459:26)
12:14:32 api | [nodemon] app crashed - waiting for file changes before starting...
12:14:33 React | [HPM] Proxy created: / -> http://localhost:4001/graphql
12:14:33 React | ℹ 「wds」: Project is running at http://192.168.1.15/
12:14:33 React | ℹ 「wds」: webpack output is served from
12:14:33 React | ℹ 「wds」: Content not from webpack is served from /Users/kincheonglau/Sites/pillow-grandstack/web-react/public
12:14:33 React | ℹ 「wds」: 404s will fallback to /
12:14:33 React | Starting the development server...
12:14:33 React |
12:14:35 React | Browserslist: caniuse-lite is outdated. Please run:
12:14:35 React | npx browserslist@latest --update-db
12:14:35 React |
12:14:35 React | Why you should do it regularly:
12:14:35 React | https://github.com/browserslist/browserslist#browsers-data-updating
12:14:54 React | Compiled successfully!
12:14:54 React |
12:14:54 React | You can now view grand-stack-starter-web-react in the browser.
12:14:54 React |
12:14:54 React | Local: http://localhost:3000
12:14:54 React | On Your Network: http://192.168.1.15:3000
12:14:54 React |
12:14:54 React | Note that the development build is not optimized.
12:14:54 React | To create a production build, use npm run build.
12:14:54 React |
12:14:55 React | [HPM] Error occurred while trying to proxy request /graphql from localhost:3000 to http://localhost:4001/graphql (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
12:14:55 React | [HPM] Error occurred while trying to proxy request /graphql from localhost:3000 to http://localhost:4001/graphql (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
12:14:55 React | [HPM] Error occurred while trying to proxy request /graphql from localhost:3000 to http://localhost:4001/graphql (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)

Modifiers on graphQL interface not working

Hello,

I've had some issues following the tutorial I wanted to make you aware of including the solutions that I found. I still have an issue with the graphQL interface not accepting the options and modifiers such as "first: 10", filter, etc.

To show I am able to fetch data:
image

but if I try a filter:
image

full code of error:
{
"error": {
"errors": [
{
"message": "Unknown argument "first" on field "Query.properties".",
"locations": [
{
"line": 2,
"column": 14
}
],
"extensions": {
"code": "GRAPHQL_VALIDATION_FAILED",
"exception": {
"stacktrace": [
"GraphQLError: Unknown argument "first" on field "Query.properties".",
" at Object.Argument (C:\Users\boter\code\willow\node_modules\graphql\validation\rules\KnownArgumentNamesRule.js:46:29)",
" at Object.enter (C:\Users\boter\code\willow\node_modules\graphql\language\visitor.js:323:29)",
" at Object.enter (C:\Users\boter\code\willow\node_modules\graphql\utilities\TypeInfo.js:370:25)",
" at visit (C:\Users\boter\code\willow\node_modules\graphql\language\visitor.js:243:26)",
" at Object.validate (C:\Users\boter\code\willow\node_modules\graphql\validation\validate.js:69:24)",
" at validate (C:\Users\boter\code\willow\api\node_modules\apollo-server-core\src\requestPipeline.ts:536:14)",
" at Object. (C:\Users\boter\code\willow\api\node_modules\apollo-server-core\src\requestPipeline.ts:302:32)",
" at Generator.next ()",
" at fulfilled (C:\Users\boter\code\willow\api\node_modules\apollo-server-core\dist\requestPipeline.js:5:58)",
" at processTicksAndRejections (internal/process/task_queues.js:97:5)"
]
}
}
}
]
}
}

Another issue I encounter but I managed to fix (just for your reference):
The error:
if I create a db version 3.5.18, graphQL throws an error saying that the db does not support multiple dbs and for some reason it just does not work.

The fix:
I upgraded to the latest version (4.3.2 at this time) and named the db "neo4j"

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.