This page focuses on the main bot service. If you want to test
/register end to end, also set up the Auth service.Prerequisites
Ensure you have the following installed:- Rust 1.95 or later - Install via rustup
- PostgreSQL - For database storage
- Redis - For caching API responses
- SQLx CLI (optional) - For auth service schema work
Install SQLx CLI
Clone the Repository
1
Clone from GitHub
2
Install Dependencies
Rust dependencies are managed via This will take a few minutes on first run as it compiles all dependencies.
Cargo.toml. Download and compile all dependencies:Configuration
Environment Variables
Create a.env file in the project root with the following variables:
Get a Discord Bot Token
Get a Discord Bot Token
- Go to Discord Developer Portal
- Create a new application
- Navigate to Bot section
- Click Reset Token and copy the token
- Copy the token into
DISCORD_TOKEN
Get Spotify API Credentials
Get Spotify API Credentials
- Go to Spotify Developer Dashboard
- Create a new app
- Copy the Client ID and Client Secret
Set up Sentry DSN
Set up Sentry DSN
The current app startup expects For production, sign up at sentry.io and create a Rust project.
SENTRY_DSN to be set. For local development, you can use a dummy DSN:Set up AniList OAuth linking
Set up AniList OAuth linking
- Set up the Auth service
- Use the same value for
OAUTH_CONTEXT_SIGNING_SECRETin both services - Set
AUTH_SERVICE_BASE_URLto the auth service origin, for examplehttps://auth.example.com - Start the bot after both services are configured and reachable
Database Setup
1
Create PostgreSQL Database
2
Run Migrations
The bot runs its own SQLx migrations at startup for settings tables. If you are testing This step is optional for a bot-only local run. See the Database guide for more details.
/register, run the auth service once to apply its OAuth SQLx migrations to the shared database.3
Verify Schema
Check that the expected tables exist:
Redis Setup
Start a local Redis instance:Running Locally
Development Mode
The repo includes abacon.toml configuration. Install bacon once:
dev job by default, which executes cargo run and restarts the bot whenever a source file changes. Other useful jobs:
You can also run a specific job directly:
Fast Type Checking
For quick feedback without running the bot:cargo build and catches most errors.
Production Build
Compile an optimized release binary:target/release/annie-mei.
Invite Bot to Test Server
Generate an OAuth2 invite link:- Go to your app in Discord Developer Portal
- Navigate to OAuth2 → URL Generator
- Select scopes:
botapplications.commands
- Select bot permissions:
- Send Messages
- Embed Links
- Read Message History
- Copy the generated URL and open it in your browser
- Select your test server and authorize
Verify Installation
Once the bot is running and invited:- Open Discord
- Type
/pingin a channel - The bot should respond with a greeting
Troubleshooting
Bot doesn't show online
Bot doesn't show online
- Check that
DISCORD_TOKENis correct - Check logs for connection errors:
RUST_LOG=serenity=debug cargo run
Slash commands not appearing
Slash commands not appearing
- Commands are registered globally and can take up to 1 hour to propagate
- For faster development, use guild-specific commands (requires code changes)
- Check logs for command registration errors
Database connection errors
Database connection errors
- Verify PostgreSQL is running:
pg_isready - Check
DATABASE_URLformat:postgresql://user:password@host/database - Ensure the database exists:
psql -l | grep annie_mei
Redis connection errors
Redis connection errors
- Verify Redis is running:
redis-cli ping - Check
REDIS_URLformat:redis://127.0.0.1:6379 - For password-protected Redis:
redis://:password@host:port
Next Steps
Architecture
Understand the project structure and technology stack
Adding Commands
Create your first slash command
Database
Learn database migration workflows
Testing
Run tests and ensure code quality
