ReadRealm uses a three-tier architecture: client applications communicate with a single NestJS backend API, which in turn manages a MongoDB database and a set of external AI and speech services.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/aliammari1/readrealm/llms.txt
Use this file to discover all available pages before exploring further.
Application roles
| App | Type | Technology | Purpose | Users |
|---|---|---|---|---|
| API | Backend | NestJS + TypeScript | Serves all clients, manages data and AI | All clients |
| Android | Client | Kotlin + Jetpack Compose | Native mobile reading app | End users |
| iOS | Client | Swift | Native mobile reading app | End users |
| Dashboard | Admin | Flutter (Web / Desktop / macOS) | Management, analytics, moderation | Administrators |
Backend modules
The NestJS API is organized into focused modules. The rootAppModule (apps/api/src/app.module.ts) imports all of them and applies a global LoggerMiddleware to every route.
| Module | Purpose | Key technologies |
|---|---|---|
auth | User authentication and authorization | JWT, bcrypt |
book | Book library management and EPUB parsing | Mongoose, pdf-lib |
chat | Real-time conversations | Socket.IO, NestJS Gateways |
user | User profile management and preferences | MongoDB, Mongoose |
verification | Email verification and OTP workflows | NodeMailer, Crypto |
speech-realtime | Voice processing and audio narration | FFmpeg, Azure Cognitive Services |
The
AppModule registers ConfigModule, JwtModule, and MongooseModule globally, so all feature modules share a single database connection and JWT configuration.Communication patterns
REST API (CRUD operations)
All four applications — Android, iOS, Flutter dashboard, and any future client — communicate with the NestJS API over HTTP REST for standard create, read, update, and delete operations. The full endpoint specification is defined inshared/api-spec/openapi.yaml.
The API listens on port 3000 by default, configurable via the PORT environment variable:
WebSocket (real-time chat)
TheChatModule uses Socket.IO and NestJS WebSocket Gateways to deliver real-time messaging. Clients maintain a persistent WebSocket connection alongside their HTTP connection. The backend emits events back to connected clients when new messages arrive, enabling millisecond-latency chat without polling.
External services
| Service | Provider | Used for |
|---|---|---|
| Google Generative AI | Book summaries, Q&A generation, content analysis | |
| HuggingFace | HuggingFace | Smart recommendations and NLP tasks |
| Azure Text-to-Speech | Microsoft Azure | Audio narration of book content |
| Azure Real-time Speech | Microsoft Azure | Speech-to-text for voice commands |
| MongoDB | Self-hosted or cloud | Primary data store for users, books, chat, and preferences |
Docker deployment
Thedocker-compose.yaml at the repository root defines two services:
readrealm-api— The NestJS application built fromapps/api/Dockerfile, exposed on port3000readrealm-mongodb— MongoDB 7.0, exposed on port27017with a persistent named volume
readrealm-network bridge network. The API container’s MONGODB_URL is automatically set to mongodb://mongodb:27017/readrealm when using Docker Compose.