A real-time chat application designed to facilitate conversations about fire-related topics. This project features a modern Next.js frontend and a Node.js backend, integrating a Large Language Model (LLM) via Ollama. Users can interact with the chatbot, which leverages advanced language understanding, and can upload PDF documents to enrich the LLM's knowledge base—especially with information about fire. This enables the chatbot to provide more accurate and context-aware answers about fire, fire safety, and related subjects.
├── frontend/ # Next.js frontend application
└── server/ # Node.js backend server
- Node.js (v14 or higher)
- npm
- MongoDB (local installation or MongoDB Atlas account)
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Create a
.env.localfile in the frontend directory with the following variables:
NEXT_PUBLIC_API_URL=http://localhost:3001- Start the development server:
npm run devThe frontend will be available at http://localhost:3000
- Navigate to the server directory:
cd server- Install dependencies:
npm install- Create a
.envfile in the server directory with the following structure and example values:
PORT=3001
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/chatbot
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRE=1d
OLLAMA_API_URL=http://localhost:11434
OLLAMA_MODEL=llama2
VECTOR_DIMENSION=384
ENCRYPTION_KEY=your_encryption_key- Start the server:
npm run devThe backend server will be available at http://localhost:3001
PORT: The port number for the backend server (default: 3001)NODE_ENV: The environment mode (e.g., development, production)MONGODB_URI: Your MongoDB connection string (e.g., mongodb://localhost:27017/chatbot or MongoDB Atlas URI)JWT_SECRET: Secret key for JWT token generation and verificationJWT_EXPIRE: Expiration time for JWT tokens (e.g., 1d, 7d)OLLAMA_API_URL: The URL for the Ollama API (e.g., http://localhost:11434)OLLAMA_MODEL: The model name used by Ollama (e.g., llama2)VECTOR_DIMENSION: The dimension of the vector embeddings (e.g., 384)ENCRYPTION_KEY: Key used for encryption of sensitive data
NEXT_PUBLIC_API_URL: The URL of your backend API (default: http://localhost:3001)
- Real-time messaging using WebSocket
- User authentication with JWT
- Modern UI with Next.js and Tailwind CSS
- RESTful API backend
- MongoDB database with Mongoose ODM
- Secure environment variable management
- Frontend runs on port 3000
- Backend runs on port 3001
- MongoDB should be running locally or accessible via MongoDB Atlas
- Make sure both servers are running for full functionality