A full-stack AI chat application built with Next.js, Node.js/Express, MongoDB, and Google Gemini API.
- 💬 Real-time AI chat powered by Google Gemini
- 📝 Markdown rendering with syntax highlighting
- 💾 Persistent chat history with MongoDB
- 🗂️ Multiple conversation management
- ⌨️ Typing effect animation
- 🗑️ Delete conversations
- 🎨 Modern dark-themed UI
- Next.js 16 - React framework
- React - UI library
- Lucide React - Icons
- React Markdown - Markdown rendering
- CSS - Styling
- Node.js - Runtime
- Express - Web framework
- MongoDB - Database
- Mongoose - ODM
- Google Generative AI - AI integration
novagpt/
├── backend/
│ ├── models/
│ │ ├── Chat.js # Chat message schema
│ │ └── Conversation.js # Conversation schema
│ ├── routes/
│ │ └── api.js # API routes
│ ├── utils/
│ │ └── gemini.js # Gemini API integration
│ ├── server.js # Express server
│ └── .env # Environment variables (not in git)
│
└── frontend/
├── app/
│ ├── globals.css # Global styles
│ ├── layout.js # Root layout
│ └── page.js # Main page
├── components/
│ ├── ChatArea.js # Chat interface
│ ├── ChatArea.css # Chat styles
│ ├── Sidebar.js # Sidebar navigation
│ └── Sidebar.css # Sidebar styles
└── public/ # Static assets
- Node.js (v18 or higher)
- MongoDB (local or Atlas)
- Google Gemini API key
- Navigate to the backend directory:
cd backend- Install dependencies:
npm install express mongoose cors dotenv @google/generative-ai- Create a
.envfile:
GEMINI_API_KEY=your_gemini_api_key_here
MONGODB_URI=your_mongodb_connection_string
PORT=5000- Start the backend server:
node server.jsThe backend will run on http://localhost:5000
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Start the development server:
npm run devThe frontend will run on http://localhost:3000
GET /api/conversations- Get all conversationsPOST /api/conversations- Create new conversationDELETE /api/conversations/:id- Delete conversation
POST /api/chat- Send message and get AI responseGET /api/chat/:conversationId- Get messages for a conversation
GET /api/test- Test server and database connection
GEMINI_API_KEY=your_api_key
MONGODB_URI=mongodb://localhost:27017/novagpt
PORT=5000- Real-time messaging with AI
- Markdown support for formatted responses
- Code syntax highlighting
- Typing animation effect
- Auto-scroll to latest message
- Create new conversations
- View conversation history in sidebar
- Delete unwanted conversations
- Auto-generated conversation titles
- All messages saved to MongoDB
- Conversations persist across sessions
- Load previous conversations on demand
- Start MongoDB (if local)
- Start backend:
cd backend && node server.js - Start frontend:
cd frontend && npm run dev - Open
http://localhost:3000
Frontend:
cd frontend
npm run build
npm startFeel free to submit issues and pull requests!
MIT
Your Name
Built with ❤️ using Next.js and Google Gemini