Skip to main content
Self-hosted Annie Mei is a two-service setup. The bot service handles Discord interactions and media lookups. The auth service handles AniList OAuth for /register.

Services

ServiceRepo pathWhat it doesMain dependencies
Bot service./Runs slash commands, serves /healthz, reads AniList, MyAnimeList, Spotify, PostgreSQL, and RedisDiscord, PostgreSQL, Redis
Auth service./authValidates signed OAuth context, redirects to AniList, handles callback, stores OAuth credentialsAniList OAuth, PostgreSQL

How /register works

1

Member runs `/register` in Discord

The bot creates a signed OAuth context that includes the caller’s Discord user ID and the interaction ID.
2

Bot returns a private link button

The button points to the auth service /oauth/anilist/start route using AUTH_SERVICE_BASE_URL.
3

Auth service validates the context

The auth service verifies the context signature, creates a single-use OAuth state value, and redirects the browser to AniList.
4

AniList redirects back to the auth service

The auth service exchanges the authorization code, fetches the AniList viewer ID, and stores the linked credentials.
5

Bot commands can use the linked account

/whoami can show the linked profile, and media lookups can include member list status and score when that data is available.

Shared values

These values matter across both services:
VariableWhy it matters
OAUTH_CONTEXT_SIGNING_SECRETMust match in both services so the auth service can validate the bot’s signed OAuth context
USERID_HASH_SALTKeep this aligned if you want the same hashed user fingerprints in logs and Sentry
AUTH_SERVICE_BASE_URLThe bot uses this origin to build the browser link for the auth service

Health endpoints

ServiceDefault local addressEndpoint
Bot service127.0.0.1:8080/healthz
Auth service127.0.0.1:8000/healthz

What happens if the auth service is missing

The bot still owns the /register command, but full self-hosted account linking requires the auth service. Because the bot loads OAuth configuration on startup, you should treat the auth service as part of the standard Annie Mei deployment rather than an optional add-on.

Next steps