The modern, open-source AI chat application.
Explore Features »
Getting Started
·
Deployment
·
Contributing
·
Issues
The open source ChatGPT alternative. You are in charge of your own data, conversations, and AI models.
ChatGPT and other AI chat tools are incredible. They've revolutionized how we interact with AI. We use them for work, learning, creative projects, and problem-solving. However, most tools are very limited in terms of control, customization, and data ownership.
That's where T2Chat comes in. Self-hosted or hosted by us. Multi-model by design. API-driven and ready to be deployed on your own domain. Full control of your conversations and data.
- 🤖 Multi-Model AI Support: Integration with multiple AI providers (OpenAI, Google, Groq, OpenRouter, etc.)
- 💬 Real-time Chat: Instant messaging with AI models using streaming responses
- 📱 Responsive Design: Beautiful UI that works seamlessly on desktop and mobile
- 🔐 Secure Authentication: User authentication with Better Auth and PostgreSQL
- 💾 Data Persistence: Chat history stored securely in Convex database
- 🎨 Customizable Interface: Dark/light themes with extensive customization options
- 🗂️ Advanced Chat Management: Organize, rename, share, and delete conversations
- 🔑 API Key Management: Secure storage and management of your API keys
- 🎤 Speech Features: Text-to-speech and speech recognition capabilities
- 📤 File Uploads: Support for file attachments via UploadThing
- 🔍 Smart Search: Search through your entire conversation history
- ⚙️ Comprehensive Settings: Extensive customization and personalization options
- 🌐 Easy Sharing: Share conversations with others securely
- 📊 Chat Analytics: Track your usage and conversation metrics
- 🔄 Chat Branching: Create conversation branches for different discussion paths
- ⚡ Optimized Performance: Fast loading and smooth interactions
- Next.js 15 - React framework with App Router
- React 19 - Latest React with concurrent features
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- Framer Motion - Smooth animations and transitions
- Radix UI - Accessible UI components
- Lucide React - Beautiful icon library
- Convex - Real-time backend-as-a-service
- Better Auth - Modern authentication solution
- Dexie - IndexedDB wrapper for local storage
- AI SDK - Unified AI provider interface
- OpenRouter - AI model routing and access
- Google AI - Gemini models
- Groq - Fast AI inference
- UploadThing - File upload service
- Prettier - Code formatting
To get a local copy up and running, please follow these simple steps.
Here is what you need to be able to run T2Chat.
- Node.js (Version: >=18.x)
- npm/yarn/pnpm (npm is used here might switch to pnpm)
If you want to enable any of the available AI integrations, you may want to obtain API keys for each provider. More details can be found below under the AI Providers section.
-
Clone the repository
git clone https://github.com/nyaughh/t2chat.git cd t2chat -
Install dependencies
npm install # or yarn install # or pnpm install
-
Set up environment variables
Create a
.env.localfile in the root directory:# Convex CONVEX_DEPLOYMENT=your-convex-deployment-url (eg: dev:blue-bird-144) NEXT_PUBLIC_CONVEX_URL=your-convex-url (eg: https://blue-bird-144.convex.cloud) NEXT_PUBLIC_CONVEX_SITE_URL=your-convex-site-url (eg: https://blue-bird-144.convex.site) # Better Auth BETTER_AUTH_SECRET=your-auth-secret BETTER_AUTH_URL=http://localhost:3000 # UploadThing UPLOADTHING_SECRET=your-uploadthing-secret UPLOADTHING_APP_ID=your-uploadthing-app-id # AI Providers OPENAI_API_KEY=your-openai-key GOOGLE_AI_API_KEY=your-google-ai-key GROQ_API_KEY=your-groq-key
-
Set up Convex
npx convex dev
This will:
- Create a new Convex project (if needed) or use an existing one
Whille it syncs:
- Navigate to your convex dashboard
- Select the "dev" environment of your project and go to the "Environmental Variables" tab in Settings
- Add the following variables:
BETTER_AUTH_SECRET BETTER_AUTH_URL GITHUB_CLIENT_ID (for github auth) GITHUB_CLIENT_SECRET OPENAI_API_KEY GOOGLE_AI_API_KEY GROQ_API_KEY TAVILY_API_KEY (for web search tool)
-
Start the development server
npm run dev # or yarn dev # or pnpm dev
Make sure
npx convex devis running in the background. -
Open your browser
Navigate to http://localhost:3000
Go to your convex dashboard and select the "prod" environment of your project.
Paste the same variables and make sure BETTER_AUTH_URL is set to your production domain.
You can directly deploy your fork to Vercel or use the CLI.
Override the default Build command with npm run build:prod
Add all your environment variables in the Vercel dashboard.
The following variables should be your production variables not the same as the development variables.
CONVEX_DEPLOYMENT=your-convex-deployment-url
NEXT_PUBLIC_CONVEX_URL=your-convex-url
T2Chat can be deployed to any platform that supports Next.js:
- Netlify
- DigitalOcean App Platform
- AWS Amplify
- Google Cloud Run
Make sure to:
- Set all required environment variables
- Build the application with
npm run build:prod - Configure the start command as
npm run start
Configure AI providers in the Settings → Models & Keys section:
- Get your API key from Google AI Studio
- Add it in settings or set
GOOGLE_AI_API_KEYenvironment variable
- Get your API key from Groq Console
- Add it in settings or set
GROQ_API_KEYenvironment variable
- Get your API key from OpenRouter
- Access to 100+ models through a single API
T2Chat supports extensive customization:
- Themes: Light/dark mode with custom color schemes
- Fonts: Choose from multiple font options for main text and code
- User Profile: Set your name, role, and personality traits
- Behavior: Configure send behavior (Enter vs Ctrl+Enter) and auto-save
- Speech: Text-to-speech settings and voice selection
t2chat/
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── (chat)/ # Chat-related pages and components
│ │ │ └── chat/ # Chat-related pages and components
│ │ │ ├── settings/ # Settings page
│ │ ├── api/ # API routes (auth, chat, uploadthing)
│ │ ├── auth/ # Authentication pages
│ │ ├── _providers/ # Providers for Convex, Better Auth, etc.
│ ├── components/ # React components
│ │ ├── ui/ # UI components (buttons, inputs, etc.)
│ │ └── settings/ # Settings-specific components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility libraries and configurations
│ └── styles/ # Global styles and CSS
├── convex/ # Convex backend functions
│ ├── chat/ # Chat-related backend functions
│ ├── auth.ts # Authentication configuration
│ └── schema.ts # Database schema definitions
├── public/ # Static assets and images
├── package.json # Dependencies and npm scripts
├── tailwind.config.ts # Tailwind CSS configuration
├── next.config.ts # Next.js configuration
└── README.md # This file
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Commit your changes
git commit -m 'Add some amazing feature' - Push to the branch
git push origin feature/amazing-feature
- Open a Pull Request
- Code Style: Use Prettier for formatting (
npm run format) - Linting: Ensure ESLint passes (
npm run lint) - TypeScript: Maintain type safety throughout the codebase
- Testing: Add tests for new features when applicable
- Documentation: Update documentation for significant changes
We have a list of help wanted issues that are great for newcomers. These contain features and bugs with limited scope, perfect for getting started.
Distributed under the MIT License. See LICENSE for more information.
This means you can:
- ✅ Use commercially
- ✅ Modify and distribute
- ✅ Use privately
- ✅ Include in proprietary software
Special thanks to these amazing projects which help power T2Chat:
- Vercel - Deployment and AI SDK
- Convex - Real-time backend infrastructure
- Better Auth - Authentication solution
- Radix UI - Accessible UI primitives
- Tailwind CSS - Utility-first CSS framework
- OpenAI - AI models and API
- OpenRouter - AI model routing
If you need help with T2Chat:
- Check the documentation in this README
- Search existing issues on GitHub
- Create a new issue if you found a bug
- Start a discussion for feature requests or questions
Built by kmrb.tech
⭐ Star us on GitHub if `T2Chat` helps you!
