Skip to main content
ScoreSaber Reloaded uses a dual-database architecture: MongoDB for persistent data storage and Redis for high-performance caching.

MongoDB with Typegoose

Schema Definition

Typegoose provides TypeScript decorators for Mongoose schemas:

Leaderboard Model

Base Leaderboard Class

Database Operations

Creating Documents

Updating Documents

Complex Queries

Aggregation Pipeline

Redis Caching

Cache Configuration

Cache Implementation

Cache Usage Examples

Caching player data:
Caching leaderboard data:
Invalidating cache on update:

Client-side Database (Dexie)

The frontend uses Dexie (IndexedDB wrapper) for offline-first persistence:

Database Indexes

Player indexes:
Leaderboard indexes:

Connection Management

Graceful shutdown:

Data Flow Summary