Back to projects
Chat with Database

Chat with Database

Sami Paananen / Mar 4, 2025

The project

This project is an AI assistant that translates natural language into SQL queries and RAG-powered responses for a fictional clothing web app. Unlike drag-and-drop AI tools, this project was developed from scratch using Python, LangChain, and NeonDB.

Features

  • Natural Language Processing: Converts user queries into SQL statements and RAG-based responses
  • Role-Based Access: Regular users interact with RAG for Q&A, while admins can run SQL queries with strict security measures
  • Secure SQL Execution: DML operations (INSERT, UPDATE, DELETE) are blocked to prevent data modification
  • JWT Authentication: API routes are protected using JWT tokens to ensure secure access
  • AWS Deployment: The system is deployed on AWS using Route 53 for DNS management, an Application Load Balancer for SSL termination, EC2 instances running Docker containers, and an Nginx reverse proxy to handle HTTPS traffic (The app was briefly deployed)

Technologies

  • Python: The core language for the backend implementation
  • LangChain: Framework used for AI-driven query processing
  • NeonDB: A serverless PostgreSQL database for handling structured queries
  • Next.js: The frontend was built with Next.js for an interactive user interface
  • Docker: The application is containerized using Docker for easier deployment
  • AWS: The infrastructure includes Route 53, ALB, EC2, and Nginx for cloud deployment
  • JWT Authentication: Ensures secure API communication and user role validation

Key Learnings

This project provided insights into the flexibility of LangChain for building custom AI agents, the importance of implementing role-based security when exposing SQL capabilities, and the benefits of using Docker and AWS for scalable deployments.

Links

Comments