This is the backend service that coordinates the websocket connections between the client and the AI services.
- Node.js 21 or later, v21.7.1 used for development — older versions may work, but are untested
- WebSockets need to use SSL (wss://) to operate safely in production. The author recommends using letsencrypt.org
- Clone this repository to a local directory of your choice
- Navigate to the root of the project directory in the terminal emulator of your choice
- Make a copy of
.env.example
->.env.local
and update it with the required API keys - Run the
npm install
command to install the required application dependencies - Run the
npm run dev
command to set up watchers for Typescript source and the compiled server
- Generate your SSL certificate using LetsEncrypt *
- Rename
fullchain.pem
toserver.crt
- Rename
privkey.pem
toserver.key
- Place both of these files into the root of this project under
/certs/
- You may consider using a reverse proxy such as nginx, haproxy, etc.
- You may also consider a strategy for keeping the app running, such as pm2
* Skip this step if you already have a certificate, or a preferred method of generation
This application integrates several innovative third-party APIs to achieve the final result. You will need to ensure that you have made the necessary modifications to the .env
file as mentioned previously. More information below:
Livepeer provides us with a Stable Diffusion text-to-image API API built on their distributed protocol.
For this integration, we use the following environment variables:
LIVEPEER_TEXT_TO_IMAGE_ENDPOINT
LIVEPEER_BEARER_TOKEN
*LIVEPEER_SD_MODEL
LIVEPEER_SD_GUIDANCE
LIVEPEER_SD_NEGATIVE_PROMPT
LIVEPEER_SD_IMAGE_SIZE
LIVEPEER_SD_IMAGE_COUNT
* Currently not required in beta, but you should hop in the Livepeer Discord for support
We use OpenAI for their moderation and chat completion APIs. You will need an OpenAI API Key and available credits on your account.
For this integration, we use the following environment variables:
OPENAI_API_KEY
OPENAI_TOP_P
*OPENAI_TEMPERATURE
*OPENAI_FREQUENCY_PENALTY
*OPENAI_PRESENCE_PENALTY
*OPENAI_MAX_TOKENS
*OPENAI_MODEL
*
* Sensible default provided in .env.example
- Currently, the backend API lacks authentication
- Database replication via Fireproof