A modern, real-time AI chat application built with Next.js, featuring advanced voice chat capabilities, real-time messaging, and a beautiful user interface. Lunara provides an intelligent AI companion experience with natural conversation flows and cutting-edge voice interaction technology.
- Intelligent Responses: Powered by Google's Gemini AI with contextual understanding
- Personality Customization: Choose from 5 AI personalities (friendly, professional, creative, analytical, empathetic)
- Context-Aware: Maintains conversation history for meaningful, ongoing interactions
- Custom AI Personalities: Fine-tuned prompts for different conversation styles
- Speech Recognition: Natural voice input using Web Speech API
- Text-to-Speech: AI responses spoken aloud with customizable voice settings
- Real-time Audio: Live voice conversations with visual feedback
- Audio Level Monitoring: Real-time audio visualization and voice activity detection
- Voice Customization: Adjustable speech rate, pitch, and voice preferences
- Live Updates: Messages appear instantly without page refresh using smart polling
- Optimistic UI: Immediate feedback for better user experience
- Typing Indicators: Visual feedback when Lunara is processing responses
- Message Management: Edit, delete, and organize conversations
- Responsive Design: Fully optimized for mobile, tablet, and desktop devices
- Dark/Light Themes: System-aware theme switching with smooth transitions
- Smooth Animations: Framer Motion powered interactions and micro-animations
- Glass Morphism: Modern design with backdrop blur effects and OKLCH colors
- Accessibility: Built with Radix UI primitives for full accessibility support
- Secure Authentication: NextAuth.js with email/password and Google OAuth
- Profile Management: Customizable user profiles with avatar uploads
- Conversation History: Persistent chat history with search and organization
- Data Export: Download your conversations in JSON or CSV format
- Privacy Controls: Granular privacy settings and data management
- Conversation Management: Search, organize, and manage chat sessions
- Notification System: Real-time activity notifications with priority levels
- Settings Panel: Comprehensive customization for voice, theme, and AI behavior
- Mobile Optimized: Touch-friendly interface with safe area support
- API Key Management: Personal Gemini API key support for unlimited usage
- Maintenance Mode: Built-in maintenance mode for updates and deployments
- Next.js 15 - React framework with App Router and Server Components
- TypeScript 5 - Type-safe development with strict mode
- Tailwind CSS 4 - Utility-first styling with OKLCH colors and modern features
- Framer Motion - Smooth animations and transitions
- Radix UI - Accessible component primitives and design system
- Zustand - Lightweight state management with TypeScript support
- React Hook Form - Performant forms with easy validation
- Next.js API Routes - Serverless API endpoints with middleware
- Prisma - Type-safe database ORM with migrations and client generation
- PostgreSQL - Robust relational database with advanced features
- NextAuth.js - Authentication with multiple providers and session management
- Zod - TypeScript-first schema validation with static type inference
- bcryptjs - Password hashing library for Node.js
- Google Gemini AI - Advanced language model for intelligent responses
- @google/generative-ai - Official Google Generative AI SDK
- Web Speech API - Browser-native speech recognition
- Speech Synthesis API - Text-to-speech capabilities
- WebRTC - Real-time communication (planned future enhancement)
- shadcn/ui - Re-usable components built using Radix UI and Tailwind CSS
- next-themes - Perfect dark mode in Next.js with system theme detection
- Sonner - An opinionated toast component for React
- class-variance-authority - Type-safe component variants with TypeScript
- tailwind-merge - Merge Tailwind CSS classes without style conflicts
- clsx - Tiny utility for constructing className strings conditionally
- ESLint 9 - Code linting with Next.js and TypeScript rules
- PostCSS - CSS transformation tool with plugin ecosystem
- Turbopack - Incremental bundler optimized for JavaScript and TypeScript
- Vercel - Optimized deployment platform for Next.js
- cross-env - Cross-platform environment variable setting
Before you begin, ensure you have the following installed:
- Node.js 18+ - Download
- PostgreSQL 14+ - Download or use a cloud provider
- Google Gemini API Key - Get your key
- Git - Download
-
Clone the repository
git clone https://github.com/Celestial-0/Lunara.git cd Lunara -
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env.local
Fill in your environment variables in
.env.local:# Database DATABASE_URL="postgresql://username:password@localhost:5432/lunara" # NextAuth NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET="your-nextauth-secret-key" # Google OAuth (optional) GOOGLE_CLIENT_ID="your-google-client-id" GOOGLE_CLIENT_SECRET="your-google-client-secret" # AI GEMINI_API_KEY="your-gemini-api-key"
-
Set up the database
# Generate Prisma client npm run db:generate # Push database schema npm run db:push
-
Start the development server
npm run dev
-
Open your browser Navigate to
http://localhost:3000and start chatting with Lunara!
-
Visit Google AI Studio
- Go to https://makersuite.google.com/app/apikey
- Sign in with your Google account
-
Create API Key
- Click "Create API Key"
- Choose your project or create a new one
- Copy the generated API key
-
Add to Environment
- Add to your
.env.localfile:GEMINI_API_KEY="your-api-key-here" - Or add directly in the app settings for personal use
- Add to your
- โ Chrome/Chromium: Full support for all voice features
- โ Microsoft Edge: Full support for all voice features
โ ๏ธ Firefox: Limited voice recognition supportโ ๏ธ Safari: Limited voice features, no speech recognition
- ๐ค Microphone Access: Required for voice input and audio level monitoring
- ๐ Audio Playback: Automatic for text-to-speech responses
- ๐ HTTPS: Voice features work best over HTTPS in production
- Use a quality microphone or headset for best recognition
- Speak clearly and at a normal pace
- Minimize background noise
- Ensure stable internet connection for AI processing
-
Sign up/Login
- Use email and password or sign in with Google OAuth
- Complete your profile setup for a personalized experience
-
Start Your First Chat
- Click "New Conversation" or begin typing in the chat interface
- Choose an AI personality that matches your conversation style
- Ask questions, seek advice, or just have a friendly chat
-
Voice Chat Features
- Click the phone icon in the chat header to start voice mode
- Allow microphone permissions when prompted
- Click "Start Talking" and speak naturally to Lunara
- Lunara will respond with both text and voice
- Search Conversations: Use the conversation manager to find past chats
- Edit Titles: Click the edit icon to rename conversations
- Export Data: Download your conversation history from settings
- Customize Settings: Adjust voice, theme, and AI behavior preferences
- Manage API Keys: Add your personal Gemini API key for unlimited usage
Customize Lunara's conversation style in the Settings panel:
- ๐ค Friendly: Warm, conversational, and supportive responses
- ๐ผ Professional: Business-focused, efficient, and direct communication
- ๐จ Creative: Imaginative, colorful language, and innovative thinking
- ๐ Analytical: Logical, data-driven, and detailed explanations
- ๐ Empathetic: Understanding, emotionally aware, and compassionate
Fine-tune voice interaction settings:
- Voice Speed: Adjust speech rate from 0.5x to 2.0x
- Voice Pitch: Modify voice pitch from 0.5x to 2.0x
- Enable/Disable: Toggle voice features on/off
- Audio Feedback: Visual audio level monitoring
- Browser Compatibility: Works best in Chrome and Edge
For unlimited usage, add your personal Gemini API key:
- Visit Google AI Studio
- Create a new API key
- Add it in Settings โ API Key Management
- Enjoy unlimited conversations without rate limits
- System: Automatically matches your device's theme
- Light: Clean, bright interface for daytime use
- Dark: Easy on the eyes for evening conversations
Lunara/
โโโ app/ # Next.js App Router
โ โโโ api/ # API routes and endpoints
โ โ โโโ auth/ # Authentication endpoints
โ โ โโโ chat/ # AI chat processing
โ โ โโโ conversations/ # Conversation management
โ โ โโโ messages/ # Message handling
โ โ โโโ notifications/ # Notification system
โ โ โโโ preferences/ # User settings
โ โ โโโ profile/ # Profile management
โ โ โโโ search/ # Search functionality
โ โ โโโ export/ # Data export
โ โโโ auth/ # Authentication pages
โ โโโ chat/ # Main chat interface
โ โโโ maintenance/ # Maintenance mode pages
โ โโโ globals.css # Global styles and Tailwind
โ โโโ layout.tsx # Root layout component
โ โโโ page.tsx # Home page
โโโ components/ # React components
โ โโโ auth/ # Authentication components
โ โ โโโ AuthProvider.tsx # Auth context provider
โ โ โโโ SignInForm.tsx # Login/signup form
โ โโโ chat/ # Chat-specific components
โ โ โโโ ChatInterface.tsx # Main chat UI
โ โ โโโ VoiceChat.tsx # Voice chat interface
โ โ โโโ MessageBubble.tsx # Individual messages
โ โ โโโ Sidebar.tsx # Navigation sidebar
โ โ โโโ SettingsDialog.tsx # Settings panel
โ โ โโโ ProfileDialog.tsx # Profile management
โ โ โโโ ConversationManager.tsx # Chat organization
โ โ โโโ NotificationCenter.tsx # Notifications
โ โ โโโ AudioControls.tsx # Audio controls
โ โ โโโ TypingIndicator.tsx # Loading states
โ โ โโโ ApiKeyDialog.tsx # API key management
โ โโโ core/ # Core UI components
โ โ โโโ ThemeProvider.tsx # Theme management
โ โ โโโ ThemeToggle.tsx # Theme switcher
โ โ โโโ HomeUI.tsx # Landing page
โ โโโ ui/ # Reusable UI components (Radix)
โโโ lib/ # Utilities and configurations
โ โโโ auth.ts # NextAuth configuration
โ โโโ prisma.ts # Database client
โ โโโ store.ts # Zustand state management
โ โโโ utils.ts # Utility functions
โ โโโ api-client.ts # API client wrapper
โ โโโ hooks/ # Custom React hooks
โ โ โโโ useApi.ts # API integration hook
โ โ โโโ useRealTimeMessages.ts # Real-time updates
โ โ โโโ useVoiceChat.ts # Voice chat functionality
โ โโโ generated/ # Prisma generated files
โโโ prisma/ # Database schema and migrations
โ โโโ schema.prisma # Database schema
โ โโโ migrations/ # Database migrations
โโโ public/ # Static assets
โโโ types/ # TypeScript type definitions
โ โโโ types.ts # Shared type definitions
โโโ .env.example # Environment variables template
โโโ next.config.ts # Next.js configuration
โโโ tailwind.config.ts # Tailwind CSS configuration
โโโ tsconfig.json # TypeScript configuration
โโโ package.json # Dependencies and scripts
ChatInterface: Main chat UI with real-time messaging, voice controls, and mobile optimizationVoiceChat: Voice interaction with speech recognition and synthesisMessageBubble: Individual message display with timestamps and statusSidebar: Navigation, conversation list, and user managementNotificationCenter: Real-time notifications with priority levels
- Zustand Store: Lightweight state management for conversations, messages, and UI state
- Real-time Updates: Custom hooks for polling and optimistic updates
- Persistence: Session storage for UI state and local caching
- Users: Authentication and profile data with NextAuth integration
- Conversations: Chat sessions with metadata and timestamps
- Messages: Individual chat messages with role-based content
- UserPreferences: Settings, theme, and AI personality configuration
- UserProfile: Extended profile information and avatar management
- Notifications: Real-time activity notifications with read status
# Development
npm run dev # Start development server with Turbopack
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
# Database
npm run db:generate # Generate Prisma client
npm run db:push # Push schema to database
npm run db:migrate # Run database migrations
npm run db:studio # Open Prisma Studio# Database
DATABASE_URL="postgresql://user:password@localhost:5432/lunara"
# Authentication
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key"
# Google OAuth (optional)
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
# AI Integration
GEMINI_API_KEY="your-gemini-api-key"
# Optional Features
MAINTENANCE_MODE="false"Lunara is optimized for Vercel deployment:
-
Connect Repository
- Fork this repository to your GitHub account
- Connect your Vercel account to GitHub
- Import the Lunara project
-
Configure Environment Variables
DATABASE_URL="your-production-database-url" NEXTAUTH_URL="https://your-domain.vercel.app" NEXTAUTH_SECRET="your-production-secret" GEMINI_API_KEY="your-gemini-api-key" GOOGLE_CLIENT_ID="your-google-client-id" # Optional GOOGLE_CLIENT_SECRET="your-google-client-secret" # Optional
-
Database Setup
- Use a PostgreSQL provider (Railway, Supabase, PlanetScale, etc.)
- Run migrations:
npx prisma migrate deploy - Generate client:
npx prisma generate
-
Deploy
- Push to main branch for automatic deployment
- Vercel handles build optimization and CDN distribution
# Use official Node.js runtime
FROM node:18-alpine
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production
# Copy app source
COPY . .
# Generate Prisma client
RUN npx prisma generate
# Build application
RUN npm run build
# Expose port
EXPOSE 3000
# Start application
CMD ["npm", "start"]- Clone repository on your server
- Install Node.js 18+ and PostgreSQL
- Set up environment variables
- Run database migrations
- Build and start the application
- Configure reverse proxy (nginx/Apache)
We welcome contributions to Lunara! Whether you're fixing bugs, adding features, or improving documentation, your help is appreciated.
-
Fork the repository
git fork https://github.com/Celestial-0/Lunara.git
-
Clone your fork
git clone https://github.com/your-username/Lunara.git cd Lunara -
Create a feature branch
git checkout -b feature/amazing-feature
-
Make your changes
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
-
Commit your changes
git commit -m 'feat: add amazing feature' -
Push to your branch
git push origin feature/amazing-feature
-
Open a Pull Request
- Describe your changes clearly
- Link to any relevant issues
- Wait for review and feedback
- Code Style: Follow TypeScript and ESLint configurations
- Commits: Use conventional commit messages (
feat:,fix:,docs:, etc.) - Testing: Ensure all tests pass before submitting
- Documentation: Update README and code comments for new features
- ๐ Bug Fixes: Check the issues tab for known bugs
- โจ Features: Voice enhancements, UI improvements, new AI personalities
- ๐ Documentation: API docs, tutorials, code comments
- ๐งช Testing: Unit tests, integration tests, E2E tests
- ๐จ Design: UI/UX improvements, animations, themes
- ๐ Internationalization: Multi-language support
This project is licensed under the MIT License - see the LICENSE file for details.
- โ Commercial use allowed
- โ Modification allowed
- โ Distribution allowed
- โ Private use allowed
- โ No warranty provided
- โ No liability assumed
- ๐ Documentation: Check this README and inline code comments
- ๐ Bug Reports: Create an issue with detailed information
- ๐ก Feature Requests: Open a discussion to propose new features
- โ Questions: Use GitHub Discussions for general questions
- โญ Star the repository to stay notified of updates
- ๐ Watch releases for new version announcements
- ๐ด Fork to contribute and customize for your needs
- ๐ WebRTC Integration: Direct peer-to-peer voice calls with better quality
- ๐ File Sharing: Upload and discuss documents, images, and media
- ๐ Multi-language Support: International voice recognition and UI translations
- ๐ญ Custom Voice Models: Personalized TTS voices and voice cloning
- ๐ฑ Mobile Apps: Native iOS and Android applications
- ๐ฅ Team Workspaces: Collaborative AI assistance for teams and organizations
- ๐ Plugin System: Third-party integrations and custom AI models
- ๐ Analytics Dashboard: Conversation insights and usage statistics
- ๐ฎ Interactive Elements: Games, quizzes, and interactive learning
- ๐ Advanced Search: Semantic search across conversation history
- AI-powered conversation coaching and improvement suggestions
- Integration with productivity tools and calendars
- Voice-based automation and smart home control
- Advanced emotional intelligence and context understanding
- Blockchain integration for privacy and data ownership