A simplified ChatGPT clone that implements comprehensive message branching functionality, allowing users to edit both their prompts and AI responses to create separate conversation branches.
- Basic chat functionality with AI responses
- User message editing with branching
- AI response editing with branching
- Visual navigation between different branches
- Real-time state management
- Persistent storage with Supabase
- Next.js
- TypeScript
- Supabase
- Zustand
- Tailwind CSS
- Clone the repository:
git clone <repository-url>
cd chatgpt-clone- Install dependencies:
npm install-
Set up Supabase:
- Create a new project at Supabase
- Copy the SQL from
supabase/schema.sqland run it in the SQL editor - Copy your project URL and anon key
- Create a
.env.localfile with your Supabase credentials:NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
-
Run the development server:
npm run dev- Open http://localhost:3000 in your browser.
src/
├── app/ # Next.js app directory
├── components/ # React components
├── lib/ # Utility libraries
├── store/ # State management
├── types/ # TypeScript types
└── utils/ # Helper functions
id: UUID (Primary Key)email: TEXTcreated_at: TIMESTAMP
id: UUID (Primary Key)title: TEXTuser_id: UUID (Foreign Key)created_at: TIMESTAMPupdated_at: TIMESTAMP
id: UUID (Primary Key)conversation_id: UUID (Foreign Key)parent_branch_id: UUID (Foreign Key)created_at: TIMESTAMP
id: UUID (Primary Key)content: TEXTrole: TEXT ('user' | 'assistant')parent_id: UUID (Foreign Key)conversation_id: UUID (Foreign Key)branch_id: UUID (Foreign Key)created_at: TIMESTAMP
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.