Skip to content

dandv/shower-thoughts-weaviate

Repository files navigation

Weaviate Demo App - Shower thoughts

Node.js app that imports the top ~1000 shower thoughts from reddit, and displays the most amusing ones (per redditors' opinions) that match a given topic.

Live demo

https://shower-thoughts-weaviate.dandv.me/

Usage

  1. Set up the project:

    git clone https://github.com/dandv/shower-thoughts-weaviate
    cd shower-thoughts-weaviate
    npm install
    
  2. Optionally update the shower thoughts JSON file. The shower-thoughts.json from the repo is up-to-date as of 2023-July-12.

    npm run reddit  # updates shower-thoughts.json from reddit.com
    
  3. Create a Weaviate instance. This can be as simple as running the binary from the latest release, or signing up for a free Weaviate Cloud Services sandbox, or running a Docker container locally.

  4. Create a .env file in the project directory with the following keys:

    OPENAI_APIKEY=...get this from https://platform.openai.com/account/api-keys...
    # The following two keys are only necessary if you use WCS; not if using Docker
    WEAVIATE_HOST=...sign up at https://console.weaviate.cloud...
    WEAVIATE_API_KEY=...get the Admin key from Weaviate Cloud Services...
    GRAPHQL_URL=http://localhost:3000/v1/graphql
    
    • Take note of the Weaviate cluster hostname, e.g. localhost:8080 for Docker or shower-thoughts-ctv1de32.weaviate.network if using WCS. Store this in the .env file as the WEAVIATE_HOST.

    • For WCS, click on the cluster Details then the key 🔑 icon and copy the Admin key. Store it as WEAVIATE_API_KEY in the .env file.

  5. Create the Weaviate schema and import the data from the JSON file

    npm run ingest
    
  6. Launch the app server (a simple proxy necessary to protect the OpenAI key from being exposed on the client).

    npm run server
    
  7. Launch the web app

    # in a new terminal...
    npm start