A Node.js/Express API for ChatGPT-like functionality with Gemini AI integration and Cloudinary file uploads.
- User authentication (JWT)
- Chat management
- Message history
- Gemini AI integration
- File uploads to Cloudinary
- Google OAuth integration
- Node.js
- Express
- MongoDB
- Google Generative AI
- Cloudinary
- JWT Authentication
Create a .env.local file with these variables:
DB_URL=mongodb_connection_string
JWT_SECRET=your_jwt_secret
GOOGLE_API_KEY=your_google_api_key
MEM0_API_KEY=your_mem0_key
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
FRONTEND_URL=your_frontend_url
- Clone the repository
- Install dependencies:
npm install- Set up environment variables
- Run the development server:
npm run devPOST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/google/auth- Google OAuthPOST /api/chat/create- Create new chatGET /api/chat/get- Get user chatsPOST /api/chat/messages/create- Create messageGET /api/chat/messages/:chatId- Get chat messagesPOST /api/gemini/chat- Gemini AI chat (supports file uploads)
Files can be uploaded to Cloudinary via:
POST /api/gemini/chat
Supported formats: JPG, PNG, GIF, PDF, DOC, DOCX