A bot to integrate the Hyperbeam API with Discord.
- Run
npm install
to install all dependencies
- Get your
HYPERBEAM_API_KEY
from https://hyperbeam.dev and store it in the.env
file in the project root folder. - Create a Discord application and enable a bot user for the account.
- Get your
DISCORD_CLIENT_ID
,DISCORD_CLIENT_SECRET
andDISCORD_BOT_TOKEN
from there and add it to the.env
file. - Optionally, store a server ID as
DISCORD_DEVELOPMENT_GUILD_ID
to register guild commands instead of global commands for quicker development. - Copy the
DISCORD_CLIENT_ID
value to theVITE_CLIENT_ID
env variable as well. - Define the
VITE_CLIENT_PORT
and theAPI_SERVER_PORT
for serving the frontend client and the backend server respectively. - Set the
VITE_CLIENT_URL
to the URL that the frontend client is served at. (ex:https://localhost:4000
) - Add the
VITE_CLIENT_URL
to the OAuth2 redirect URI list in your Discord application settings. - Set the
DATABASE_URL
to the relative path to the SQLite db (relative to the prisma schema file)
- Update typings with
npm run envtypes
after modifying the.env
file structure - Generate migration files with
npm run db:migrate
and commit them after changing the database schema - Lint and fix issues before committing with
npm run lint:fix
npm start
Builds and starts a PM2 instance with both the bot/API and the frontend client processesnpm run bot
Builds and starts the bot and the API servernpm run client
Builds and starts the frontend client server
npm run bot:build
Builds the bot to thedist/bot
foldernpm run client:build
Builds the frontend client to thedist/client
folder
npm run bot:dev
Launches the bot in development mode and hot-reloads on file changesnpm run client:dev
Launches the frontend client server without typecheckingnpm run lint
(orlint:fix
) Lints (and optionally fixes) code style, formatting and linting errors with the ESLint confignpm run envtypes
Generates typings from the.env
file for typedefs in code
npx prisma db push
Push current schema onto the database and generate a new clientnpx prisma generate
Generate a new database clientnpx prisma studio
Browse through database contents in your browser