diff --git a/docs/services/tldraw/How it works.md b/docs/services/tldraw/How it works.md
deleted file mode 100644
index 02992d2..0000000
--- a/docs/services/tldraw/How it works.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# How it works
-
-## Configuration
-
-- NEST_LOG_LEVEL - logging level
-- FEATURE_TLDRAW_ENABLED - flag determining if tldraw is enabled
-- TLDRAW_URI - address of tldraw server
-- INCOMING_REQUEST_TIMEOUT - request timeout
-- TLDRAW_DB_URL - mongoDB connection string
-- TLDRAW__SOCKET_PORT - port number for websockets connection
-- TLDRAW__PING_TIMEOUT - timeout for ping-pong during establishing websockets connection
-- TLDRAW__FINALIZE_DELAY - delay in ms before checking if can finalize a tldraw board
-- TLDRAW__GC_ENABLED - if tldraw garbage collector should be enabled
-- TLDRAW__DB_COMPRESS_THRESHOLD - threshold size for tldraw mongo documents compression
-- TLDRAW__MAX_DOCUMENT_SIZE - max size of a single tldraw document in mongo
-- TLDRAW__ASSETS_ENABLED - enables uploading assets to tldraw board
-- TLDRAW__ASSETS_SYNC_ENABLED - enables synch of tldraw board assets with filestorage (no longer used)
-- TLDRAW__ASSETS_MAX_SIZE - maximum asset size in bytes
-- TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST - listy of allowed assets MIME types
-- REDIS_URI - Redis connection string
-- TLDRAW_CLIENT_REPLICAS - number of pods for tldraw-client
-- TLDRAW_SERVER_REPLICAS - number of pods for tldraw-server
-- TLDRAW_ADMIN_API_CLIENT__API_KEY - authorization API key for accessing tldraw controller (delete flow)
-- TLDRAW_ADMIN_API_CLIENT__BASE_URL - address of tldraw controller (delete flow)
-
-In order to have deletion functionality fully working you have to fill those feature flags, e.g.:
-- ADMIN_API__ALLOWED_API_KEYS=["7ccd4e11-c6f6-48b0-81eb-abcdef123456"]
-- TLDRAW_ADMIN_API_CLIENT__API_KEY="7ccd4e11-c6f6-48b0-81eb-abcdef123456"
-- TLDRAW_ADMIN_API_CLIENT__BASE_URL="http://localhost:3349"
-
-## Create
-![Create tldraw workflow](./assets/Create TLDRAW.drawio.svg)
-
-Creation of Tldraw starts with creation proccess for Courses and CourseBoard. It has Representation in CourseBoard as card's element (BoardNode in db). After creating Representation of drawing we can enter actual tldraw SPA client (left side of picture).
-
-1. User enters CourseBoard and creates Representation of whiteboard (tldraw) in CourseCard.
-2. Data is saved and feedback with proper creation is given - user can see Representation and can enter whiteboard.
-3. By entering whiteboard user is redirected to SPA tldraw-client.
-4. Tldraw-client is starting WS connection with tldraw-server.
-5. Tldraw-server firstly checks if user has permission to this resource (by checking if user has a permission to Representation of whiteboard -BoardNode).
- Id of Representation is same as drawingName, which is visible in tldraw-client url.
-6. If user has permission tldraw-server is allowing to remain connection and getting drawing data from separate tldraw-db. If there were no drawing data saved tldraw-server will create it automatically.
-
-## Usage
-![Usage tldraw workflow](./assets/Use tldraw.drawio.svg)
-
-### Connection
-
-1. user joins tldraw board
-2. tldraw-client connects to one of the tldraw-server pods and tries to establish websocket connection
-3. tldraw-server calls schulcloud-server via HTTP requests to check user permissions, if everything is fine the websocket connection is established
-4. tldraw-server gets stored tldraw board data from mongodb and sends it via websocket to connected users
-5. tldraw-server starts subscribing to Redis PUBSUB channel corresponding to tldraw board name to listen to changes from other pods
-
-### Sending updates/storing data
-
-1. tldraw-client sends user's drawing changes to the tldraw-server via websocket connection
-2. tldraw-server stores the board update in the mongodb - basically creates a diff between what's already stored and what's being updated
-3. tldraw-server pushes the update to correct Redis channel so that clients connected to different pods have synchronized board data
-4. other pods subscribing to Redis channel send updates to their connected clients via websocket whenever they see a new message on Redis channel
-
-## Delete
-![Delete tldraw workflow](./assets/Delete TLDRAW.drawio.svg)
-
-1. User from schulcloud app in CourseBoard deletes whiteboard (tldraw) instance form CardBoard.
-2. Having drawingName sc-server is removing Representation data in sc-database - BoardNodes collection ( drawingName === BoardNode id)
-3. Sc-server is calling tldraw-server via tldraw-management rules in tldraw-server-svc to delete all data that has given id).
-4. After deletion user sees refreshed state of CourseBoard.
-
-## Assets
-### files upload
-
-Images/GIFs can be uploaded into tldraw whiteboard by every user with access to the board. We use s3 storage to physically store uploaded assets while tldraw only holds URL to a resource.
-
-The files are uploaded by calling schulcloud-api's fileController upload endpoint. This is possible because tldraw is represented as a boardnode called drawing-element. Mongo id of this drawing-element is a roomId used in URL param when connecting to a specific board.
-
-### files deletion
-
-Because of the undo/redo functionality of tldraw (user can basically undo an upload of an image, undo a deletion, then redo upload etc.) we needed a way to clean up unused assets from the storage. We could not use soft delete/restore endpoints every time undo/redo happens due to various issues with performance/user experience and technical challenges that arose when testing different scenarios. We decided to go with cron job solution: once per day, at midnight by default, we would go through each board stored in database, get every asset that's stored as URL but no longer used as an active drawing and then delete all of them via amqp call to filesStorage service.
-
-For implementation details, take a look at: tldraw-files.console.ts.
\ No newline at end of file
diff --git a/docs/services/tldraw/Local setup.md b/docs/services/tldraw/Local setup.md
deleted file mode 100644
index 62a722b..0000000
--- a/docs/services/tldraw/Local setup.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Local setup
-
-### To run tldraw locally:
-
-1. Run redis i.e. in a docker container, it will work on localhost:6379 by default which is what the REDIS_URI env var is set to, for example on wsl: https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-windows/
-2. Add to server repo the .env with following values
- Please note redis default user is use and you can pass random value as password like the 123.
-
-- REDIS_URI=redis://default:123@127.0.0.1:6379
-- TLDRAW_ADMIN_API_CLIENT__API_KEY=randomString
-- ADMIN_API__ALLOWED_API_KEYS=randomString
-- TLDRAW_ADMIN_API_CLIENT__BASE_URL=http://localhost:3349
-
-3. To run
- 1. npm run nest:start:dev (schulcloud-server)
- 2. npm run nest:start:files-storage:dev (schulcloud-server with s3, if you want to upload files)
- 3. npm run nest:start:tldraw:dev (schulcloud-server)
- 4. npm run dev (schulcloud-client)
- 5. npm run servce (nuxt-client)
- 6. npm run dev (tldraw-client)
-
-### Create new whiteboard:
-
-1. Go to a course
-2. Go to 'Column board'
-3. Create a new card and a new 'Whiteboard' element within it, then click it
-4. A new browser tab with URL like: http://localhost:4000/tldraw?roomName=65c37329b2f97cc714d31c00 will open
-5. Change the port part from 4000 to 3046, which is the default port of tldraw-client app
-6. You should see a working tldraw whiteboard now
-
diff --git a/docs/services/tldraw/Technical details.md b/docs/services/tldraw/Technical details.md
deleted file mode 100644
index c6f4f42..0000000
--- a/docs/services/tldraw/Technical details.md
+++ /dev/null
@@ -1,90 +0,0 @@
-# Technical details
-
-## Backend
-We are using pure Web Sockets implementation to establish connection between client and server. The reason why we used pure websockets is because tldraw-client is using y-websockets from Yjs library, that does not connect with socket.io web sockets. We also have to implement broadcasting mechanism to provide stateless solution. To achive that goal we decided to use Redis. We used ioredis library to connect to our Redis instance. Everytime user make some changes at first it is handled to the server instance that he is connected to an then this change is send to the channel with the name of the board and servers that also operate that board are listening on this channel so they can recive messages from other servers and provide those changes to users that are connected to this pod. We added the same mechanism for awareness channel so every user from every pod can see other users cursours.
-
-
-Tldraw is deployed as a separate application from schoulcloud-server working on the same namespace as schoulcloud-server. On the backend side we have added couple new resources:
-
-- tldraw-deployment - deployment for tldraw-server's instances.
-- tldraw-server-svc - service for tldraw-service to communicate with tldraw-client (WS) and schoulcloud-server (management e.g. deletion of data)
-- tldraw-svc-monitor - service to collect metrics from tldraw. Apart from typical metrics like request time we also added two application-level metrics:
- - sc_tldraw_users - number of active users on boards
- - sc_tldraw_boards - number of active boards
-- tldraw-ingress - for steering web external traffic to tldraw-server (for now management rules in tldraw-server-svc are closed from external clients)
-
-
-### Tldraw-server code structure
-
-- tldraw.ws.service.ts - main service responsible for establishing web socket connection as well as saving data to database. Responsibe for Redis communication.
-- tldraw.controller.ts - controller that expose HTTP deletion method outside the tldraw-server application.
-- tldraw.server.ts - service used by TldrawController.
-- y-mongodb.ts - main adapter to connect with mongodb, provides transaction mechanism, calucalate diffs between revision and to apply updates.
-- tldraw-board.repo.ts - repository object to connect TldrawWsService and YMongodb.
-- tldraw.repo.ts - repository used by TldrawService to find and delete boards from database.
-- ws-shared-doc.do.ts - main structure representing tldraw drawing during web socket communication. it holds all the web-socket addresses that are connected to this board, so we can inform all the connected clients about changes.
-- tldraw-drawing.entity.ts - object representing tldraw drawingn entity in database.
-- metrics.service.ts - service resonsible for storing application-level metrics.
-
-
-On the backend side we are also using Yjs library to store tldraw board in memory and to calculate diffs after the board is changed.
-
-## Frontend
-
-### Key Files
-- stores/setup.ts – this file provides a real-time collaboration environment for a drawing application using the WebSocket and Yjs libraries.
-- hooks/useMultiplayerState.ts – custom hook for managing multiplayer state.
-- App.tsx – main application component integrating Tldraw and multiplayer state.
-
-### Frontend Technologies
-
-The frontend of the project is built using React and leverages various libraries and tools for enhanced functionality. Here is an overview of the key frontend technologies:
-
-- React: A JavaScript library for building user interfaces.
-- Yjs: A real-time collaboration framework for synchronizing shared state.
-- Tldraw: A library for drawing functionalities in the application. We use the old version of tldraw: https://github.com/tldraw/tldraw-v1, after the tldraw team releases the official update of the new version, we will work on the new version and integrate it with the needs of our users.
-
-### State Managment
-
-1. Yjs is integrated into the project for real-time collaboration. The central state (shapes, bindings, assets) is managed using Yjs maps.
-2. store.ts handles the configuration of Yjs, WebSocket connections, and provides centralized maps for shapes, bindings, and assets
-3. useMultiplayerState.ts -This hook manages the multiplayer state, including loading rooms, handling file system operations, and updating Yjs maps:
- - Mounting and handling changes in Tldraw App.
- - Presence management and user updates.
- - File system operations like opening and saving projects.
-
-#### useTldrawUiSanitizer.ts
-This hook is designed to observe changes in the DOM, specifically targeting certain buttons and a horizontal rule (< hr>), and hides them if they match a specific ID pattern. We hide this elements and left just only Language and Keyboard shortcuts.
-
-#### Event Handling
- - onMount: Handles mounting of the Tldraw app.
- - onChangePage: Manages page changes and updates Yjs maps.
- - onUndo and onRedo: Handle undo and redo operations.
- - onChangePresence: Manages presence changes in the collaborative environment.
- - onAssetCreate: This function is triggered when a user attempts to upload an asset (like an image or a file).
-
-#### Useful links
-- https://tldraw.dev/ - documentation for the new version of tldraw
-
-- https://old.tldraw.com/ - tldraw live application
-
-- https://github.com/tldraw/tldraw-v1 - tldraw v1 repo
-
-- https://github.com/MaxNoetzold/y-mongodb-provider - code from this package was used to add mongodb as a persistence to tldraw
-
-- https://discord.com/invite/SBBEVCA4PG discord channel with open questions and answers
-
-- https://grafana.dbildungscloud.dev/d/b6b28b2b-3129-4772-8102-e32981d2c2e3/devops-tldraw-metrics?orgId=1&refresh=1m&var-source=sc-dev-dbc&var-env=main&var-env=tldraw-debugging - grafana v
-
-- https://grafana.dbildungscloud.org/d/b6b28b2b-3129-4772-8102-e32981d2c2e0/devops-tldraw?orgId=1&from=now-6h&to=now&refresh=1m - grafana metrics
-
-- https://github.com/nimeshnayaju/yjs-tldraw - yjs with tldraw POC
-
-- https://github.com/yjs/y-websocket/tree/master/bin - yjs/y-websocket repo
-
-- https://github.com/erdtool/yjs-scalable-ws-backend/tree/main - Yjs scalable WS backend with redis example
-
-- https://teamchat.dbildungscloud.de/channel/G9hJWv92zXEESKK3X - rocketchat discussion "tldraw syncronisation for release again"
-
-- https://teamchat.dbildungscloud.de/group/SagK4sCyujhu6yZr8 - rocketchat discussion "Tldraw deployment"s
-
diff --git a/docs/services/tldraw/assets/Create TLDRAW.drawio.png b/docs/services/tldraw/assets/Create TLDRAW.drawio.png
deleted file mode 100644
index 003d1fd..0000000
Binary files a/docs/services/tldraw/assets/Create TLDRAW.drawio.png and /dev/null differ
diff --git a/docs/services/tldraw/assets/Create TLDRAW.drawio.svg b/docs/services/tldraw/assets/Create TLDRAW.drawio.svg
deleted file mode 100644
index 0f99857..0000000
--- a/docs/services/tldraw/assets/Create TLDRAW.drawio.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/docs/services/tldraw/assets/Delete TLDRAW.drawio.png b/docs/services/tldraw/assets/Delete TLDRAW.drawio.png
deleted file mode 100644
index c09988d..0000000
Binary files a/docs/services/tldraw/assets/Delete TLDRAW.drawio.png and /dev/null differ
diff --git a/docs/services/tldraw/assets/Delete TLDRAW.drawio.svg b/docs/services/tldraw/assets/Delete TLDRAW.drawio.svg
deleted file mode 100644
index d8b7f38..0000000
--- a/docs/services/tldraw/assets/Delete TLDRAW.drawio.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/docs/services/tldraw/assets/Use tldraw.drawio.png b/docs/services/tldraw/assets/Use tldraw.drawio.png
deleted file mode 100644
index e5541dc..0000000
Binary files a/docs/services/tldraw/assets/Use tldraw.drawio.png and /dev/null differ
diff --git a/docs/services/tldraw/assets/Use tldraw.drawio.svg b/docs/services/tldraw/assets/Use tldraw.drawio.svg
deleted file mode 100644
index 9fc8d5c..0000000
--- a/docs/services/tldraw/assets/Use tldraw.drawio.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/docs/tldraw-server/How it works.md b/docs/tldraw-server/How it works.md
new file mode 100644
index 0000000..3580b26
--- /dev/null
+++ b/docs/tldraw-server/How it works.md
@@ -0,0 +1,93 @@
+# How it works
+
+The terms Redis and Valkey are used here synonymously and should describe the used in-memory-database.
+
+## Configuration
+
+- AUTHORIZATION_API_HOST - host address of the authorization endpoint (schuldcloud-server)
+- FEATURE_TLDRAW_ENABLED - flag determining if tldraw is enabled
+- LOGGER_LOG_LEVEL - logging level
+- LOGGER_EXIT_ON_ERROR - flag whether an error will cause the application to stop
+- METRICS_COLLECT_DEFAULT - flag whether the default metrics shall be collected
+- REDIS_CLUSTER_ENABLED - flag whether a redis cluster or used or not
+- REDIS_URL - redis connection string
+- REDIS_SENTINEL_SERVICE_NAME - name of the redis sentinel service
+- REDIS_PREFIX - prefix to be used with redis database
+- REDIS_SENTINEL_NAME - name of the redis sentinel
+- REDIS_SENTINEL_PASSWORD - password for the redis sentinel
+- S3_ACCESS_KEY - access key for S3 storage
+- S3_BUCKET - name of the S3 bucket
+- S3_ENDPOINT - URL of the S3 service
+- S3_PORT - port number for the S3 service
+- S3_SECRET_KEY - secret key for S3 storage
+- S3_SSL - flag to enable or disable SSL for S3 storage
+- TLDRAW_ASSETS_ENABLED - enables uploading assets to tldraw board
+- TLDRAW_ASSETS_MAX_SIZE_BYTES - maximum asset size in bytes
+- TLDRAW_ASSETS_ALLOWED_MIME_TYPES_LIST - list of allowed assets MIME types
+- TLDRAW_WEBSOCKET_PATH - path for the tldraw websocket connection
+- TLDRAW_WEBSOCKET_URL - URL for the tldraw websocket connection
+- WORKER_MIN_MESSAGE_LIFETIME - minimal lifetime of a update message consumed by the worker
+- WORKER_TASK_DEBOUNCE - minimum idle time (in milliseconds) of the pending task messages to be claimed
+- WORKER_TRY_CLAIM_COUNT - the maximum number of task messages to claim
+- X_API_ALLOWED_KEYS - list of allowed xAPI keys
+
+In order to have deletion functionality fully working locally you have to fill those feature flags, e.g.:
+
+tldraw-server :
+- X_API_ALLOWED_KEYS="7ccd4e11-c6f6-48b0-81eb-abcdef123456"
+
+schulcloud-server :
+- TLDRAW_ADMIN_API_CLIENT_API_KEY="7ccd4e11-c6f6-48b0-81eb-abcdef123456"
+- TLDRAW_ADMIN_API_CLIENT_BASE_URL="http://localhost:3349"
+
+## Create
+![Create tldraw workflow](./assets/Create_TLDRAW.drawio.svg)
+
+The Tldraw board can be created by the user on the courses ColumnBoard. It has a representation in ColumnBoard as DrawingElement inside a card (BoardNode in db). After creating representation as DrawingElement we can enter actual Tldraw SPA client on click.
+
+1. User enters ColumnBoard and creates Representation of whiteboard (tldraw) in Card.
+2. Data is saved and feedback with proper creation is given - user can see Representation and can enter whiteboard.
+3. By entering whiteboard user is redirected to SPA tldraw-client.
+4. Tldraw-client is starting WS connection with tldraw-server.
+5. Tldraw-server first checks if user has permission to this resource (by checking if user has a permission to Representation of whiteboard - BoardNode).
+ Id of Representation is same as drawingName, which is visible in tldraw-client url.
+6. If user has permission tldraw-server is allowing to remain connected and getting drawing data from S3 storage. If there is no drawing data available, the tldraw-server will create a new document automatically.
+
+## Usage
+![Usage tldraw workflow](./assets/Use_TLDRAW.drawio.svg)
+
+### Connection
+
+1. User joins tldraw board.
+2. Tldraw-client connects to one of the tldraw-server pods and tries to establish websocket connection.
+3. Tldraw-server calls schulcloud-server via HTTP requests to check user permissions. If everything is fine, the websocket connection is established.
+4. Tldraw-server gets stored tldraw board data from S3 storage and sends it via websocket to connected user.
+5. Tldraw-server starts subscribing to Redis PUBSUB channel corresponding to tldraw board name to listen to changes from other pods.
+
+### Sending updates/storing data
+
+1. Tldraw-client sends user's drawing changes to the tldraw-server via websocket connection.
+2. Tldraw-server stores the board update in the valkey db - basically creates a diff between what's already stored and what's being updated.
+3. Tldraw-server pushes the update to the boards Redis channel so that connected clients on different pods have synchronized board data.
+4. Other pods subscribing to Redis channel send updates to their connected clients via websocket whenever they see a new message on Redis channel.
+5. Finally the worker will run and persist the current state of the drawing data by applying all currently available updates from valkey on top of the stored drawing data and update the S3 storage accordingly.
+
+## Delete
+![Delete tldraw workflow](./assets/Delete_TLDRAW.drawio.svg)
+
+1. User from schulcloud app in ColumnBoard deletes whiteboard (tldraw) instance form Card.
+2. Schulcloud-server is removing representation data in schulcloud-database - BoardNodes collection.
+3. Schulcloud-server is calling tldraw-server to delete all data that has given id.
+4. Tldraw-server sends a delete action via websocket to inform connected clients about deletion. Clients redirect away from Tldraw-board to ensure that no new messages are added to valkey database.
+5. Finally the worker will run, clear all updates and data from the valkey db and delete the drawing data from the S3 storage.
+
+## Assets
+### files upload
+
+Images/GIFs can be uploaded into tldraw whiteboard by every user with access to the board. We use SVS FileStorageService to physically store uploaded assets while tldraw only holds URL to a resource.
+
+The files are uploaded by calling schulcloud-api's fileController upload endpoint. This is possible because tldraw is represented as a boardnode called drawing-element. Mongo id of this drawing-element is a roomId used in URL param when connecting to a specific board.
+
+### files deletion
+
+The deletion of files is handled directly by the tldraw-client itself. On deletion in the UI, the client sends a delete request to the file storage. While awaiting the answer from file storage the editing of the Tldraw-board is blocked to prevent race conditions to the file storage.
\ No newline at end of file
diff --git a/docs/tldraw-server/Local setup.md b/docs/tldraw-server/Local setup.md
new file mode 100644
index 0000000..ac34503
--- /dev/null
+++ b/docs/tldraw-server/Local setup.md
@@ -0,0 +1,23 @@
+# Local setup
+
+### To run tldraw locally:
+
+1. Run redis i.e. in a docker container, it will work on localhost:6379 by default which is what the REDIS_URI env var is set to, for example on wsl: https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-windows/ .
+2. In the tldraw-server make a copy of .env.default and rename it to .env, in order to use the default configuration.
+3. To run
+ 1. npm run nest:start:dev (schulcloud-server)
+ 2. npm run nest:start:files-storage:dev (schulcloud-server with s3, if you want to upload files)
+ 3. npm run start:server:dev (tldraw-server)
+ 4. npm run start:worker:dev (tldraw-server)
+ 5. npm run dev (schulcloud-client)
+ 6. npm run servce (nuxt-client)
+ 7. npm run dev (tldraw-client)
+
+### Create new whiteboard:
+
+1. Go to a course.
+2. Go to 'Column board'.
+3. Create a new card and a new 'Whiteboard' element within it, then click it.
+4. A new browser tab with URL like: http://localhost:4000/tldraw?roomName=65c37329b2f97cc714d31c00 will open.
+5. Change the port part from 4000 to 3046, which is the default port of tldraw-client app.
+6. You should see a working tldraw whiteboard now.
diff --git a/docs/tldraw-server/Technical details.md b/docs/tldraw-server/Technical details.md
new file mode 100644
index 0000000..ce81a32
--- /dev/null
+++ b/docs/tldraw-server/Technical details.md
@@ -0,0 +1,147 @@
+# Technical details
+
+## Introduction
+
+In tldraw-server, **Yjs**, **Redis** and **S3 storage** are integrated to support collaborative drawing features, data synchronization, and persistent storage in a scalable and efficient manner. The combination of **Yjs** (used for collaborative editing), **Redis** (for real-time data synchronization), and **S3** (for file storage) enables the platform to handle complex collaborative interactions and large-scale, persistent storage of drawing data.
+
+### How tldraw Uses Redis and S3 Storage:
+
+1. **Real-time Collaboration with Yjs:**
+ - **Yjs** is the backbone of real-time collaboration in tldraw. It provides a **CRDT-based (Conflict-free Replicated Data Type)** framework for handling shared documents where changes made by one user are automatically and consistently synchronized across all other users in the same session.
+ - In tldraw, the **drawing canvas** or **document** is represented as a **Yjs document**. Users can draw shapes, lines, text, or modify the canvas in real time.
+ - The **Yjs document** tracks all changes in the form of small, incremental edits. These edits could be changes to the position of objects, the creation of new objects (e.g., shapes or lines), or modification of existing elements.
+
+. **Redis for Real-Time Data Synchronization:**
+ - **Redis** is used to store and synchronize these Yjs documents across multiple users in real time.
+ - Redis, being a fast in-memory key-value store, provides low-latency updates that are crucial for real-time collaboration. It is used for:
+ - **Broadcasting updates**: When one user makes a change, Yjs sends that change to the Redis server, which then distributes the change to all other connected users.
+ - **Data persistence**: Changes are stored in Redis and can be fetched by other users at any time to maintain consistency.
+ - The use of **Redis Pub/Sub** allows different instances of the tldraw application to subscribe to channels. When one user makes a change, the Redis system publishes the change, and other users (who are subscribed to that document) get updated immediately.
+
+3. **S3 Storage for Persistent and Large-Scale File Storage:**
+ - While Redis ensures real-time synchronization and collaboration, **S3** (Amazon Simple Storage Service) is used for **persistent storage** of larger files or data that need to be saved across sessions.
+ - **S3** is highly scalable and can store large amounts of data. For tldraw, S3 is primarily used for:
+ - **Storing canvases and drawings**: While **Redis** handles real-time data synchronization and storage of changes, the worker service is responsible for **periodically persisting** the state of the collaborative canvas to **S3 storage**.
+ - **S3 as a file store**: Unlike Redis, which is an in-memory store designed for fast access and transient data, S3 is optimized for storing larger data in a persistent manner. This makes it suitable for storing media files, large canvas snapshots, and other assets that don't need to be constantly updated in real-time.
+
+4. **Integration Between Redis and S3:**
+ - **Redis** and **S3** serve different but complementary purposes:
+ - **Redis** handles **real-time synchronization** of drawing changes and interactions, ensuring that users see each other's edits in near real-time.
+ - **S3** handles **long-term storage** and **backup** of the drawings or canvases themselves. For example, when a user closes the app or saves their session, the drawing data is saved to S3.
+ - The worker service will save snapshots of the collaborative document or canvas to S3 periodically, ensuring that the state of the canvas is preserved even if a user disconnects or the server restarts.
+
+5. **How tldraw's Workflow Would Look Using Redis and S3:**
+ - **Step 1: Collaborative Drawing Session**
+ - Users interact with the tldraw canvas, making real-time changes (drawing shapes, text, etc.).
+ - The changes are immediately propagated through **Yjs** and **Redis**. Redis stores these changes in memory and broadcasts them to other users.
+ - Each user's drawing operations are synchronized, so everyone sees the same live canvas.
+
+ - **Step 2: Saving the Canvas**
+ - On a regular basis the worker service will send a **snapshot of the canvas** (or the entire Yjs document) to **S3**. This can include data about the shapes, their positions, colors, and any other relevant canvas data.
+ - The snapshot can be stored as a **JSON object**, an image, or another format, depending on how tldraw chooses to serialize the data.
+
+ - **Step 3: Retrieving Saved Data**
+ - When a user returns to the drawing session or opens the application at a later time, the application queries **S3** for the last saved canvas snapshot.
+ - Once retrieved, the snapshot is loaded back into the application, allowing users to continue editing from where they left off.
+ - Redis can be used in the background to ensure that any new changes made by users are synchronized in real time while they are working on the canvas.
+
+6. **Scalability and Fault Tolerance:**
+ - **Redis Scaling**: As we are using Valkey, by default there will only be one primary Valkey instance and we will have two replica instances ready to jump in once the primary instance fails. But these two replica sets make sure, that Valkey is always available.
+ - **S3 Scaling**: S3 is designed to scale automatically and handle large amounts of storage without performance degradation. This makes it ideal for storing large or numerous drawing assets, like high-resolution images or full snapshots of large canvases.
+ - **Tldraw-server Scaling**: So far the number of pods the tldraw-server is deployed on is fixed and no load based scaling is applied so far.
+
+### Example Scenario:
+
+- **User A** and **User B** start a collaborative session in tldraw, and they can see each other's updates in real time (thanks to Redis).
+- After some time, the worker service saves the drawing to S3, and now the drawing is stored in S3 as a persistent snapshot.
+- **User B**, who was not connected when the session ended, can later load the canvas from S3, where the most recent version is stored.
+- Meanwhile, as new users join the session, **Redis** continues to handle the real-time synchronization of the drawing, ensuring smooth interaction.
+
+### Conclusion:
+
+In **tldraw**, **Redis** and **S3** are integrated to deliver a collaborative and scalable experience. Redis ensures real-time synchronization of drawing changes among multiple users, while S3 provides persistent and scalable storage for canvas data. This combination allows tldraw to offer seamless collaboration, persistent storage, and fault-tolerant handling of large-scale data.
+
+## Backend
+
+### Deployments
+
+Tldraw is deployed as a separate application from schoulcloud-server and consists of the following deployments :
+
+- tldraw-server-deployment - deployment for tldraw-server's instances.
+- tldraw-worker-deployment - deployment for worker's instances.
+- tldraw-client-deployment - deployment for tldraw-client's instances.
+
+### Tldraw-server code structure
+
+- tldraw-config.controller.ts - controller that exposes tldraw server configuration to be used by the tldraw client.
+- tldraw-document.controller.ts - controller that expose HTTP deletion method outside the tldraw-server application.
+- tldraw-document.service.ts - service used by TldrawDocumentController.
+- redis.service.ts - encapsulates the logic for creating and managing Redis instances, supporting both standalone and sentinel configurations, and integrates seamlessly with the NestJS framework.
+- ioredis.adapter.ts - encapsulates the logic for interacting with Redis, including defining custom commands and subscribing to channels. It leverages the ioredis library and integrates with the application's configuration and logging systems to provide a robust and flexible Redis adapter.
+- api.service.ts - API service for Redis.
+- ws.service.ts - Responsibe for Redis communication.
+- metrics.service.ts - service resonsible for storing application-level metrics.
+- worker.service.ts - responsible for persisting the current state of changed tldraw documents into the file storage.
+
+On the backend side we are also using Yjs library to store tldraw board in memory and to calculate diffs after the board is changed.
+
+## Frontend
+
+### Key Files
+
+- stores/setup.ts – this file provides a real-time collaboration environment for a drawing application using the WebSocket and Yjs libraries.
+- hooks/useMultiplayerState.ts – custom hook for managing multiplayer state.
+- App.tsx – main application component integrating Tldraw and multiplayer state.
+
+### Frontend Technologies
+
+The frontend of the project is built using React and leverages various libraries and tools for enhanced functionality. Here is an overview of the key frontend technologies:
+
+- React: A JavaScript library for building user interfaces.
+- Yjs: A real-time collaboration framework for synchronizing shared state.
+- Tldraw: A library for drawing functionalities in the application. We use the old version of tldraw: https://github.com/tldraw/tldraw-v1, after the tldraw team releases the official update of the new version, we will work on the new version and integrate it with the needs of our users.
+
+### State Managment
+
+1. Yjs is integrated into the project for real-time collaboration. The central state (shapes, bindings, assets) is managed using Yjs maps.
+2. store.ts handles the configuration of Yjs, WebSocket connections, and provides centralized maps for shapes, bindings, and assets
+3. useMultiplayerState.ts -This hook manages the multiplayer state, including loading rooms, handling file system operations, and updating Yjs maps:
+ - Mounting and handling changes in Tldraw App.
+ - Presence management and user updates.
+ - File system operations like opening and saving projects.
+
+#### useTldrawUiSanitizer.ts
+
+This hook is designed to observe changes in the DOM, specifically targeting certain buttons and a horizontal rule (< hr>), and hides them if they match a specific ID pattern. We hide this elements and left just only Language and Keyboard shortcuts.
+
+#### Event Handling
+ - onMount: Handles mounting of the Tldraw app.
+ - onChangePage: Manages page changes and updates Yjs maps.
+ - onUndo and onRedo: Handle undo and redo operations.
+ - onChangePresence: Manages presence changes in the collaborative environment.
+ - onAssetCreate: This function is triggered when a user attempts to upload an asset (like an image or a file).
+
+#### Useful links
+- https://tldraw.dev/ - documentation for the new version of tldraw
+
+- https://old.tldraw.com/ - tldraw live application
+
+- https://github.com/tldraw/tldraw-v1 - tldraw v1 repo
+
+- https://github.com/yjs/y-redis - code from this package was used to add Redis as a persistence to tldraw
+
+- https://discord.com/invite/SBBEVCA4PG discord channel with open questions and answers
+
+- https://grafana.dbildungscloud.dev/d/b6b28b2b-3129-4772-8102-e32981d2c2e3/devops-tldraw-metrics?orgId=1&refresh=1m&var-source=sc-dev-dbc&var-env=main&var-env=tldraw-debugging - grafana v
+
+- https://grafana.dbildungscloud.org/d/b6b28b2b-3129-4772-8102-e32981d2c2e0/devops-tldraw?orgId=1&from=now-6h&to=now&refresh=1m - grafana metrics
+
+- https://github.com/nimeshnayaju/yjs-tldraw - yjs with tldraw POC
+
+- https://github.com/yjs/y-websocket/tree/master/bin - yjs/y-websocket repo
+
+- https://github.com/erdtool/yjs-scalable-ws-backend/tree/main - Yjs scalable WS backend with redis example
+
+- https://teamchat.dbildungscloud.de/channel/G9hJWv92zXEESKK3X - rocketchat discussion "tldraw syncronisation for release again"
+
+- https://teamchat.dbildungscloud.de/group/SagK4sCyujhu6yZr8 - rocketchat discussion "Tldraw deployment"s
diff --git a/docs/tldraw-server/assets/Create_TLDRAW.drawio.png b/docs/tldraw-server/assets/Create_TLDRAW.drawio.png
new file mode 100644
index 0000000..21e86cb
Binary files /dev/null and b/docs/tldraw-server/assets/Create_TLDRAW.drawio.png differ
diff --git a/docs/tldraw-server/assets/Create_TLDRAW.drawio.svg b/docs/tldraw-server/assets/Create_TLDRAW.drawio.svg
new file mode 100644
index 0000000..6ad4761
--- /dev/null
+++ b/docs/tldraw-server/assets/Create_TLDRAW.drawio.svg
@@ -0,0 +1,47 @@
+
+
+
+
diff --git a/docs/tldraw-server/assets/Delete_TLDRAW.drawio.png b/docs/tldraw-server/assets/Delete_TLDRAW.drawio.png
new file mode 100644
index 0000000..0b835f9
Binary files /dev/null and b/docs/tldraw-server/assets/Delete_TLDRAW.drawio.png differ
diff --git a/docs/tldraw-server/assets/Delete_TLDRAW.drawio.svg b/docs/tldraw-server/assets/Delete_TLDRAW.drawio.svg
new file mode 100644
index 0000000..5fa2c68
--- /dev/null
+++ b/docs/tldraw-server/assets/Delete_TLDRAW.drawio.svg
@@ -0,0 +1,47 @@
+
+
+
+
diff --git a/docs/tldraw-server/assets/Use_TLDRAW.drawio.png b/docs/tldraw-server/assets/Use_TLDRAW.drawio.png
new file mode 100644
index 0000000..0a48b69
Binary files /dev/null and b/docs/tldraw-server/assets/Use_TLDRAW.drawio.png differ
diff --git a/docs/tldraw-server/assets/Use_TLDRAW.drawio.svg b/docs/tldraw-server/assets/Use_TLDRAW.drawio.svg
new file mode 100644
index 0000000..519f195
--- /dev/null
+++ b/docs/tldraw-server/assets/Use_TLDRAW.drawio.svg
@@ -0,0 +1,47 @@
+
+
+
+
diff --git a/docusaurus.config.js b/docusaurus.config.js
index 250a3a3..26d93d1 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -118,6 +118,10 @@ const config = {
label: 'schulcloud-client',
href: 'https://github.com/hpi-schul-cloud/schulcloud-client',
},
+ {
+ label: 'tldraw-server',
+ href: 'https://github.com/hpi-schul-cloud/tldraw-server',
+ },
{
label: 'end-to-end-tests',
href: 'https://github.com/hpi-schul-cloud/end-to-end-tests',