A simple WebSocket server for collaborative drawing with Excalidraw
Warning
Current project major version is 0.x. It means that the project is still in development and may have breaking changes in the future.
This is an unofficial implementation of the Excalidraw collaboration server. It uses WebSockets to communicate between clients and broadcast the changes to all connected clients.
- Real-time collaboration with multiple users
- Authentication and validation with JWT
- Configurable storage (currently only supports in-memory storage)
The server uses .yaml configuration file to set up. You can find an example configuration file here.
apps:
log_level: "DEBUG"
rest:
port: 8080
validation:
jwt_header_name: "<YOUR_JWT_HEADER_NAME>"
jwt_validation_url: "<YOUR_JWT_VALIDATION_URL>"
board_validation_url: "<YOUR_BOARD_VALIDATION_URL>"
storage:
users:
type: "in-memory"
rooms:
type: "in-memory"
Currently, the apps
section contains the following configurations:
log_level
: The log level of the server. It can be one of the following:DEBUG
,INFO
(More levels will be added in the future).rest
: The REST API configuration.port
: The port of the REST API.validation
: The JWT validation configuration.jwt_header_name
: The name of the header, in whichExcaliroom
will set the JWT token from client.jwt_validation_url
: The URL to validate the JWT token, which will be used to authenticate the user.board_validation_url
: The URL to validate the access to the board with the JWT token.
The storage
section contains the following configurations:
users
: The user storage configuration. It specifies where the server will store the user data.type
: The type of the storage. Currently, onlyin-memory
is supported.
rooms
: The room storage configuration. It specifies where the server will store the room data.type
: The type of the storage. Currently, onlyin-memory
is supported.
To authenticate the user and validate the access to the board, you need to provide the URLs in the configuration file.
The Excaliroom
server requires 2 URLs:
-
jwt_validation_url
: The URL to validate the JWT token. TheExcaliroom
server will send aGET
request to this URL with the JWT token in the header. The server should return200 OK
if the token is valid and the following JSON response:{ "id": "<USER_ID>" }
The
id
will be used to identify the user. -
board_validation_url
: The URL to validate the access to the board with the JWT token. TheExcaliroom
server will send aGET
request to this URL with the JWT token in the header. The server should return200 OK
.
Currently, the server only supports in-memory
storage for users and rooms.
Warning
Currently, the Docker image from the Docker Hub is only available for linux/amd64 platform.
If you use another platform (e.g., linux/arm64), you can provide --platform
flag to the docker pull
command.
-
You can pull the Docker image from the Docker Hub:
docker pull icerzack/excaliroom:latest
Then, you can run the Docker container with the following command:
docker run -d -p 8080:8080 -v path/to/config.yaml:/config.yaml -e CONFIG_PATH="/config.yaml" icerzack/excaliroom:latest
-
You can build the Docker image by yourself with the following command:
docker build -f build/Dockerfile -e CONFIG_PATH="path/to/config.yaml" -t excaliroom .
Then, you can run the Docker container with the following command:
docker run -d -p 8080:8080 -v path/to/config.yaml:/config.yaml -e CONFIG_PATH="/config.yaml" excaliroom
You can use Docker Compose to run the server with the following docker-compose.yml
file:
services:
app:
image: icerzack/excaliroom:latest
environment:
- CONFIG_PATH=config.yaml
ports:
- "8080:8080"
volumes:
- ./config.yaml:/config.yaml
Then, you can run the server with the following command:
docker-compose up -d
Set the environment variable CONFIG_PATH
to the path of the configuration file and build the binary:
export CONFIG_PATH="path/to/config.yaml"
go build -o excaliroom main.go
Then, you can run the binary:
./excaliroom
Check the docs directory of this repo for the guides on how to use and integrate the Excaliroom
server with your JavaScript application.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (git checkout -b feature/AmazingFeature)
- Commit your Changes (git commit -m 'Add some AmazingFeature')
- Push to the Branch (git push origin feature/AmazingFeature)
- Open a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.