A production-ready Next.js application for hosting virtual birthday celebrations with real-time video calls, live chat, and interactive features.
Den Day is a web-based platform that enables users to host and join virtual birthday parties. Built with modern web technologies, it provides a seamless video conferencing experience with real-time communication capabilities.
- Party Management: Create and join virtual parties using unique 6-character room codes
- Video Conferencing: WebRTC-powered peer-to-peer video streaming with multiple participants
- Real-time Chat: Instant messaging system with all party participants
- Interactive Celebrations: Virtual cake cutting ceremony with animations and confetti effects
- Media Controls: Toggle microphone and camera on/off during calls
- Responsive Design: Modern UI optimized for desktop and mobile devices
- Dynamic Grid Layout: Automatic video layout adjustment based on participant count
- Server-side signaling with Socket.io for production-grade connectivity
- Secure room validation and management
- Connection status indicators
- Participant tracking and notifications
- Custom scrollbar styling and smooth animations
- Framework: Next.js 14 with App Router
- Language: TypeScript
- Styling: Tailwind CSS with custom animations
- UI Components: shadcn/ui component library
- State Management: Zustand
- Icons: Lucide React
- WebRTC: SimplePeer for peer-to-peer connections
- Signaling Server: Socket.io with Express
- Real-time Events: Socket.io for chat and signaling
- Frontend Hosting: Vercel
- Backend Hosting: Railway
- Environment Management: Environment variables for configuration
- Application: https://den-day.vercel.app
- WebSocket Server: https://den-day-production.up.railway.app
- Node.js 18 or higher
- npm or yarn package manager
- Modern web browser with WebRTC support
- Clone the repository:
git clone https://github.com/ChilliRoger/den-day.git
cd den-day- Install dependencies:
npm install- Configure environment variables:
Create a .env.local file:
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_SOCKET_URL=http://localhost:3001- Start the development servers:
npm run devThis will start both the Next.js frontend (port 3000) and Socket.io server (port 3001).
- Open http://localhost:3000 in your browser
- Navigate to the homepage
- Click "Create New Party"
- Enter your name as the host
- Grant camera and microphone permissions when prompted
- Share the generated room code with participants
- Use the cake cutting button to start the celebration
- Navigate to the homepage
- Click "Join Existing Party"
- Enter the room code provided by the host
- Enter your name
- Grant camera and microphone permissions
- You will be connected to the party room
To test multi-user functionality on a single computer:
- Create a party in a regular browser window
- Copy the room code
- Open a new incognito/private window
- Join the party using the copied room code
- Grant permissions in both windows
Note: Using incognito mode simulates different users on the same device.
den-day/
├── app/
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Homepage
│ ├── globals.css # Global styles
│ └── party/[roomCode]/
│ └── page.tsx # Party room
├── components/
│ ├── ui/ # UI components
│ ├── party/
│ │ ├── VideoGrid.tsx # Video grid layout
│ │ ├── ChatArea.tsx # Chat interface
│ │ └── CakeCutting.tsx # Cake animation
│ └── VideoCallGuide.tsx # User guide
├── server/
│ └── index.js # Socket.io server
├── lib/
│ ├── signaling.ts # Socket.io client
│ ├── webrtc.ts # WebRTC management
│ └── utils.ts # Utilities
└── store/
└── partyStore.ts # State management
The video grid dynamically adjusts layout based on participant count:
- 1 participant: Full screen (600px height)
- 2 participants: 2-column grid (400px height)
- 3-4 participants: 2-column grid (300px height)
- 5-6 participants: 3-column grid (250px height)
- 7+ participants: 4-column grid (250px height)
- Signaling: Socket.io handles WebRTC signaling (offer/answer/ICE candidates)
- Peer Connections: SimplePeer establishes direct peer-to-peer connections
- Media Streams: Browser MediaDevices API captures audio/video
- State Management: Zustand maintains application state
- Real-time Updates: Socket.io broadcasts events to all participants
vercel --prodSet environment variables in Vercel dashboard:
NEXT_PUBLIC_SOCKET_URL: Your Socket.io server URL
railway upSet environment variables in Railway dashboard:
NEXT_PUBLIC_APP_URL: Your Vercel domainPORT: 8080 (or Railway's assigned port)
Client to Server:
create-room: Create a new party roomjoin-room: Join an existing roomoffer: Send WebRTC offeranswer: Send WebRTC answerice-candidate: Send ICE candidatechat-message: Send chat messagestart-cake-cutting: Initiate cake cutting
Server to Client:
room-created: Room creation confirmationroom-joined: Room join confirmationuser-joined: New participant notificationuser-left: Participant left notificationoffer: Receive WebRTC offeranswer: Receive WebRTC answerice-candidate: Receive ICE candidatechat-message: Receive chat messagecake-cutting-started: Cake cutting initiatedroom-closed: Room closure notification
GET /health: Server health checkGET /room/:roomCode: Room status information
Frontend (.env.local / .env.production):
NEXT_PUBLIC_APP_URL: Application URLNEXT_PUBLIC_SOCKET_URL: Socket.io server URL
Backend:
PORT: Server port (default: 3001)NEXT_PUBLIC_APP_URL: Allowed origin for CORS
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
WebRTC and MediaDevices API support required.
- Peer-to-peer connections minimize server load
- Dynamic grid layout optimizes rendering
- Efficient state management with Zustand
- Lazy loading of components
- Optimized WebRTC configurations with STUN servers
- Room code validation (6-character alphanumeric)
- CORS configuration for allowed origins
- Secure WebSocket connections (wss://)
- Environment variable management
- No persistent storage of media streams
- Verify Socket.io server is running
- Check environment variables are correctly set
- Ensure firewall allows WebRTC connections
- Review browser console for errors
- Grant camera and microphone permissions
- Check device settings in browser
- Test with browser's built-in media test
- Verify no other application is using the devices
- Confirm Socket.io connection is established
- Check network connectivity
- Review server logs for errors
Contributions are welcome. Please follow these guidelines:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a pull request
MIT License - See LICENSE file for details
- Next.js team for the framework
- shadcn/ui for component library
- SimplePeer for WebRTC abstraction
- Socket.io for real-time communication
For issues and feature requests, please use the GitHub issue tracker.
- 1.0.0: Initial production release
- WebRTC video conferencing
- Real-time chat
- Virtual cake cutting
- Socket.io signaling server
- Production deployment