Skip to content

nathanslee/AI-Agent

Repository files navigation

DataBuddy

A premium full-stack AI-powered database assistant that lets users create and manage custom databases using natural language. Built with modern technologies and featuring a beautiful, responsive UI.

🎯 What Makes This Special

  • Zero SQL Required: Create databases and query data using plain English
  • AI-Powered: GPT-4o-mini generates schemas, SQL queries, and intelligent suggestions
  • Per-User Isolation: Each user gets their own secure, isolated database tables
  • Banking Integration: Sync transactions from your bank accounts via Plaid
  • Beautiful UI: Premium design inspired by Alex Bender's aesthetic
  • Production-Ready: Built with Supabase PostgreSQL, FastAPI, and Next.js 14

πŸš€ Quick Start

Want to get started immediately? Check out QUICKSTART.md for a streamlined setup guide!

For detailed Supabase setup instructions, see SUPABASE_SETUP.md.

Architecture

  • Frontend: Next.js 14 (App Router) + TailwindCSS + shadcn/ui
  • Backend: FastAPI + Python
  • Database: Supabase PostgreSQL (per-user isolated tables)
  • AI: OpenAI GPT-4o-mini
  • Banking: Plaid API

Features

Core Features

  • βœ… User authentication with JWT and bcrypt password hashing
  • βœ… Per-user isolated database storage with Supabase PostgreSQL
  • βœ… Natural language database creation using GPT-4o-mini
  • βœ… Dynamic UI form generation based on schema
  • βœ… AI-powered natural language to SQL query conversion
  • βœ… Database management (create, delete, view)

AI-Powered Features

  • βœ… Smart schema generation from natural language descriptions
  • βœ… Intelligent field suggestions and auto-population
  • βœ… Auto-categorization of items
  • βœ… Expiration date predictions for food items
  • βœ… AI-generated descriptions for database entries
  • βœ… Natural language query interface

Schema Customization

  • βœ… Add, remove, and edit database fields
  • βœ… Enable/disable fields before creation
  • βœ… User-friendly field type labels (Number, Text, Date, etc.)
  • βœ… Optional vs required field configuration
  • βœ… Real-time schema preview

Banking Integration

  • βœ… Plaid banking integration for transaction sync
  • βœ… Automatic transaction mapping to database schema
  • βœ… Secure token management

Design & UX

  • βœ… Premium Alex Bender-inspired design
  • βœ… Custom hero image on landing page
  • βœ… Smooth animations with Framer Motion
  • βœ… Responsive design for mobile and desktop
  • βœ… Glass morphism and 3D effects
  • βœ… Modern typography with Inter Tight font

Project Structure

/
β”œβ”€β”€ backend/              # FastAPI backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py
β”‚   β”‚   β”œβ”€β”€ database.py  # PostgreSQL/Supabase integration
β”‚   β”‚   β”œβ”€β”€ models.py
β”‚   β”‚   β”œβ”€β”€ auth.py
β”‚   β”‚   β”œβ”€β”€ ai_agent.py
β”‚   β”‚   β”œβ”€β”€ sql_validator.py
β”‚   β”‚   └── plaid_integration.py
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── .env             # Contains DATABASE_URL for Supabase
β”‚
└── frontend/             # Next.js frontend
    β”œβ”€β”€ app/
    β”œβ”€β”€ components/
    β”œβ”€β”€ lib/
    └── public/

Setup Instructions

Backend Setup

  1. Set up Supabase (see SUPABASE_SETUP.md for detailed guide):

    • Create account at https://supabase.com
    • Create new project
    • Get your DATABASE_URL from Project Settings β†’ Database
  2. Navigate to backend:

cd backend
  1. Create virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Create .env file:
DATABASE_URL=postgresql://postgres:[PASSWORD]@db.xxxxx.supabase.co:5432/postgres
OPENAI_API_KEY=your_openai_key
PLAID_CLIENT_ID=your_plaid_client_id
PLAID_SECRET=your_plaid_secret
PLAID_ENV=sandbox
JWT_SECRET=your_super_secret_jwt_key
  1. Run backend:
uvicorn app.main:app --reload --port 8000

The database tables will be created automatically on first startup!

Frontend Setup

  1. Navigate to frontend:
cd frontend
  1. Install dependencies:
npm install
  1. Create .env.local:
NEXT_PUBLIC_API_URL=http://localhost:8000
  1. Run frontend:
npm run dev
  1. Open browser:
http://localhost:3000

API Endpoints

Authentication

  • POST /api/auth/signup - Create account
  • POST /api/auth/login - Login
  • GET /api/auth/me - Get current user

Databases

  • GET /api/databases - List user databases
  • POST /api/databases/create - Create database via natural language
  • DELETE /api/databases/{db_id} - Delete database

Data Operations

  • POST /api/execute/sql - Execute SQL query
  • POST /api/execute/natural - Natural language command
  • GET /api/data/{db_id} - Get all data from database
  • POST /api/data/{db_id}/insert - Insert data via form

AI Features

  • POST /api/ai/suggest-expiration - Get expiration date suggestion
  • POST /api/ai/categorize - Auto-categorize item

Plaid

  • POST /api/plaid/create-link-token - Get Plaid Link token
  • POST /api/plaid/exchange-token - Exchange public token
  • POST /api/plaid/sync-transactions - Import transactions

Developer Notes

What YOU Must Provide

  1. Supabase project and DATABASE_URL
  2. API keys in .env files
  3. Secure hosting environment for deployment (Vercel, Render, Fly.io, etc.)

What Users Provide

  1. Email + password for account
  2. Natural language database descriptions
  3. Optional: Plaid banking credentials

Security Features

  • βœ… Password hashing with bcrypt
  • βœ… JWT token authentication
  • βœ… SQL injection prevention
  • βœ… User isolation (users can only access their own data)
  • βœ… Destructive operation confirmation
  • βœ… Input validation and sanitization

Design Philosophy

The UI follows the premium Alex Bender aesthetic:

  • Soft white backgrounds with lilac/purple tints
  • Floating 3D glass elements
  • Smooth gradients and shadows
  • Modern typography (Inter Tight)
  • Generous whitespace
  • Fluid animations

Credits

Initial codebase architecture and implementation assisted by Claude (Anthropic).

License

MIT

About

A premium full-stack AI-powered database assistant that lets users create and manage custom databases using natural language. Built with modern technologies and featuring a beautiful, responsive UI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors