A full-featured real-time chat application inspired by Discord. This clone provides messaging, audio, and video chat capabilities using LiveKit, with user authentication handled by Clerk. Built with Next.js, Prisma, and Tailwind CSS for a responsive and modern user interface.
Live Demo: https://discord-clone-rn.vercel.app
- Real-Time Messaging: Instantly send and receive messages with auto-scroll to the latest.
- Audio/Video Chat: Audio and video call functionality powered by LiveKit.
- User Authentication: Secure, seamless authentication using Clerk.
- Persistent Chat History: All message data is saved to the database using Prisma ORM.
- Responsive UI: Built with Tailwind CSS to provide a smooth experience on both mobile and desktop.
- Frontend: Next.js, React, Tailwind CSS
- Backend: Node.js, Express, LiveKit
- Database: Prisma ORM (supports PostgreSQL, MySQL, etc.)
- Authentication: Clerk
- Real-Time: WebSocket, Socket.IO
- Hosting: Vercel
- Node.js and npm installed
- PostgreSQL or another compatible database
- Clerk account for authentication
- LiveKit account for video/audio integration
-
Clone the repository:
git clone https://github.com/yourusername/discord-clone.git cd discord-clone -
Install dependencies:
npm install
-
Environment Variables: Create a
.envfile in the root directory and add the following variables:DATABASE_URL=<your_database_url> LIVEKIT_API_KEY=<your_livekit_api_key> LIVEKIT_SECRET=<your_livekit_secret> CLERK_FRONTEND_API=<your_clerk_frontend_api> CLERK_API_KEY=<your_clerk_api_key> NEXT_PUBLIC_CLERK_FRONTEND_API=<your_clerk_frontend_api> -
Database Setup: Run Prisma migrations to create the necessary tables.
npx prisma migrate dev
-
Start the development server:
npm run dev
-
Access the app: Open your browser and go to
http://localhost:3000to view the app.
- Login/Register: Users must authenticate via Clerk to access chat rooms.
- Chat: Enter any conversation and start messaging in real time.
- Video Chat: Join a video or audio chat session within a room.
- Message History: View previous messages and experience auto-scroll to the latest message.
- GET
/api/livekit: Retrieves a LiveKit token for audio/video chat. - POST
/api/messages: Adds a new message to a conversation. - DELETE
/api/messages/:id: Deletes a message by ID.
- Clerk Setup: Ensure your Clerk API keys are properly configured in
.env. - Error Handling: Basic error handling is implemented, but improvements are welcome!
- Contribution: Contributions are welcome! Please open a pull request or issue if you'd like to contribute.