Skip to content

den319/neuratalk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NeuraTalk

NeuraTalk is a modern real-time chat application with AI-powered conversations, built with React, Node.js, and Socket.io.

License: ISC TypeScript React Node.js MongoDB Socket.io

logo

✨ Features

  • Real-time Messaging: Instant messaging with WebSocket connections
  • Group Chat: Create groups and add multiple users for collaborative conversations
  • AI-Powered Chat: Integrated with Google Gemini AI for intelligent conversations
  • User Authentication: Secure JWT-based authentication system
  • File Sharing: Support for image uploads with Cloudinary integration
  • Modern UI: Beautiful, responsive interface built with Tailwind CSS and Radix UI
  • Dark/Light Theme: Theme switching with next-themes
  • Message Reactions: Interactive message replies and reactions
  • Online Status: Real-time user presence indicators
  • Typing Indicators: See when others are typing
  • Message Status: Delivery and read status indicators

πŸš€ Tech Stack

Frontend

  • React 19 - Modern React with hooks and concurrent features
  • TypeScript - Type-safe JavaScript
  • Vite - Fast build tool and dev server
  • Tailwind CSS - Utility-first CSS framework
  • Zustand - Lightweight state management
  • React Router - Client-side routing
  • Socket.io Client - Real-time communication
  • React Hook Form - Form handling with validation
  • Radix UI - Accessible UI components
  • Lucide React - Beautiful icons

Backend

  • Node.js - JavaScript runtime
  • Express.js - Web framework
  • TypeScript - Type-safe backend
  • MongoDB - NoSQL database
  • Mongoose - MongoDB object modeling
  • Socket.io - Real-time bidirectional communication
  • JWT - JSON Web Tokens for authentication
  • bcrypt - Password hashing
  • Google AI SDK - AI integration
  • Cloudinary - Image hosting and optimization

πŸ“‹ Prerequisites

Before running this application, make sure you have:

  • Node.js (v18 or higher)
  • MongoDB (local or cloud instance)
  • npm or yarn package manager
  • Google AI API Key (for AI features)
  • Cloudinary Account (for image uploads)

πŸ› οΈ Installation

  1. Clone the repository

    git clone https://github.com/den319/neuratalk.git
    cd neuratalk
  2. Install backend dependencies

    cd backend
    npm install
  3. Install frontend dependencies

    cd ../frontend
    npm install
  4. Environment Setup

    Backend (.env)

    PORT=5000
    NODE_ENV=development
    MONGO_URI=mongodb_uri
    JWT_SECRET=your_jwt_secret_here
    FRONTEND_ORIGIN=http://localhost:5173
    GOOGLE_GENERATIVE_AI_API_KEY=your_google_ai_api_key
    CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
    CLOUDINARY_API_KEY=your_cloudinary_api_key
    CLOUDINARY_API_SECRET=your_cloudinary_api_secret

    Frontend (.env)

    VITE_API_URL=http://localhost:5000

πŸš€ Running the Application

Development Mode

  1. Start the backend server

    cd backend
    npm run dev
  2. Start the frontend development server

    cd frontend
    npm run dev
  3. Access the application

Production Build

  1. Build the frontend

    cd frontend
    npm run build
  2. Build the backend

    cd backend
    npm run build
  3. Start the production server

    cd backend
    npm start

πŸ–₯️ UI

Booking Approvals
Chat with AI
Create Garage
Different Chats of User
Manager Home
Sign-in Page

πŸ“ Project Structure

neuratalk/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/          # Configuration files
β”‚   β”‚   β”œβ”€β”€ controllers/     # Route controllers
β”‚   β”‚   β”œβ”€β”€ lib/            # Socket.io setup
β”‚   β”‚   β”œβ”€β”€ middlewares/    # Express middlewares
β”‚   β”‚   β”œβ”€β”€ models/         # MongoDB models
β”‚   β”‚   β”œβ”€β”€ routes/         # API routes
β”‚   β”‚   β”œβ”€β”€ services/       # Business logic
β”‚   β”‚   β”œβ”€β”€ utils/          # Utility functions
β”‚   β”‚   β”œβ”€β”€ validators/     # Input validation
β”‚   β”‚   └── index.ts        # Server entry point
β”‚   β”œβ”€β”€ dist/               # Compiled JavaScript
β”‚   └── package.json
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # React components
β”‚   β”‚   β”œβ”€β”€ hooks/          # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ layouts/        # Layout components
β”‚   β”‚   β”œβ”€β”€ lib/            # Utility functions
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”œβ”€β”€ routes/         # Routing configuration
β”‚   β”‚   β”œβ”€β”€ types/          # TypeScript types
β”‚   β”‚   └── App.tsx         # Main app component
β”‚   β”œβ”€β”€ public/             # Static assets
β”‚   β”œβ”€β”€ dist/               # Built files
β”‚   └── package.json
└── README.md

πŸ”§ API Endpoints

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • GET /api/auth/me - Get current user

Chats

  • GET /api/chat/all - Get all user chats
  • POST /api/chat/create - Create new chat
  • GET /api/chat/:id - Get chat details

Messages

  • POST /api/chat/message/send - Send message

Users

  • GET /api/user/all - Get all users

🌐 WebSocket Events

Client to Server

  • chat:join - Join a chat room
  • chat:leave - Leave a chat room
  • typing - Send typing indicator
  • remove:typing-user - Remove typing indicator

Server to Client

  • message:new - New message in chat
  • chat:update - Chat information updated
  • chat:ai - AI response (streaming or complete)
  • online:users - List of online users
  • typing:users - Users currently typing

πŸ€– AI Integration

NeuraTalk integrates with Google Gemini AI to provide intelligent chat responses. The AI features include:

  • Context-aware responses based on chat history
  • Streaming responses for real-time text generation
  • Image analysis capabilities
  • Multi-modal conversations (text + images)

πŸ“± Features Overview

Real-time Chat

  • Instant message delivery with WebSocket
  • Message read receipts and status indicators
  • Typing indicators
  • Online presence status

AI Conversations

  • Chat with AI assistant powered by Google Gemini
  • Streaming responses for smooth UX
  • Context preservation across messages
  • Image understanding capabilities

User Interface

  • Modern, responsive design
  • Dark and light theme support
  • Mobile-friendly interface
  • Intuitive navigation

Security

  • JWT-based authentication
  • Password hashing with bcrypt
  • CORS protection
  • Helmet security headers

πŸš€ Deployment

Environment Variables for Production

Backend:

NODE_ENV=production
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secure_jwt_secret
FRONTEND_ORIGIN=https://yourdomain.com
GOOGLE_GENERATIVE_AI_API_KEY=your_google_ai_key
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret

Frontend:

VITE_API_URL=https://your-backend-url.com

Build Commands

# Install dependencies and build
npm install --include=dev --prefix frontend && npm run build --prefix frontend
npm install --include=dev --prefix backend && npm run build --prefix backend

# Start production server
npm start --prefix backend

πŸ§ͺ Testing

# Run frontend tests
cd frontend
npm run lint

# Run backend type checking
cd backend
npm run build

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the ISC License - see the LICENSE file for details.

πŸ™ Acknowledgments

About

A chat aplication where you can chat with other people as well as AI

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages