A modern, full-featured AI chat application powered by Google Gemini & DeepSeek. This application provides a unified interface to interact with Gemini 2.5 Flash/Pro, Gemini 2.0 Flash, Gemini 1.5 Flash/Pro, DeepSeek V4 Flash, and DeepSeek V4 Pro, complete with user management, conversation history, and an admin dashboard.
- Multi-Model AI Support: Seamlessly switch between Google Gemini (2.5 Flash/Pro, 2.0, 1.5) and DeepSeek (V4 Flash/Pro).
- Encrypted API Key Vault: Users can bring and securely store their own Gemini or DeepSeek API keys (AES-256-GCM encrypted).
- Contextual Memory & Branching: Persistent conversation history stored in PostgreSQL / SQLite with message tree branching.
- Interactive Gallery: Feature showcase with a built-in Lightbox Image Viewer.
- Modern UI: Cyberpunk/Glassmorphism inspired design with dark/light theme support.
- Responsive Design: Fully optimized for Desktop and Mobile devices (including sidebar navigation).
- Customization: Adjustable font sizes, temperature controls, and theme settings.
- Rich Text: Markdown support for code blocks, tables, and lists in chat responses.
- Admin Dashboard: Comprehensive panel to manage users and view system stats.
- User Management: Role-based access control (Admin/User).
- Message Limits: Configurable daily message quotas per user to manage API costs.
- Analytics: Monitor chat volume and user activity.
- Node.js 18 or higher
- PostgreSQL database (Local or Cloud like Neon/Supabase) or SQLite
- A Google Gemini API key and/or DeepSeek API token
-
Clone the repository
git clone https://github.com/MIbnEKhalid/ChatAPI.git cd ChatAPI -
Install dependencies
npm install
-
Set up environment variables Create a
.envfile in the root directory:cp .env.example .env
-
Set up the database
# PostgreSQL (Recommended for cloud/Vercel) npm run db:init:postgres # Or SQLite (Local development) npm run db:init:sqlite
-
Build and Run Unified Project
# Build the Next.js production bundle npm run build # Start the production Next.js server npm start
-
Development Mode
# Next.js dev server (hot-reloading App Router & Route Handlers) npm run dev
The project is structured as a full-stack Next.js App Router application:
- Connect your repository to Vercel.
- Root Directory should be
./(orChatAPIif monorepo). - Set environment variables (
DATABASE_URL,DEEPSEEK_API_TOKEN,GEMINI_API_KEY,API_KEY_ENCRYPTION_SECRET,SESSION_SECRET, etc.) in Vercel Project Settings. - Deploy! Vercel automatically detects Next.js, compiles with Turbopack, and deploys both static pages and serverless API route handlers.
- Framework: Next.js (App Router, Turbopack, React 19)
- Styling: Vanilla CSS (Cyberpunk/Glassmorphism theme)
- Database: PostgreSQL (Cloud / Supabase / Neon) or SQLite (Local)
- Authentication:
mbkauthe(integrated session & token validation) - AI Integration: Google Gemini & DeepSeek REST/Streaming APIs with AES-256-GCM encrypted user key vault
GET /chatbot- Render the chat interface.POST /api/chat- Process user message and return AI response.GET /api/history- Fetch conversation history.DELETE /api/chat/:id- Delete a specific conversation.
GET /admin/dashboard- View system statistics.GET /admin/users- Manage registered users.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
| Name | Role | Links |
|---|---|---|
| Muhammad Bin Khalid | Lead Developer | |
| Maaz Waheed | Developer |
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or contributions, please contact Muhammad Bin Khalid at mbktech.org/Support, support@mbktech.org , chmuhammadbinkhalid28.com and wwork4287@gmail.com.