Prerequisites
Before starting local development, ensure you have the following installed:Node.js 20+
Watch N Chill requires Node.js 20 or later.Download from nodejs.org or use a version manager like nvm.
Package Manager
Install either Bun (recommended) or use npm that comes with Node.js.Bun (recommended for faster installs):npm is included with Node.js installation.
Installation
Configure Environment
Create a Add your configuration:
.env.local file in the project root:.env.local
For local development, only
REDIS_URL is required. Other variables have sensible defaults.Open in Browser
Navigate to http://localhost:3000
Development Workflow
Hot Reload
The application usestsx to run the custom server with hot reload:
- Frontend changes: Next.js automatically reloads React components
- Backend changes:
tsxwatchesserver.tsand backend files for changes - Socket.IO events: Restart the dev server to apply Socket.IO handler changes
Project Structure
Available Scripts
Redis Connection Verification
Verify your Redis connection is working:Troubleshooting
Redis Connection Failed
Check Redis is running:Port Already in Use
If port 3000 is already in use:.env.local
http://localhost:3001.
Socket.IO Connection Issues
If Socket.IO fails to connect:- Check browser console for errors
- Verify Socket.IO path is correct:
/api/socket/io - Ensure no proxy/firewall is blocking WebSocket connections
- Check CORS settings (should auto-configure for localhost in dev)
Hot Reload Not Working
If changes aren’t being picked up:Testing Your Changes
Create a Room
- Go to http://localhost:3000
- Click “Create Room”
- Copy the room ID and host token
Join from Another Tab
- Open a new incognito/private window
- Navigate to the same URL
- Click “Join Room” with the room ID
Development Best Practices
- Rate limiting is disabled in development mode for easier testing
- CORS is auto-configured for
localhost:3000in development - Use browser DevTools Network tab to debug Socket.IO events
- Check server console logs for backend debugging
Next Steps
Environment Variables
Learn about all available configuration options
Docker Setup
Run the full stack with Docker Compose
Production Deployment
Deploy to production platforms
Architecture
Understand the system architecture