build me a app like omegle for college students that uses their email to verify that they are in college and once inside the app they can connect with other students on the app and chat with them throuhg text and video. Add full functionality so that when i deploy it and send it to someone we both can see each other and talk with audio and video
I'll help you build a college student video chat app similar to Omegle. This will be a comprehensive application with email verification, real-time chat, and video calling capabilities.
First, let's set up the database schema for our application:
-- Create users table
CREATE TABLE IF NOT EXISTS users (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
email TEXT UNIQUE NOT NULL,
college_domain TEXT NOT NULL,
college_name TEXT,
display_name TEXT,
is_verified BOOLEAN DEFAULT false,
is_online BOOLEAN DEFAULT false,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Create chat rooms table
CREATE TABLE IF NOT EXISTS chat_rooms (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
user1_id UUID REFERENCES users(id) ON DELETE CASCADE,
user2_id UUID REFERENCES users(id) ON DELETE CASCADE,
is_active BOOLEAN DEFAULT true,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
ended_at TIMESTAMP WITH TIME ZONE
);
-- Create messages table
CREATE TABLE IF NOT EXISTS messages (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
room_id UUID REFERENCES chat_rooms(id) ON DELETE CASCADE,
sender_id UUID REFERENCES users(id) ON DELETE CASCADE,
content TEXT NOT NULL,
message_type TEXT DEFAULT 'text',
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Create waiting queue table
CREATE TABLE IF NOT EXISTS waiting_queue (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
user_id UUID REFERENCES users(id) ON DELETE CASCADE UNIQUE,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Add indexes for better performance
CREATE INDEX IF NOT EXISTS idx_users_email ON users(email);
CREATE INDEX IF NOT EXISTS idx_users_online ON users(is_online);
CREATE INDEX IF NOT EXISTS idx_chat_rooms_active ON chat_rooms(is_active);
CREATE INDEX IF NOT EXISTS idx_messages_room ON messages(room_id, created_at);
CREATE INDEX IF NOT EXISTS idx_waiting_queue_created ON waiting_queue(created_at);