A collaborative pixel drawing board inspired by r/place, built with Next.js and MongoDB. Users can place pixels on a shared canvas with rate limiting to ensure fair participation.
- Collaborative Drawing: Share a canvas with other users in real-time
- Rate Limiting: Configurable cooldown period between pixel placements (default: 5 seconds)
- Authentication: Casdoor integration for user management
- Token System: Each user gets a unique drawing token
- Color Palette: Predefined colors plus custom color picker
- Persistent Storage: All drawings are saved to MongoDB
- Each user can place one pixel at a time
- After placing a pixel, you must wait for the cooldown period before placing another
- The cooldown duration is configurable via
DRAW_DELAY_MSenvironment variable - Authentication is required to draw on the canvas
Create a .env file that looks like .env.example in the root directory with the following variables:
# Server Configuration
NODE_ENV=production
PORT=3000
# MongoDB Configuration
MONGO_URI=mongodb://localhost:27017/place
# Casdoor Authentication
CASDOOR_SERVER_URL=https://your-casdoor-instance.com
CASDOOR_CLIENT_ID=your_client_id
CASDOOR_CLIENT_SECRET=your_client_secret
CASDOOR_APP_NAME=your_app_name
CASDOOR_ORGANIZATION_NAME=your_organization
# Drawing Configuration
META_TITLE=DrawPlace
META_DESCRIPTION=Welcome to DrawPlace! Collaborate with art enthusiasts to create a masterpiece together!
DRAW_DELAY_MS=5000
DRAW_MAX_POINTS=24
CANVAS_WIDTH=620
CANVAS_HEIGHT=300- Node.js 20+ (for npm/pnpm installation)
- Docker and Docker Compose (for Docker installation)
- MongoDB instance (or use the provided Docker Compose setup)
- Casdoor instance for authentication
-
Clone the repository
git clone https://github.com/HeZeBang/DrawingPlace.git cd DrawingPlace -
Install dependencies
pnpm install # or npm install -
Configure environment variables
cp .env.example .env # Edit .env with your configuration -
Build the application
pnpm build # or npm run build -
Start the application
pnpm start # or npm start -
Development mode
pnpm dev # or npm run dev
The application will be available at http://localhost:3000
-
Clone the repository
git clone https://github.com/HeZeBang/DrawingPlace.git cd DrawingPlace -
Configure environment variables
Create a
.envfile with your configuration or set environment variables directly:export CASDOOR_SERVER_URL=https://your-casdoor-instance.com export CASDOOR_CLIENT_ID=your_client_id export CASDOOR_CLIENT_SECRET=your_client_secret export CASDOOR_APP_NAME=your_app_name export CASDOOR_ORGANIZATION_NAME=your_organization
-
Start with Docker Compose
docker-compose -f docker-compose.prod.yml up -d
This will start both the application and MongoDB instance.
-
Stop the services
docker-compose -f docker-compose.prod.yml down
-
Build the Docker image or pull from ghcr.io
You can get prebuilt image from here.
docker build -t drawingplace . -
Run the container
docker run -d \ -p 3000:3000 \ -e MONGO_URI=mongodb://your-mongo-host:27017/place \ -e CASDOOR_SERVER_URL=https://your-casdoor-instance.com \ -e CASDOOR_CLIENT_ID=your_client_id \ -e CASDOOR_CLIENT_SECRET=your_client_secret \ -e CASDOOR_APP_NAME=your_app_name \ -e CASDOOR_ORGANIZATION_NAME=your_organization \ -e DRAW_DELAY_MS=5000 \ --name drawingplace \ drawingplace
The application will be available at http://localhost:3000
- Framework: Next.js 16 (App Router)
- Runtime: Node.js 20
- Database: MongoDB 7.0
- Authentication: Casdoor
- Styling: Tailwind CSS
- UI Components: Radix UI, shadcn/ui
- Package Manager: pnpm
This project is open source and available under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is based from 4074/DrawingPlace, forked initially from ShanghaitechGeekPie repo.