realtimecursor
Version:
Real-time collaboration system with cursor tracking and approval workflow
126 lines (85 loc) • 2.43 kB
Markdown
# Self-Hosting Guide
This guide explains how to self-host the RealtimeCursor backend server.
## Requirements
- Node.js 14+
- npm or yarn
- Git (optional)
## Quick Start
### 1. Get the Code
```bash
# Clone the repository
git clone https://github.com/sourabhpunase/realtimecursor.git
cd realtimecursor
# Or download and extract the ZIP file
```
### 2. Install Dependencies
```bash
npm install
```
### 3. Start the Server
```bash
npm start
```
The server will start on port 3000 by default. You can change this by setting the `PORT` environment variable:
```bash
PORT=8080 npm start
```
## Configuration
### Environment Variables
- `PORT`: The port to run the server on (default: 3000)
- `FRONTEND_URL`: Allowed origins for CORS (default: http://localhost:5173,http://localhost:8000)
### Custom Configuration
Create a `.env` file in the root directory:
```
PORT=8080
FRONTEND_URL=https://yourdomain.com
```
## Docker Deployment
### Using docker-compose
```bash
# Build and start the containers
docker-compose up -d
```
### Using Docker directly
```bash
# Build the Docker image
docker build -t realtimecursor .
# Run the container
docker run -p 3000:3000 realtimecursor
```
## Integrating with Your Application
Update your client-side code to point to your self-hosted server:
```javascript
const cursorClient = new RealtimeCursor({
apiUrl: 'https://your-server-url.com',
projectId: 'your-project-id',
user: {
id: 'user-123',
name: 'John Doe'
}
});
```
## Securing Your Server
For production use, consider:
1. Adding SSL/TLS (HTTPS)
2. Setting up a reverse proxy (Nginx, Apache)
3. Implementing proper authentication
4. Rate limiting requests
## Troubleshooting
### Connection Issues
If clients can't connect to your server:
1. Check that your server is running
2. Verify that the `FRONTEND_URL` includes your client's origin
3. Check for firewall or network issues
4. Ensure your server is accessible from the client's network
### Performance Optimization
For high-traffic applications:
1. Use a process manager like PM2
2. Set up load balancing
3. Consider using Redis for socket.io adapter
4. Monitor server resources
## Support
If you need help with self-hosting, please:
1. Check the [GitHub issues](https://github.com/sourabhpunase/realtimecursor/issues)
2. Join our [Discord community](https://discord.gg/realtimecursor)
3. Contact us at support@realtimecursor.com