Skip to content

Built-in Dependency Injection

Database and Cache

Dependency TypeImport PathDescription
Databaseapp.dependencies.databaseDatabase session (AsyncSession), used for database operations
NoContextDBapp.dependencies.databaseNo-context database session (AsyncSession), used when you need to perform database operations without sharing Session in dependency injection. Use this if you encounter concurrent connection issues
Redisapp.dependencies.databaseRedis client (redis.asyncio.Redis), used for cache operations

Core Services

Dependency TypeImport PathDescription
Fetcherapp.dependencies.fetcherFetcher instance, used to fetch data from osu! official
StorageServiceapp.dependencies.storageStorage service, used for file storage operations
EventHubapp.dependencies.event_hubEvent hub, used to send and subscribe to events

Cache Services

Dependency TypeImport PathDescription
BeatmapsetCacheServiceapp.dependencies.cacheBeatmapset cache service
UserCacheServiceapp.dependencies.cacheUser cache service

Request Context

Dependency TypeImport PathDescription
IPAddressapp.dependencies.geoipClient IP address (str)
GeoIPServiceapp.dependencies.geoipGeoIP service, used to query location by IP
UserAgentInfoapp.dependencies.user_agentUser agent info model
APIVersionapp.dependencies.api_versionAPI version number (int)

Chat

Dependency TypeImport PathDescription
BanchoBotapp.dependencies.botBanchoBot instance, used to send chat messages

Other Services

Dependency TypeImport PathDescription
DownloadServiceapp.dependencies.beatmap_downloadBeatmap download service, provides load-balanced download URLs
ClientVerificationServiceapp.dependencies.client_verificationClient version verification service

Released under the MIT License