A modern, real-time video chat application built with Next.js, WebRTC, and PostgreSQL.
- Real-time video and audio communication
- Text chat with message history
- Room-based communication
- Modern, responsive UI
- Secure WebRTC connections
- Node.js 18 or later
- PostgreSQL database
- DigitalOcean account (for deployment)
Create a .env file in the root directory with the following variables:
# Database
DATABASE_URL=postgresql://username:password@localhost:5432/lookingglass
# WebRTC
ICE_SERVER_URL=your_turn_server_url
# Environment
NODE_ENV=development-
Install dependencies:
npm install
-
Set up the database:
# Create the database createdb lookingglass # Initialize the database tables npm run init-db
-
Start the development server:
npm run dev
-
Open http://localhost:3000 in your browser.
The application uses a simple PostgreSQL schema with two main tables:
CREATE TABLE rooms (
id TEXT PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);CREATE TABLE messages (
id SERIAL PRIMARY KEY,
room_id TEXT REFERENCES rooms(id),
content TEXT NOT NULL,
sender TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);-
Create a DigitalOcean account if you haven't already.
-
Create a new PostgreSQL database:
- Go to Databases in your DigitalOcean dashboard
- Create a new database cluster
- Note down the connection details
-
Deploy the application:
- Push your code to GitHub
- Create a new app in DigitalOcean App Platform
- Connect your GitHub repository
- Set the environment variables:
DATABASE_URLICE_SERVER_URLNODE_ENV=production
-
The application will be automatically deployed and available at your DigitalOcean app URL.
- Verify your
DATABASE_URLis correct - Ensure the database is running and accessible
- Check database user permissions
- Verify your TURN server is working
- Check browser console for WebRTC errors
- Ensure you're using HTTPS in production
- Check DigitalOcean App Platform logs
- Verify environment variables are set correctly
- Ensure all dependencies are in package.json
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.