Skip to main content

Overview

Self-hosted Annie Mei has two env surfaces:
  • the main annie-mei bot service
  • the companion auth service for AniList OAuth
Use this page as the source of truth when you build .env files for both services.

Shared values

These values should stay aligned across the bot and auth service.
VariableRequiredNotes
OAUTH_CONTEXT_SIGNING_SECRETYesMust match so the auth service can validate the bot’s signed OAuth context
USERID_HASH_SALTYesKeep this aligned if you want consistent hashed user identifiers in logs and Sentry

Bot service

Required

VariableNotes
DISCORD_TOKENDiscord bot token
DATABASE_URLPostgreSQL connection string for the bot service
REDIS_URLRedis connection string
SPOTIFY_CLIENT_IDSpotify API client ID
SPOTIFY_CLIENT_SECRETSpotify API client secret
MAL_CLIENT_IDMyAnimeList API client ID
SENTRY_DSNRequired by current bot startup
ENVEnvironment name such as development, staging, or production
AUTH_SERVICE_BASE_URLAuth service origin only, with no path
OAUTH_CONTEXT_SIGNING_SECRETShared secret used to sign OAuth context payloads
USERID_HASH_SALTSalt for hashing Discord user IDs in logs

Optional

VariableDefaultNotes
SENTRY_TRACES_SAMPLE_RATE0.0Float from 0.0 to 1.0
SERVER_PORT8080Local HTTP health server port
OAUTH_CONTEXT_TTL_SECONDS300Lifetime of /register OAuth links
GEMINI_API_KEYnoneEnables Gemini or another compatible LLM provider
LLM_MODELgemini-2.0-flashOptional LLM model override
LLM_BASE_URLhttps://generativelanguage.googleapis.com/v1beta/openaiOptional OpenAI-compatible base URL override
RUST_LOGinfo,serenity=warnTracing filter for local or production logging

Auth service

Required

VariableNotes
ANILIST_CLIENT_IDAniList OAuth app client ID
ANILIST_CLIENT_SECRETAniList OAuth app client secret
ANILIST_REDIRECT_URIMust match the AniList app callback URL
DATABASE_URLPostgreSQL connection string for auth sessions and credentials
ROCKET_SECRET_KEYRocket application secret
OAUTH_CONTEXT_SIGNING_SECRETShared secret used to validate the bot’s OAuth context
USERID_HASH_SALTSalt used for hashed user fingerprints in logs

Optional

VariableDefaultNotes
OAUTH_CONTEXT_TTL_SECONDS300Accepted age of signed OAuth context payloads
OAUTH_STATE_TTL_SECONDS300Lifetime of the single-use AniList OAuth state value
SENTRY_DSNnoneEnables Sentry in the auth service
SENTRY_ENVIRONMENTnoneEnvironment label used by Sentry
SENTRY_TRACES_SAMPLE_RATE0.0Float from 0.0 to 1.0

Example local configuration

Bot .env

# Discord
DISCORD_TOKEN=your_discord_bot_token

# Storage
DATABASE_URL=postgres://user:password@localhost/annie_mei
REDIS_URL=redis://localhost:6379

# External APIs
SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
MAL_CLIENT_ID=your_mal_client_id

# Monitoring
SENTRY_DSN=https://key@org.ingest.sentry.io/project
ENV=development
SENTRY_TRACES_SAMPLE_RATE=0.0

# Shared values
USERID_HASH_SALT=generate_a_random_secret_value
AUTH_SERVICE_BASE_URL=http://127.0.0.1:8000
OAUTH_CONTEXT_SIGNING_SECRET=generate_a_random_secret_value

# Optional
OAUTH_CONTEXT_TTL_SECONDS=300
SERVER_PORT=8080
RUST_LOG=info,serenity=warn

Auth auth/.env

ANILIST_CLIENT_ID=your_anilist_client_id
ANILIST_CLIENT_SECRET=your_anilist_client_secret
ANILIST_REDIRECT_URI=http://127.0.0.1:8000/oauth/anilist/callback
DATABASE_URL=postgres://user:password@localhost/annie_mei_auth
ROCKET_SECRET_KEY=generate_a_random_secret_key
OAUTH_CONTEXT_SIGNING_SECRET=generate_a_random_secret_value
USERID_HASH_SALT=generate_a_random_secret_value
OAUTH_CONTEXT_TTL_SECONDS=300
OAUTH_STATE_TTL_SECONDS=300
SENTRY_DSN=
SENTRY_ENVIRONMENT=development
SENTRY_TRACES_SAMPLE_RATE=0.0

Where these values are used

  • Bot service references come from annie-mei/src/main.rs, annie-mei/src/server.rs, and annie-mei/src/utils/oauth.rs
  • Auth service references come from auth/src/main.rs