A video chatroom platform where usernames are chatrooms. Built with Next.js 14, Convex, Clerk, and WebRTC.
- Username = Chatroom: Each user's username becomes their own chatroom (e.g.,
ezchat.cam/JOHN) - Username Rules: ALL CAPS letters only (A-Z), no numbers or special characters
- Video Chat: WebRTC-powered video with auto-sized grid layout
- Text Chat: Real-time messaging with role-based permissions
- Role-Based System: Four distinct roles with specific capabilities
- Can kick, close, and ban anyone
- Assign moderators by adding users to moderator list
- Assign regular status to users
- Full control over their chatroom
- Can kick and ban regulars and guests
- Assign regular status to users
- Cannot affect other moderators or the owner
- Can send messages in text chat
- Can use camera and watch streams
- Basic participation rights
- Can only watch and use camera
- Cannot send messages in main text chat
- Limited interaction
- Visible in userlist but no role symbol
- Immune to all room owner/moderator actions
- Can issue site-wide bans with memo field
- Administrative oversight capabilities
Superuser (Hidden)
- Completely invisible in chatroom userlist
- Full administrative access
- Four accounts: AI Assistant, Site Owner, Future Bot, Future COO
- Maximum resolution: 360p (capped for performance)
- Free Tier: 4ร3 cam grid (12 cameras max)
- Paid Tiers (Pro/Extreme/Gold): 5ร4 cam grid (20 cameras max)
- No microphone - camera only (forced camera selection)
- Auto-sized cams based on participant count
- Discord-like layout: userlist (left), cams (center), chat (right)
- Owner/Moderators:
mtag - Regulars:
rtag - Guests: No tag
- Site Admins: No tag (stealth)
- Upgraded paid accounts (Gold/Extreme/Pro)
- Room owners and moderators
- Regulars
- Guests and site admins
- Coded but disabled for free tier
- Premium feature for Pro/Extreme/Gold subscribers
- Within-chatroom messaging system
- Manual ban list management (add/remove)
- Kick users from chatroom
- Permanent bans with optional reason
- Site-wide bans (admins only)
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Authentication: Clerk
- Backend/Database: Convex
- UI Components: ShadCN UI
- Styling: TailwindCSS
- Animations: GSAP
- Video: WebRTC (simple-peer)
- Billing: polar.sh (integration ready)
- Node.js 18+ and npm
- Clerk account (for authentication)
- Convex account (for backend)
-
Clone the repository
cd EzChat -
Install dependencies
npm install
-
Set up Clerk
- Go to clerk.com and create a new application
- Copy your API keys
- Enable username-based authentication
-
Set up Convex
npx convex dev
- Follow the prompts to create/link your Convex project
- This will generate your
CONVEX_DEPLOYMENTvalues
-
Configure environment variables
Create
.env.localfile:CONVEX_DEPLOYMENT=dev:xxxxx NEXT_PUBLIC_CONVEX_URL=https://xxxxx.convex.cloud NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxxxx CLERK_SECRET_KEY=sk_test_xxxxx
-
Set up Clerk webhook for Convex sync
- In Clerk Dashboard, go to Webhooks
- Add endpoint:
https://xxxxx.convex.site/clerk - Subscribe to:
user.created,user.updated,user.deleted
-
Run development server
npm run dev
-
Open your browser Navigate to
http://localhost:3000
# Terminal 1
npm run convex:dev
# Terminal 2
npm run devnpm run build
npm startEzChat/
โโโ app/
โ โโโ [roomname]/ # Dynamic chatroom routes
โ โโโ layout.tsx # Root layout with providers
โ โโโ page.tsx # Homepage (directory)
โ โโโ globals.css # Global styles
โโโ components/
โ โโโ features/
โ โ โโโ chatroom.tsx # Main chatroom component
โ โ โโโ chatroom-directory.tsx # Homepage directory
โ โ โโโ user-list.tsx # Participant list
โ โ โโโ video-grid.tsx # WebRTC video grid
โ โ โโโ chat-panel.tsx # Text chat
โ โโโ ui/ # ShadCN components
โโโ convex/
โ โโโ schema.ts # Database schema
โ โโโ users.ts # User functions
โ โโโ chatrooms.ts # Chatroom functions
โ โโโ messages.ts # Messaging functions
โ โโโ moderation.ts # Moderation functions
โ โโโ webrtc.ts # WebRTC signaling
โโโ lib/
โ โโโ utils.ts # Helper functions
โโโ providers/
โโโ convex-client-provider.tsx
clerkId: Unique Clerk identifierusername: ALL CAPS chatroom nametier: free | pro | extreme | goldrole: user | siteadmin | superuserisSuperuser: Hidden from userlist
name: Username (chatroom identifier)ownerId: Reference to userisActive: Boolean status
roomId: Chatroom referenceuserId: User referencerole: owner | moderator | regular | guestisOnline: Current status
roomId: Chatroom referenceuserId: Banned userbannedById: Admin who bannedisSitewideBan: Global vs room-specificreason: Optional memo
- Sign in with Clerk authentication
- Claim username (ALL CAPS, letters only)
- Your chatroom is created at
ezchat.cam/YOURNAME - Share your link for others to join
- Grant camera access to participate
- Assign moderators from userlist
- Promote guests to regulars (enables chat)
- Kick/ban disruptive users
- Manage ban list manually
- Promote guests to regulars
- Kick regulars and guests
- Ban regulars and guests
- Cannot affect owner or other mods
- Integration with polar.sh for billing
- Direct messaging for paid tiers
- Additional GSAP animations
- Screen sharing capabilities
- Recording functionality
- Custom room themes
- Mobile app (React Native)
| Variable | Description | Required |
|---|---|---|
NEXT_PUBLIC_CONVEX_URL |
Convex deployment URL | Yes |
CONVEX_DEPLOYMENT |
Convex deployment ID | Yes |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
Clerk public key | Yes |
CLERK_SECRET_KEY |
Clerk secret key | Yes |
- Ensure HTTPS or localhost
- Check browser permissions
- Verify no other app is using camera
- Verify Clerk webhook is configured
- Check Convex logs for errors
- Ensure users have claimed usernames
- Verify user has regular+ role
- Check Convex function logs
- Ensure user is online in room
MIT License - feel free to use for your own projects!
Contributions welcome! Please follow these guidelines:
- Fork the repository
- Create feature branch
- Follow existing code style
- Test thoroughly
- Submit pull request
Built with โค๏ธ using modern web technologies:
- Next.js by Vercel
- Convex for backend
- Clerk for auth
- ShadCN UI for components
- simple-peer for WebRTC
Note: This is version 1.0. Future versions will include polar.sh billing integration and additional features.