Sign inSign up

devleed/db-llm-console

By devleed

•Updated 5 months ago

Ask your database questions in plain English — no SQL required.

Image
Developer tools
Databases & storage
0

1.2K

devleed/db-llm-console repository overview

⁠🗄️ DB LLM Console

A plug-and-play Docker image that adds a chat interface for your PostgreSQL database to any project. Ask questions in plain English — it figures out the SQL and returns the results.

Think of it like having a co-worker who knows SQL fluently. You say "show me all orders from last week", and they go fetch it for you.


⁠✨ What It Does

  • Connects to your existing PostgreSQL database via environment variables
  • Spins up a combined backend (Node.js/Express) + frontend (React) on a single port
  • Uses LangChain + OpenAI to turn your plain-English questions into SQL queries
  • Returns results right in the chat UI — no SQL knowledge needed

⁠🚀 Quick Start

⁠1. Pull the image
docker pull devleed/db-llm-console:latest
⁠2. Run it
docker run -p 4000:4000 \
  -e DATABASE_HOST=your-db-host \
  -e DATABASE_PORT=5432 \
  -e DATABASE_NAME=your-database-name \
  -e OPENAI_API_KEY=sk-... \
  devleed/db-llm-console:latest

Then open your browser at: http://localhost:4000⁠


⁠⚙️ Environment Variables

VariableRequiredDefaultDescriptionExample
DATABASE_HOST✅postgresHostname of your PostgreSQL serverlocalhost or postgres (Docker service name)
DATABASE_PORT✅5432Port PostgreSQL is running on5432
DATABASE_NAME✅postgresName of the database to connect tomyapp_production
OPENAI_API_KEY✅—Your OpenAI API keysk-...

Create a .env file in the same folder as your docker-compose.yml:

DATABASE_HOST=
DATABASE_PORT=
DATABASE_NAME=
OPENAI_API_KEY=

⁠🐳 Docker Compose Example

Drop this service into your existing docker-compose.yml and make sure you have a .env file next to it with your values filled in:

db-llm-console:
  image: devleed/db-llm-console:latest
  container_name: db-llm-console-dev
  restart: unless-stopped
  depends_on:
    postgres:
      condition: service_healthy # Waits until Postgres is ready before starting
  environment:
    DATABASE_HOST: ${DATABASE_HOST:-postgres} # Falls back to "postgres" if not set in .env
    DATABASE_PORT: ${DATABASE_PORT:-5432} # Falls back to 5432 if not set in .env
    DATABASE_NAME: ${DATABASE_NAME:-postgres} # Falls back to "postgres" if not set in .env
    OPENAI_API_KEY: ${OPENAI_API_KEY} # No default — must be set in .env
  ports:
    - '4000:4000'
  networks:
    - your-network-name

⚠️ Security note: Consider binding the port to 127.0.0.1:4000:4000 so it's only accessible from your machine and not exposed on the network. Never expose this service publicly without authentication.


⁠🔒 Security

This tool has direct read/write access to your database and requires a live OpenAI API key. Before using it in any shared or production environment:

  • Always bind the port to 127.0.0.1 (as shown above)
  • Use a read-only database user if you only need to query data
  • Never commit your .env file or docker-compose.yml with real credentials to version control
  • Access control / token-based auth is on the roadmap

Tag summary

Content type

Image

Digest

sha256:2e9c7dea1…

Size

64.5 MB

Last updated

5 months ago

docker pull devleed/db-llm-console