Skip to content

dlt/freud

Repository files navigation

Freud

Open-Source, AI-Powered PostgreSQL Client

A modern database tool that combines query analysis, visual schema exploration, and AI-assisted optimization in a fast, native desktop application.

License Platform PostgreSQL


Why Freud?

Traditional database tools force you to switch between multiple applications: one for writing queries, another for visualizing schemas, a third for analyzing execution plans, and perhaps a web service for optimization advice.

Freud unifies these workflows into a single, keyboard-driven interface with AI assistance built in—not bolted on.

  • Write SQL with LSP-powered autocomplete that understands your schema
  • Analyze performance with interactive execution plan visualization
  • Optimize queries with AI that explains problems and suggests fixes
  • Explore schemas with ER diagrams generated from your live database
  • Edit data directly in query results without writing UPDATE statements

Built with Rust and Tauri for native performance. No Electron. No web browser overhead.


Features

AI-Powered Query Optimization

Freud integrates large language models directly into your workflow:

  • Structured Analysis — AI examines execution plans and identifies bottlenecks, missing indexes, and suboptimal joins
  • Actionable Recommendations — Each suggestion includes impact assessment, implementation effort, and production risk level
  • Interactive Chat — Ask follow-up questions about your queries and get contextual advice with executable SQL snippets
  • Natural Language to SQL — Describe what you want in plain English; Freud generates the query using your schema

Supports GPT-4o, GPT-4 Turbo, o1, and other OpenAI models.

Modern Query Editor

  • PostgreSQL LSP — Context-aware completions for tables, columns, functions, and keywords powered by postgres_lsp
  • Real-time Validation — Syntax errors highlighted as you type with line and column information
  • SQL Formatting — Auto-format on paste or with Shift+Alt+F
  • Multi-tab Workspace — Work on multiple queries simultaneously with persistent session state

Visual Execution Plan Analysis

  • Interactive Graph — Execution plans rendered as navigable node trees
  • Estimate Accuracy — Nodes color-coded by how closely estimated rows match actual rows
  • Detailed Metrics — Hover for costs, timings, buffer usage, loops, and filter statistics
  • Multiple Views — Switch between visual, text, and raw JSON representations

ER Diagram Generation

  • Live Schema Visualization — Generate entity-relationship diagrams from your connected database
  • Relationship Mapping — Foreign keys displayed as labeled edges with ON UPDATE/DELETE actions
  • Interactive Layout — Hierarchical auto-arrangement with drag-to-reposition
  • Export — Save diagrams as PNG or SVG for documentation

Results Grid with Inline Editing

  • Virtualized Rendering — Handle large result sets efficiently
  • Direct Data Editing — Double-click cells to modify values; changes are committed to the database
  • Inline Filtering — Add WHERE and ORDER BY clauses without rewriting queries
  • Export — Download results as CSV

Database Navigator

  • Schema Browser — Hierarchical tree of schemas, tables, views, functions, sequences, and indexes
  • Column Inspector — Data types, nullability, defaults, primary and foreign key indicators
  • Index Details — Type, definition, uniqueness, and size information
  • Context Actions — Right-click to view ER diagrams, set default schema, or generate queries

Connection Management

  • Saved Connections — Store and organize multiple database connections
  • URI Support — Connect using postgres:// connection strings
  • Auto-Reconnect — Automatically connect to your last used database on startup
  • Connection Testing — Verify credentials before connecting

Keyboard Shortcuts

Shortcut Action
Cmd/Ctrl + Enter Execute Query
Cmd/Ctrl + Shift + Enter Run EXPLAIN
Cmd/Ctrl + T New Tab
Cmd/Ctrl + W Close Tab
Cmd/Ctrl + 1-9 Switch to Tab
Shift + Alt + F Format SQL
Escape Cancel Query / Close Panel

Installation

Prerequisites

Build from Source

git clone https://github.com/yourusername/freud.git
cd freud
npm install
npm run tauri dev

Production Build

npm run tauri build

Binaries are output to src-tauri/target/release/.


Usage

  1. Connect — Enter connection details or select a saved connection
  2. Explore — Browse schemas, tables, and relationships in the navigator
  3. Query — Write SQL with autocomplete and real-time validation
  4. Analyze — Run EXPLAIN ANALYZE to visualize execution plans
  5. Optimize — Get AI recommendations and iterate on performance
  6. Document — Export ER diagrams and query results

Configuration

AI Features

  1. Open Settings from the toolbar
  2. Enter your OpenAI API key
  3. Select a model (GPT-4o recommended for best results)

API keys are stored locally and transmitted only to OpenAI.


Tech Stack

Component Technology
Runtime Tauri 2.0 + Rust
Frontend React 19, TypeScript, Vite
Database Driver tokio-postgres
Editor CodeMirror 6
Language Server postgres_lsp
Visualization vis-network
AI OpenAI API

Project Structure

freud/
├── src/                      # React frontend
│   ├── components/           # UI components
│   ├── hooks/                # Custom React hooks
│   ├── contexts/             # State management
│   └── styles/               # CSS modules
├── src-tauri/                # Rust backend
│   ├── src/
│   │   ├── commands/         # Tauri IPC handlers
│   │   ├── lsp/              # LSP integration
│   │   └── lib.rs            # Application core
│   └── Cargo.toml
└── package.json

Contributing

Contributions are welcome. Please open an issue to discuss proposed changes before submitting a pull request.


License

MIT

About

Freud explains

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors