Welcome to LumaAI, a cutting-edge Next.js-based chat application powered by Google Generative AI (Gemini) and ImageKit for seamless image uploads. This project showcases a dynamic, interactive chat experience with robust backend support, designed for developers and AI enthusiasts alike. 🚀
luma-demo.mov
- Project Overview
- Features
- Directory Structure
- Getting Started
- Usage
- API Documentation
- Frontend Details
- Backend Details
- Contributing
- Troubleshooting
- License
- Acknowledgments
- Contact
LumaAI is an innovative chat application that leverages the power of Gemini AI for natural language processing and ImageKit for efficient image handling. Built with Next.js, it offers a modern, responsive interface with real-time chat capabilities and secure authentication via Clerk.
- Real-time chat with AI-powered responses using Gemini.
- Image upload and display with ImageKit integration.
- User authentication with Clerk.
- Responsive design for desktop and mobile.
- Animated UI elements with Framer Motion.
- Detailed logging for debugging and development.
LumaAI/
├── frontend/ # Next.js-based frontend
│ ├── app/ # Application pages
│ ├── components/ # Reusable UI components
│ ├── lib/ # Utility functions
│ ├── README.md # Frontend details
│ ├── package.json
├── backend/ # Express + Prisma backend
│ ├── routes/ # API endpoints
│ ├── utils/ # Helper functions
│ ├── index.ts # Main server file
│ ├── README.md # Backend details
│ ├── package.json
├── .env # Environment variables
├── README.md # This file
├── package.json # Project metadata
├── LICENSE # MIT license
- Node.js (v18.x or later)
- npm or yarn
- Git
- An ImageKit account for image uploads
- A Google Cloud API key for Gemini
- A Clerk account for authentication
-
Clone the Repository
git clone https://github.com/Prayag-09/LumaAI.git cd LumaAI -
Set Up Environment Variables Create a
.envfile in the root directory with the following:NEXT_PUBLIC_GEMINI_API_KEY=your_gemini_api_key NEXT_PUBLIC_IMAGE_KIT_ENDPOINT=https://ik.imagekit.io/your_endpoint NEXT_PUBLIC_IMAGE_KIT_PUBLIC_KEY=your_public_key NEXT_PUBLIC_API_URL=http://localhost:5000 IMAGE_KIT_PRIVATE_KEY=your_private_key
-
Install Dependencies
- For frontend:
cd frontend && npm install - For backend:
cd backend && npm install
- For frontend:
-
Start the Application
- Backend:
cd backend && node index.tsor use your start script - Frontend:
cd frontend && npm run dev
- Backend:
-
Access the App Open
http://localhost:3000in your browser.
- Navigate to
/dashboardto start a new chat. - Use
/dashboard/chat/[chatId]to view or continue a specific chat. - Upload images and interact with the AI-powered chat interface.
- POST /api/chats
- Creates a new chat.
- Body:
{ history: [{ role: 'user', parts: [{ text: 'Hello' }] }] } - Response:
{ id, userId, history, createdAt, updatedAt } - Auth: Requires Clerk JWT
- GET /api/chats/:id
- Fetches a specific chat.
- Response:
{ id, userId, history, createdAt, updatedAt }
- PUT /api/chats/:id
- Updates a chat with new messages or images.
- Body:
{ question, answer, img } - Response: Updated chat object
- POST /api/uploads
- Authenticates ImageKit uploads.
- Response:
{ signature, expire, token }
- Location:
app/ - Tech Stack: Next.js, React, TypeScript
- Key Files:
app/(dashboard)/dashboard/page.tsx- Dashboard entryapp/(dashboard)/dashboard/chat/[chatId]/page.tsx- Chat interfacecomponents/NewPrompt.tsx- Chat input componentcomponents/Upload.tsx- Image upload component
- README: See
frontend/README.mdfor detailed setup.
- Location:
server/ - Tech Stack: Node.js, Express, Prisma
- Key Files:
index.ts- Main server fileroutes/chat.routes.ts- Chat API routesroutes/upload.routes.ts- ImageKit authenticationutils/imagekit.ts- ImageKit configuration
- README: See
backend/README.mdfor detailed setup.
- Fork the repository.
- Create a feature branch:
git checkout -b feature/new-feature. - Commit changes:
git commit -m 'Add new feature'. - Push to the branch:
git push origin feature/new-feature. - Open a Pull Request.
- Messages Not Sending: Check console logs for
textvalue and API response status. VerifyNEXT_PUBLIC_GEMINI_API_KEY. - Images Missing: Ensure
NEXT_PUBLIC_IMAGE_KIT_ENDPOINTand backend/api/uploadare configured. - 404 Errors: Confirm
NEXT_PUBLIC_API_URLmatches the backend server.
This project is licensed under the MIT License.
- Google for the Generative AI SDK.
- ImageKit for image upload services.
- Clerk for authentication solutions.
- The open-source community for inspiration.
- Author: [T Prayag] (prayagtushar2016@gmail.com)
- GitHub: yourusername/lumaai-chat
- Issues: Report bugs or suggestions here.