Setup Guide
Setup Guide
Section titled “Setup Guide”How to set up the Project 1999 Discord bot for local development or production deployment.
Prerequisites
Section titled “Prerequisites”- Node.js 20+
- npm (comes with Node.js)
- PostgreSQL 14+ with an existing database and schema
- Discord bot token with the
Guildsintent enabled - (Optional) A local MediaWiki instance for item/spell lookups
Environment Variables
Section titled “Environment Variables”Copy .env.example to .env and fill in the values:
cp .env.example .env| Variable | Description |
|---|---|
DISCORD_TOKEN | Bot token from the Discord Developer Portal |
BOT_SELF | Bot’s application (client) ID |
GUILD_ID | ID of the Discord server (guild) to register commands in |
PGHOST | PostgreSQL hostname |
PGPORT | PostgreSQL port (default: 5432) |
PGUSER | Database username |
PGPASSWORD | Database password |
POSTGRES_DB | Database name |
Database Setup
Section titled “Database Setup”- Create a PostgreSQL database.
- Run the schema from
schema.sqlto create all tables and views. - Populate reference tables (
class_definitions,races,raids, etc.) with EverQuest data.
The bot uses synchronize: false in TypeORM, so it will not create or modify tables automatically.
Local Development
Section titled “Local Development”# Install dependenciesnpm install
# Compile TypeScriptnpm run build
# Register slash commands with your guild (run once, or after adding new commands)npx esrun register_guild_commands.ts
# Start the botnpm startGenerating Documentation Locally
Section titled “Generating Documentation Locally”# Install docs dependencies (first time only)cd docs && npm install && cd ..
# Development server with hot reloadnpm run docs:dev
# Production buildnpm run docs:buildDiscord Bot Setup
Section titled “Discord Bot Setup”- Go to the Discord Developer Portal.
- Create a new application (or use an existing one).
- Under Bot, enable the Guilds intent.
- Copy the bot token to your
.envfile. - Under OAuth2 > URL Generator, select the
botandapplications.commandsscopes. - Select permissions:
Manage Roles,Send Messages,Use Slash Commands,Embed Links. - Use the generated URL to invite the bot to your server.
Production Deployment (Railway)
Section titled “Production Deployment (Railway)”The bot is deployed on Railway:
- Connect your GitHub repository to a Railway project.
- Set all environment variables in the Railway dashboard.
- Railway will build with
npm run buildand run withnpm start. - Slash commands are registered separately — run
register_guild_commands.tsfrom a local machine or a Railway one-off command.
Documentation Deployment (GitHub Pages)
Section titled “Documentation Deployment (GitHub Pages)”Documentation is automatically built and deployed via GitHub Actions on every push to main:
- Enable GitHub Pages in your repository settings.
- Set the source to GitHub Actions.
- The
.github/workflows/docs.ymlworkflow handles building and deploying.