🎨
Collanvas — Your whole team, changing the world one stroke at a time With an online whiteboard, you can brainstorm
Overview video
How it works
How the data is stored:
Data | Description | Type |
---|---|---|
Color | The color of the stroke | String (HEX) |
Thickness | The thickness of the stroke | Number (1 to 10) |
Type | Whether stroke is pen or eraser | String ('Pen' or 'Eraser') |
Points | The points that make up the stroke | {x: Number,y: Number}[] |
Keys are generates like canvas:{roomKey}
. For each generated key, data is stored by running the ARRAPPEND
command like: JSON.ARRAPPEND canvas:{roomKey} {...data}
.
Data | Description | Type |
---|---|---|
Content | Content of the sent message | String |
Username | Name of the user that sent the message | String |
Color | Unique color chosen by the user that sent the message | String (HEX) |
Keys are generates like messages:{roomKey}
. For each generated key, data is stored by running the ARRAPPEND
command like: JSON.ARRAPPEND messages:{roomKey} {...data}
.
How the data is accessed:
When the user enters a new room, a PUT request is sent to the server with the room key.
- If the room exists,
- We return the existing data to the user by running
JSON.GET
on themessages
andcanvas
JSON documents.
- We return the existing data to the user by running
- Otherwise,
- We instantiate a new room by creating those two JSON documents with the command
JSON.SET
and fill them with two empty arrays, respectively.
- We instantiate a new room by creating those two JSON documents with the command
For real-time funcionality, Redis Pub/Sub is used to transmit data between existing users without running JSON.GET
every time that happens.
How to run it locally?
Prerequisites
- Node - v12.19.0
- NPM - v6.14.8
Local installation
Get started by installing Redis on your machine.
Next, go to the project's root directory and run the following commands in order:
npm install
oryarn
npm run dev
oryarn dev
Open your browser and navigate to localhost:3000
. You're running a local version of Redis, so you won't have access to the production database.
Deployment
To make deploys work, you need to create free account on Redis Cloud
Heroku
Vercel
Collanvas is using WebSockets, which are unforunately unsupported by Vercel's Serverless Functions.
More Information about Redis Stack
Here some resources to help you quickly get started using Redis Stack. If you still have questions, feel free to ask them in the Redis Discord or on Twitter.
Getting Started
- Sign up for a free Redis Cloud account using this link and use the Redis Stack database in the cloud.
- Based on the language/framework you want to use, you will find the following client libraries:
- Redis OM .NET (C#)
- Watch this getting started video
- Follow this getting started guide
- Redis OM Node (JS)
- Watch this getting started video
- Follow this getting started guide
- Redis OM Python
- Watch this getting started video
- Follow this getting started guide
- Redis OM Spring (Java)
- Watch this getting started video
- Follow this getting started guide
- Redis OM .NET (C#)
The above videos and guides should be enough to get you started in your desired language/framework. From there you can expand and develop your app. Use the resources below to help guide you further:
- Developer Hub - The main developer page for Redis, where you can find information on building using Redis with sample projects, guides, and tutorials.
- Redis Stack getting started page - Lists a