An AI-powered intelligent chat assistant with real-time web search, Gmail integration, and autonomous email capabilities.
Perplexity AI is a full-stack AI-powered chat application that combines the reasoning capabilities of Mistral AI, real-time internet access using Tavily AI, and Gmail integration through Google OAuth + Nodemailer.
Unlike a traditional chatbot, Perplexity AI can:
- π¬ Hold contextual conversations
- π Search the internet before answering
- π§ Verify Gmail accounts securely
- βοΈ Send emails on behalf of authenticated users
- π§ Decide when internet search is required
- β‘ Stream AI responses with typing animations
- π Manage multiple chat sessions
- Mistral AI powered conversations
- Intelligent response generation
- Context-aware conversations
- AI Thinking Indicator
- Typing Animation Effect
- Multiple chat sessions
- Persistent chat history
Integrated with Tavily AI, allowing the AI model to search the web whenever additional information is required.
Features include:
- Real-time web search
- Latest news retrieval
- Current events
- Research assistance
- Fact verification
Users authenticate using their Gmail account.
The application securely stores OAuth credentials allowing the AI assistant to send emails on behalf of the user.
Features:
- Gmail OAuth Authentication
- Secure Token Storage
- Email Verification
- AI Generated Emails
- AI Sends Emails Automatically
- Personalized Email Drafts
- Sidebar Chat Navigation
- Create New Chats
- Switch Between Chats
- Persistent Chat History
- Loading States
- AI Thinking Animation
- Smooth Typing Effect
- Responsive Dashboard
- Beautiful Modern UI
- Responsive Design
- Toast Notifications
- Redux State Management
- Tailwind CSS Styling
- Fast Vite Development
- React
- Vite
- Redux Toolkit
- Tailwind CSS
- Axios
- React Router
- React Toastify
- Node.js
- Express.js
- MongoDB
- Mongoose
- JWT Authentication
- Mistral AI
- Tavily AI
- Gmail API
- Google OAuth2
- Nodemailer
Perplexity/
β
βββ Backend/
β βββ node_modules/
β βββ public/
β βββ src/
β β βββ config/ # Database & application configuration
β β βββ controllers/ # Business logic
β β βββ middlewares/ # Authentication & request middlewares
β β βββ models/ # Mongoose models
β β βββ routes/ # Express API routes
β β βββ services/ # AI, Gmail & external service integrations
β β βββ validators/ # Request validation schemas
β β βββ app.js # Express application
β β
β βββ .env
β βββ .gitignore
β βββ package.json
β βββ package-lock.json
β βββ server.js # Backend entry point
β
βββ FrontEnd/
β βββ node_modules/
β βββ public/
β βββ src/
β β βββ assets/
β β βββ components/ # Reusable UI components
β β βββ hooks/ # Custom React hooks
β β βββ layouts/ # Application layouts
β β βββ pages/ # Application pages
β β βββ redux/ # Redux Toolkit store & slices
β β βββ routes/ # React Router configuration
β β βββ services/ # API communication
β β βββ utils/ # Helper utilities
β β βββ App.jsx
β β βββ main.jsx
β β
β βββ .gitignore
β βββ eslint.config.js
β βββ index.html
β βββ package.json
β βββ package-lock.json
β βββ README.md
β βββ vite.config.js
β
βββ README.md
git clone https://github.com/DibyanshuChauhan/Perplexity.gitcd Perplexitycd Backend
npm installcd ../FrontEnd
npm installCreate a .env file inside the Backend directory and add the following variables.
# ===============================
# Database Configuration
# ===============================
MONGO_URI=your_mongodb_connection_string
# ===============================
# Server Configuration
# ===============================
PORT=3000
NODE_ENV=development
# ===============================
# JWT Authentication
# ===============================
JWT_SECRET=your_super_secret_jwt_key
# ===============================
# AI Services
# ===============================
MISTRAL_API_KEY=your_mistral_api_key
TAVILY_API_KEY=your_tavily_api_key
GEMINI_API_KEY=your_gemini_api_key # Optional
# ===============================
# Gmail OAuth Configuration
# ===============================
GOOGLE_USER=your_email@gmail.com
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_REFRESH_TOKEN=your_google_refresh_token| Variable | Description |
|---|---|
MONGO_URI |
MongoDB Atlas connection string. |
PORT |
Port on which the backend server runs. |
NODE_ENV |
Application environment (development or production). |
JWT_SECRET |
Secret key used to sign JWT authentication tokens. |
MISTRAL_API_KEY |
API key used for generating AI responses via Mistral AI. |
TAVILY_API_KEY |
API key enabling real-time internet search through Tavily AI. |
GEMINI_API_KEY |
Optional Google Gemini API key for future AI integrations. |
GOOGLE_USER |
Gmail account used for sending emails. |
GOOGLE_CLIENT_ID |
OAuth Client ID obtained from Google Cloud Console. |
GOOGLE_CLIENT_SECRET |
OAuth Client Secret obtained from Google Cloud Console. |
GOOGLE_REFRESH_TOKEN |
Refresh token used by Nodemailer to send emails without requiring the user to log in again. |
To enable Gmail integration:
- Visit Google Cloud Console
- Create a new project
- Enable the Gmail API
- Select External
- Fill in the required application details
- Add your Gmail account as a Test User
Create an OAuth 2.0 Client ID and copy:
- Client ID
- Client Secret
Visit:
Then:
- Click the βοΈ Settings icon.
- Enable Use your own OAuth credentials.
- Paste your Google Client ID and Client Secret.
- Select the Gmail API.
- Authorize access with your Google account.
- Exchange the authorization code for tokens.
- Copy the generated Refresh Token into your
.envfile.
β οΈ Security NoticeNever commit your
.envfile or API keys to GitHub. Always add.envto your.gitignoreto protect sensitive credentials.
cd Backend
npm run devcd FrontEnd
npm run devVisit
http://localhost:5173
User
β
βΌ
React Frontend
β
βΌ
Express Backend
β
βββββββββββββββββΌβββββββββββββββββ
βΌ βΌ βΌ
Mistral AI Tavily AI Gmail OAuth
β β β
βββββββββββββββββΌβββββββββββββββββ
βΌ
Intelligent AI Response
β
βΌ
Email Sent (If Required)
User Message
β
βΌ
Backend receives prompt
β
βΌ
Mistral analyzes request
β
ββββββββββββββββ
βNeed Internet?β
ββββββββ¬ββββββββ
βYes
βΌ
Tavily Search
β
βΌ
Search Results Returned
β
βΌ
Mistral Generates Final Answer
β
βΌ
Display to User
User connects Gmail
β
βΌ
Google OAuth Verification
β
βΌ
Access Token Generated
β
βΌ
Encrypted Storage
β
βΌ
User asks AI to send email
β
βΌ
AI drafts email
β
βΌ
Nodemailer sends email
β
βΌ
Recipient receives email
- β Loader Component
- β Sidebar Navigation
- β Dashboard Chat Interface
- β Thinking Indicator
- β Typing Animation Effect
- β Custom useChat Hook
- β Email Integration Component
- β Chat API Service
- β Redux Store Configuration
- β Toast Notifications
- β Tailwind CSS Setup
- π€ Integrated Mistral AI
- π Connected Tavily AI for real-time internet access
- π§ Gmail OAuth Authentication
- βοΈ AI can send emails on behalf of authenticated users
- π Secure Gmail verification using Google OAuth + Nodemailer
- JWT Authentication
- Protected Routes
- Google OAuth2 Authentication
- Secure Access Tokens
- Environment Variables
- API Key Protection
- Voice Conversations
- Streaming Responses
- Image Generation
- File Upload Support
- Conversation Export
- AI Memory
- Markdown Rendering
- Code Syntax Highlighting
- Multi-Model Support
- Dark/Light Theme
Contributions are welcome.
-
Fork the repository
-
Create a new branch
git checkout -b feature/your-feature- Commit changes
git commit -m "feat: add new feature"- Push branch
git push origin feature/your-feature- Open a Pull Request
This project is licensed under the MIT License.