ExpressJS / Nodejs Quikchat Starter

This project is an example of integrating the QuikChatJS widget with a nodejs web backend. The application includes endpoints for handling both completions and streaming completions from an API like OpenAI's GPT, as well as a chat widget that can be embedded in other applications.

While expressjs is used for the example here, the same code and routes can be used with other nodejs based servers such as bun and deno.

Project Structure

project-root/
|
|-- static/
|   |-- index.html
|   |-- widget.html
|   |-- quikchat.min.css
|   |-- quikchat.umd.min.js
|
|-- .env
|-- package.json
|-- package-lock.json
|-- server.js
|-- README.md

Files and Directories

Prerequisites

Getting Started

  1. Clone the QuikChatJS Repository

    Clone the quikchatjs repository and navigate to this example project within the examples folder.

    git clone https://github.com/yourusername/quikchatjs.git
    cd quikchatjs/examples/express-chat-widget
    
  2. Install Dependencies

    Use npm to install the required dependencies.

    npm install
    
  3. Set Up Environment Variables

    Create a .env file in the root of this directory and add your OpenAI API credentials:

    OPENAI_BASE_URL=https://api.openai.com/v1
    OPENAI_API_KEY=your-api-key
    
  4. Run the Server

    Start the Express.js server:

    node server.js
    
  5. Access the Application

    Open your browser and go to http://localhost:8000 to view the chat widget.

API Endpoints