Skip to content
SohailShabbir867Public

About

The Chat ai that is customized for the database project and integration

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Chat AI - Professional Python and Oracle SQL Assistant

License: MIT Node.js Version React MongoDB

Full-stack AI chat application for Python developers and database administrators. It provides a ChatGPT-style UI, secure authentication, and routing between n8n, Groq, and Ollama.

Key features

  • Modern, responsive UI built with React 19 and Tailwind CSS.
  • Provider routing between n8n workflows, Groq Cloud, and local Ollama.
  • JWT authentication with bcrypt password hashing and rate limiting.
  • Syntax-highlighted code blocks with one-click copy.
  • Pre-configured for Python (cx_Oracle) and Oracle SQL optimization.
  • Usage limits (10 chats per user, 20 messages per chat) to control local resources.

Tech stack

  • Frontend: React 19, Vite, Tailwind CSS, React Markdown.
  • Backend: Node.js (ESM), Express, MongoDB.
  • Security: Helmet, CORS, Express Rate Limit, JWT.
  • AI integration: n8n Webhook, Groq API, Ollama API.

Project structure

Chat ai/
|-- backend/                  # Express API and AI routing
|-- frontend/                 # React application (Vite)
|-- n8n-chat-ai-template.json # Ready-to-import n8n workflow
`-- README.md                 # Documentation

Backend setup

  1. Navigate to the backend directory:
    cd backend
  2. Configure environment variables:
    cp .env.example .env
    Ensure JWT_SECRET is at least 32 characters long.
  3. Install dependencies:
    npm install
  4. Start the server:
    npm run dev
    API runs at http://localhost:4000.

Frontend setup

  1. Navigate to the frontend directory:
    cd frontend
  2. Configure API URL:
    cp .env.example .env
    Set VITE_API_URL=http://localhost:4000/api.
  3. Install dependencies:
    npm install
  4. Run in development mode:
    npm run dev
    Open http://localhost:5173 in your browser.

AI provider integration

1) n8n (primary)

The backend sends a POST request to N8N_WEBHOOK_URL with chat history and message.

  • Import: use n8n-chat-ai-template.json in n8n.
  • Response format: n8n must return { "reply": "..." }.

2) Groq (fast)

High-speed inference using Llama 3 models on Groq Cloud.

  • Set GROQ_API_KEY in backend/.env.

3) Ollama (local/fallback)

Local LLM execution.

  • Ensure Ollama is running (ollama serve).
  • Set OLLAMA_URL (usually http://localhost:11434/api/chat).

Security and optimization

  • Security headers via Helmet and aggressive rate limiting on auth routes.
  • Backend validates message lengths and JSON payloads.
  • MongoDB connection includes retry logic and index setup.
  • Structured logging for debugging and monitoring.

License

Distributed under the MIT License. See LICENSE for details (if available).

About

The Chat ai that is customized for the database project and integration

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages