No database server required — the bot uses a local SQLite file and pulls all match data live from FACEIT.
| Requirement | Version | Notes |
|---|---|---|
| Node.js | 22+ | Download from nodejs.org |
| npm | bundled with Node | |
| Discord application | — | See Part 1 below |
| FACEIT API key | — | Required from Phase 2 onwards |
The bot stores account links and quotes in a local SQLite file (data.db). No PostgreSQL, no Docker, no separate process to manage.
Go to the Discord Developer Portal, click New Application, and give it a name.
Under the Bot tab, click Add Bot. Copy the bot token — you'll need it as DISCORD_TOKEN. Never share this token.
Under General Information, copy the Application ID. This is your DISCORD_CLIENT_ID.
Build an OAuth2 URL (replace YOUR_CLIENT_ID). Select your server and authorise — this grants the bot and applications.commands scopes.
https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=277025770496&scope=bot+applications.commands
In Discord, enable Developer Mode (User Settings → Advanced). Right-click your server icon → Copy Server ID. This is your DISCORD_GUILD_ID.
Go to developers.faceit.com and sign in with your FACEIT account.
Create a new application. Under API Keys, generate a Server-Side key. Copy it as FACEIT_API_KEY.
Never expose your FACEIT API key in client-side code or commit it to version control.
git clone https://github.com/Easton99/Insomniacs-bot.git cd Insomniacs-bot
npm install
Copy the example file and fill in DISCORD_TOKEN, DISCORD_CLIENT_ID, DISCORD_GUILD_ID, and FACEIT_API_KEY:
cp .env.example .env
Creates the local SQLite file and applies the schema — one command, done:
npm run prisma:migrate
npm run commands:register
npm run dev
Uses tsx --watch — the bot restarts automatically when you save a source file.
For running on a server 24/7. Docker is not required for development.
.envThe Compose file overrides DATABASE_URL to store the SQLite file in a named volume (bot_data) so it persists across container rebuilds.
docker compose up -d
docker compose exec bot npm run prisma:migrate
docker compose logs -f bot
| Variable | Required | Default | Description |
|---|---|---|---|
| DISCORD_TOKEN | ✓ | — | Bot token from Discord Developer Portal |
| DISCORD_CLIENT_ID | ✓ | — | Application ID from Discord Developer Portal |
| DISCORD_GUILD_ID | ✓ | — | ID of the Discord server to register commands to |
| FACEIT_API_KEY | Phase 2+ | — | Server-side FACEIT Data API key |
| DATABASE_URL | file:./data.db | SQLite file path — change if you want the db somewhere else | |
| BOT_TIMEZONE | Europe/London | Timezone for session grouping and the "Go To Bed" achievement | |
| CHEMISTRY_MIN_MATCHES | 10 | Minimum shared matches before labelling a "best" or "worst" teammate | |
| NODE_ENV | development | development or production |
|
| LOG_LEVEL | info | Logging level: trace debug info warn error |
| Script | Description |
|---|---|
| npm run dev | Start in development mode with hot reload (tsx --watch) |
| npm run build | Compile TypeScript to dist/ |
| npm start | Run compiled bot from dist/index.js |
| npm run lint | Run ESLint over src/ |
| npm test | Run Vitest test suite |
| npm run commands:register | Register slash commands to DISCORD_GUILD_ID |
| npm run prisma:migrate | Apply pending schema changes (creates data.db on first run) |
| npm run prisma:generate | Re-generate the Prisma client after schema changes |
| npm run prisma:studio | Open Prisma Studio (visual database browser) |
Try /ping in your server to confirm the bot is responding. Then link your FACEIT account with /link once Phase 2 is released.