BoardKitBackend
Backend Overview
Overview of the @hfu.digital/boardkit-nestjs package
The @hfu.digital/boardkit-nestjs package provides a complete backend for collaborative whiteboards in NestJS applications.
What's Included
| Component | Description |
|---|---|
BoardModule | NestJS dynamic module for registration |
BoardService | Board and page CRUD operations |
CollaborationService | Realtime session management with state machine |
PermissionService | Role-based access control (viewer/editor/owner) |
AssetService | File upload with size and type validation |
ExportService | PNG, SVG, and PDF export |
BoardStorage | Abstract storage interface for boards, pages, elements, members, shares |
AssetStorage | Abstract storage interface for file uploads |
EventLogStorage | Abstract storage interface for event logging and snapshots |
BoardAuthGuard | Abstract authentication interface |
PrismaBoardAdapter | Prisma storage adapter |
BoardGateway | Socket.IO WebSocket gateway for realtime collaboration |
| 5 REST Controllers | Board, Page, Asset, Export, Share endpoints |
| Rate Limiter | Per-user message rate limiting middleware |
| Size Guard | Request body size limiting middleware |
| Testing Utilities | InMemoryBoardStorage, InMemoryAssetStorage, InMemoryEventLogStorage, MockAuthGuard |
Peer Dependencies
{
"@nestjs/common": "^10.0.0 || ^11.0.0",
"@nestjs/core": "^10.0.0 || ^11.0.0",
"@nestjs/websockets": "^10.0.0 || ^11.0.0",
"@nestjs/platform-socket.io": "^10.0.0 || ^11.0.0",
"rxjs": "^7.0.0"
}Quick Start
import { Module } from '@nestjs/common';
import { BoardModule } from '@hfu.digital/boardkit-nestjs';
@Module({
imports: [
BoardModule.register({
storage: myBoardStorage,
assetStorage: myAssetStorage,
eventLogStorage: myEventLogStorage,
authGuard: myAuthGuard,
}),
],
})
export class AppModule {}See Module Setup for the full configuration reference.