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 React frontend npm run build # Start the Express server (serves both API and built React SPA) npm start
-
Development Mode
- Backend dev server:
npm run dev - Frontend Vite dev server with proxy:
npm run dev:frontend
- Backend dev server:
The project is structured to deploy backend and frontend together directly on Vercel:
- Connect your repository to Vercel.
- Ensure Root Directory is set to
./(orChatAPIif part of a monorepo). - Set your environment variables (
DATABASE_URL,DEEPSEEK_API_TOKEN,API_KEY_ENCRYPTION_SECRET,SESSION_SECRET, etc.) in the Vercel Project Settings. - Deploy! Vercel will run
npm run buildto generate the frontend assets and automatically route API requests to the/apiserverless handler defined inapi/index.js.
- Backend: Node.js, Express.js (Runs locally & serverless on Vercel)
- Frontend: React, Vite, Tailwind/CSS
- Database: PostgreSQL (Cloud / Supabase / Neon) or SQLite (Local)
- Authentication:
mbkauthe - AI Integration: DeepSeek REST API with encrypted token storage
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.