DeepSeek Clone is a web application designed to provide an interactive chat interface powered by AI. It allows users to engage in conversations, manage chats, and perform actions like renaming or deleting chats. The application is built using modern web technologies such as React, Next.js, and Node.js.
Visit the π LINK π
- AI-Powered Chat: Users can send prompts and receive responses from an AI model.
- Chat Management: Users can rename or delete chats.
- Real-Time Updates: Chat messages are updated dynamically in the UI.
- User Authentication: Secure user authentication and session management.
- Responsive Design: Optimized for both desktop and mobile devices.
- Frontend: React, Next.js
- Backend: Node.js, Clerk
- Database: MongoDB
- Styling: Tailwind CSS
- State Management: Context API
- Notifications: React Hot Toast
- API Integration: Axios
deepseek-clone/
βββ app/
β βββ api/
β β βββ chat/
β β β βββ ai/ # AI chat endpoint
β β β βββ rename/ # Rename chat endpoint
β β β βββ delete/ # Delete chat endpoint
β βββ clerk/ # Clerk webhook integration
βββ components/
β βββ ChatLabel.jsx # Chat label component
β βββ PromptBox.jsx # Chat input box component
β βββ Sidebar.jsx # Sidebar for chat navigation
βββ context/
β βββ AppContext.jsx # Global state management
βββ config/
β βββ db.js # MongoDB connection configuration
βββ models/
β βββ User.js # User model schema
βββ public/
β βββ assets/ # Static assets (icons, images)
βββ styles/
β βββ globals.css # Global styles
βββ README.md # Project documentation
-
Clone the repository:
git clone https://github.com/elyse502/deepseek-clone.git cd deepseek-clone
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add the following:# π Frontend (Public) Clerk Key β starts with pk_... NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your-clerk-publishable-key # π Backend (Secret) Clerk Key β starts with sk_... CLERK_SECRET_KEY=your-clerk-secret-key # π Your MongoDB connection string MONGODB_URI=your-mongodb-connection-string # π Secret key used for signing webhooks (like SVIX) SIGNING_SECRET=your-svix-signing-secret # π API key for DeepSeek or any AI/chat API service DEEPSEEK_API_KEY=your-deepseek-api-key
-
Run the development server:
npm run dev
-
Open the application in your browser:
http://localhost:3000
- Method: POST
- Description: Sends a user prompt to the AI model and retrieves a response.
- Request Body:
{ "chatId": "string", "prompt": "string" }
- Response:
{ "success": true, "data": { "content": "AI response" } }
- Method: POST
- Description: Renames a chat.
- Request Body:
{ "chatId": "string", "name": "string" }
- Response:
{ "success": true, "message": "Chat renamed successfully" }
- Method: POST
- Description: Deletes a chat.
- Request Body:
{ "chatId": "string" }
- Response:
{ "success": true, "message": "Chat deleted successfully" }
- Displays individual chat labels in the sidebar.
- Allows renaming and deleting chats via a dropdown menu.
- Provides a text area for users to input prompts.
- Handles sending prompts to the AI and displaying responses.
- Displays a list of chats.
- Allows users to select a chat to view or interact with.
The AppContext
provides global state management for the application, including:
user
: Current logged-in user.chats
: List of user chats.selectedChat
: Currently selected chat.setChats
: Function to update the list of chats.setSelectedChat
: Function to update the selected chat.
- Ensure the
selectedChat
state is properly initialized to avoid errors when accessing its properties. - Verify that the
/api/chat/rename
and/api/chat/delete
endpoints are functioning correctly.
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Make your changes and commit them:
git commit -m "Add feature-name"
- Push to your branch:
git push origin feature-name
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or support, please contact:
- NIYIBIZI ElysΓ©eπ¨πΏβπ» | Github | Linkedin | Twitter.
- Email: elyseniyibizi502@gmail.com