# Introduction DBStudio [#dbstudio] DBStudio is an all-in-one database management and visualization workspace designed for modern development workflows. Whether you're a solo developer or part of a large team, DBStudio provides the tools you need to interact with your data effectively. Key Features [#key-features] } title="Multi-Database Support" href="/docs/getting-started/quick-start"> MySQL, PostgreSQL, and SQLite support with local and remote connections. } title="Table Explorer" href="/docs/features/table-explorer"> Browse tables, view/edit rows, inspect indexes, and understand relationships. } title="Query Editor" href="/docs/features/query-editor"> Full-featured SQL editor with autocomplete, history, and export capabilities. } title="AI Copilot" href="/docs/features/ai-copilot"> Optimize, explain, and discuss queries with state-of-the-art AI models. } title="Natural Language to SQL" href="/docs/features/nl-to-sql"> Write queries in plain English and let AI generate optimized SQL. } title="Data Visualizer" href="/docs/features/data-visualizer"> Transform query results into charts with AI-suggested data analysis. } title="ERD Visualizer" href="/docs/features/erd-visualizer"> Interactive entity-relationship diagrams with sticky notes and auto-layout. } title="Schema Builder" href="/docs/features/schema-builder"> Generate Drizzle or Prisma schemas from your database—no AI needed. } title="API Generator" href="/docs/features/api-generator"> Auto-generate Next.js API routes for every table in your database. } title="Version History" href="/docs/features/version-history"> Snapshot your workspace state, view diffs, and restore previous versions. Collaboration [#collaboration] Built for teams from the ground up: } title="Team Workspaces" href="/docs/collaboration/workspaces"> Personal and shared workspaces with role-based access control. } title="Team Chat" href="/docs/collaboration/team-chat"> Real-time messaging with resource tagging and @mentions. } title="Contextual Comments" href="/docs/collaboration/contextual-comments"> Discuss queries and ERDs directly in context with your team. } title="Webhooks & Integrations" href="/docs/collaboration/webhooks"> Connect to Slack and Discord for real-time activity notifications. Architecture [#architecture] DBStudio uses a hybrid architecture to balance security and convenience: 1. **CLI Agent**: A lightweight Node.js utility you run locally. It connects to your database and establishes a secure WebSocket bridge to our server. 2. **Server**: A high-performance gateway that orchestrates sessions, manages AI context, and handles team collaboration features. 3. **Web Interface**: A responsive, TanStack-powered dashboard where you manage all your database assets. AI Tooling [#ai-tooling] [LLMs.txt](/llms.txt) DBStudio exposes an [llms.txt](/llms.txt) and [llms-full.txt](/llms-full.txt) that helps AI models understand how to interact with your documentation and database tools. Support [#support] DBStudio supports the transition between local development and remote production seamlessly across: * **PostgreSQL** * **MySQL** * **SQLite / Turso** [Get Started with Installation](/docs/installation) # Installation Installation [#installation] The fastest way to get started with DBStudio is through our web-based dashboard and local CLI agent. 1. Create an Account [#1-create-an-account] Head over to [DBStudio Cloud](https://dbstudio.tech/signup) and create your free account. Once logged in, you'll have access to your personal workspace. 2. Install the CLI [#2-install-the-cli] The DBStudio CLI acts as a secure bridge between your local database and the cloud interface. Install it globally using your favorite package manager: ```bash # Using npm npm install -g @dbstudio/cli # Using bun (recommended) bun add -g @dbstudio/cli # Using pnpm pnpm add -g @dbstudio/cli ``` 3. Login via CLI [#3-login-via-cli] Authenticate your local machine with your DBStudio account: ```bash dbstudio login ``` This will open a browser window to complete the authentication process. 4. Connect your first Database [#4-connect-your-first-database] Once logged in, you can start a bridge to a local database. For example, to connect a local PostgreSQL database: ```bash dbstudio connect --type postgresql --database my_local_db --user postgres ``` Next Steps [#next-steps] Now that you have the CLI installed and running, explore how to: * [Manage Connections](/docs/features/connections) * [Explore your Data](/docs/features/table-explorer) * [Collaborate with your Team](/docs/collaboration/workspaces) Having trouble? Check our [Troubleshooting Guide](/docs/getting-started/troubleshooting) or join our [Discord Community](https://discord.gg/dbstudio). # Pricing Pricing Plans [#pricing-plans] DBStudio is built to scale with you, from local exploration to team collaboration. Choose the plan that fits your workflow. Hobby (Free) [#hobby-free] *Experience the full core power of DBStudio* * Up to 3 Saved Connections * 1 Team Bridge connection * 3 DBCopilot suggestions/mo * Natural Language to SQL * Full ERD Visualizer Suite * CSV & JSON Data Exports * 7-day Query History * 3-day Version History [Get Started](/docs/installation) *** Pro [#pro] **$19/month** (Monthly) or **$15/month** (Yearly) *For power users and freelancers* * **Everything in Hobby** * Unlimited Saved & Active Connections * Unlimited AI (Copilot & NL-SQL) * Unlimited API Generations * Unlimited Query History * 30-day Version History * 2 Personal + 1 Team Workspace * Query & ERD Commenting * Advanced Exports (Excel) *** Team [#team] **$60/month** (Monthly) or **$54/month** (Yearly) *The ultimate collaboration engine* * **Everything in Pro** * Full Team Workspace management * Team Chat & Resource tagging * Slack & Discord Integrations * Shared Resource Library * Unlimited Local-to-Team bridge *** Enterprise [#enterprise] **Custom Pricing** *Scalable governance and mapping* * **Everything in Team** * Custom Roadmap influence * Unlimited Team Members * 24/7 Priority Support [Contact Sales](mailto:ruhamabekele156@gmail.com) *** Comparison Table [#comparison-table] | Feature | Hobby (Free) | Pro ($19/mo) | Team ($60/mo) | Enterprise | | :------------------ | :----------: | :------------: | :------------: | :--------: | | **Connections** | Up to 3 | Unlimited | Unlimited | Unlimited | | **AI Copilot** | 3/mo | Unlimited | Unlimited | Unlimited | | **NL to SQL** | ✅ | ✅ | ✅ | ✅ | | **API Generator** | ❌ | ✅ | ✅ | ✅ | | **Team Bridge** | 1 | 1 | Unlimited | Unlimited | | **Version History** | 3 Days | 30 Days | 1 Year | Unlimited | | **Query History** | 7 Days | Unlimited | Unlimited | Unlimited | | **Workspaces** | Personal | 2 Personal | Full Team | Custom | | **Team Chat** | ❌ | ❌ | ✅ | ✅ | | **Data Export** | CSV/JSON | CSV/JSON/Excel | CSV/JSON/Excel | Custom | | **Support** | Community | Email | Priority | Dedicated | # Components Code Block [#code-block] ```js console.log('Hello World'); ``` Cards [#cards] # CLI Commands The DBStudio CLI (`@dbstudio/cli`) is your primary tool for connecting local databases to the cloud dashboard. Commands [#commands] dbstudio connect [#dbstudio-connect] Establish a secure bridge between a local database and DBStudio. **Required Flags:** * `-t, --token `: Your DBStudio connection token (generate this in the dashboard). **Configuration Flags:** * `--type `: Database engine (`postgresql`, `mysql`, `sqlite`, `libsql`). * `-u, --user `: Database username. * `-d, --database `: Database name. * `-h, --host `: Database host (default: `localhost`). * `-p, --port `: Database port. * `--password `: Database password. * `-f, --file `: Path to database file (SQLite only). * `--url `: Full connection string (overrides other params). * `--ssl`: Enable SSL encryption for the connection. **SSH Tunneling:** * `--ssh-host `: SSH tunnel host. * `--ssh-user `: SSH tunnel username. * `--ssh-password `: SSH tunnel password. * `--ssh-key `: Path to SSH private key. dbstudio status [#dbstudio-status] View the status of the local agent and active connections. dbstudio disconnect [#dbstudio-disconnect] Terminate all active database bridges and stop the local agent. *** # Security Security is the cornerstone of DBStudio. Our "Security by Design" approach ensures that you retain full control over your most sensitive asset: your data. 1. Secure Credential Management [#1-secure-credential-management] Your database credentials (host, port, username, password) are encrypted locally and transmitted securely to DBStudio's servers for storage. * The CLI agent reads these values from your local configuration or environment and encrypts them before transmission. * All secrets are stored in an encrypted format, ensuring that your raw database credentials are never exposed in plain text. * The server uses these credentials to authorize and orchestrate the secure bridge between your local agent and the web dashboard. 2. Encrypted Tunnels [#2-encrypted-tunnels] All communication between your local agent and our web dashboard is encrypted using **TLS 1.3**. Even if someone were to intercept the bridge traffic, the data would be unreadable. 3. Data Privacy (The "No Storage" Policy) [#3-data-privacy-the-no-storage-policy] DBStudio is a *client*, not a *database host*. * We do not store your query results. Result sets are processed in memory and streamed directly to your browser. * We do store metadata (query history, schema snapshots) to power version history, but these can be purged at any time. 4. Role-Based Access Control (RBAC) [#4-role-based-access-control-rbac] For Team Workspaces, admins can precisely control who can view schema, execute queries, or manage connections. This prevents accidental data leaks or destructive actions by unauthorized team members. 5. API Keys [#5-api-keys] API keys are used to authenticate your local CLI agent and CI/CD pipelines. * **Encryption at Rest**: All API keys are encrypted using AES-256 before being stored in our database, ensuring that even in the event of a data breach, the keys remain protected. * **Rotation and Revocation**: You can rotate or revoke API keys at any time through the DBStudio settings. Rotating a key immediately invalidates the previous one and generates a new secret, allowing for seamless security updates without downtime. *** # Contextual Comments DBStudio moves architectural discussions out of Slack and directly into your workspace. Contextual Comments allow you to leave feedback on queries, schema definitions, and API configurations. How it Works [#how-it-works] You can leave a comment on almost any entity in DBStudio: * **Query Editor**: Highlight a specific line of SQL and click the comment icon. * **ERD Visualizer**: Discuss the schema design and relationships. Threaded Discussions [#threaded-discussions] Comments support threaded replies, allowing for deep async discussions. Teammates are notified when they are mentioned or when a thread they are participating in is updated. *** Mention teammates using `@username` to bring them into a discussion and ensure they get an immediate notification. # Integrations Keep your team informed with automated notifications pushed to your favorite communication tools. Supported Platforms [#supported-platforms] | Platform | Status | | --------------- | ----------------- | | **Slack** | ✅ Fully supported | | **Discord** | ✅ Fully supported | | **Custom HTTP** | ✅ POST to any URL | Setting Up Webhooks [#setting-up-webhooks] 1. Navigate to **Workspace Settings > Integrations**. 2. Click **Add Webhook**. 3. Select the platform (Slack, Discord, or Custom). 4. Paste your incoming webhook URL. 5. Choose which events to subscribe to. Event Types [#event-types] | Event | Description | | ------------------ | ------------------------------- | | `query_saved` | A team member saves a query | | `erd_published` | Schema changes are published | | `version_snapshot` | A workspace snapshot is created | | `member_joined` | New member joins the workspace | | `all` | Subscribe to all events | Example Payload [#example-payload] ```json { "type": "query_saved", "action": "saved query 'Monthly Revenue Report'", "user": "alice@example.com", "timestamp": "2024-01-15T10:30:00Z", "details": "Query saved to shared library" } ``` Availability [#availability] | Tier | Access | | ----- | ------ | | Hobby | ❌ | | Pro | ❌ | | Team | ✅ | Webhooks are a **Team tier** feature. Upgrade to receive real-time activity notifications. *** # Teams & Members DBStudio is designed to scale from solo developers to large engineering teams. Team management allows you to share database access securely and work together in real-time. Inviting Members [#inviting-members] Workspace admins can invite members by email. Each member can be assigned one of three roles: * **Admin**: Full control over workspace settings, billing, member management, and connection deletion. * **Member**: Can create/edit connections, write queries, and use AI features. * **Viewer**: Read-only access to schema, saved queries, and ERDs. Shared Connections [#shared-connections] The primary benefit of Team Workspaces is **Shared Connections**. An admin can set up a connection to a staging or production database once. Team members with the appropriate roles can then access that database through the DBStudio UI without ever needing to see the raw connection string or password. *** **Important**: Shared connections only work while the relevant CLI agent is running and connected. Ensure your team's bridges are hosted on stable environments for consistent access. # Local DB Bridging Database Bridging (Sharing) [#database-bridging-sharing] One of DBStudio's most powerful features is the ability to bridge a local database (like SQLite or a local PostgreSQL container) to your Team Workspace securely. This allows your team to access local environments without complex VPNs or tunnel setups. How it works [#how-it-works] 1. **Generate a Token**: Log in to the [DBStudio Dashboard](https://dbstudio.tech) and generate a **Connection Token** for your workspace. 2. **Start the Bridge**: Run the DBStudio CLI on your local machine: ```bash dbstudio connect --token ``` 3. **Team Access**: Once the bridge is active, the database appears in the **Shared Connections** section of your Team Workspace. Teammates can now query and visualize the data directly through the web interface. Use Cases [#use-cases] * **Collaborative Debugging**: Share a specific database state with a teammate for instant pair-programming. * **QA & Testing**: Allow QA engineers to test against your local development data before it's pushed to a staging environment. * **Edge Data Access**: Bridge databases running in private networks or local containers to the cloud for analysis. # Team Chat Communicate with your team directly within DBStudio. No more context-switching to Slack just to discuss a query. Features [#features] Real-Time Messaging [#real-time-messaging] Messages are delivered instantly via WebSocket. See when teammates are typing and receive notifications for new messages. @Mentions [#mentions] Tag specific team members with `@username` to notify them directly. Mentioned users receive in-app notifications. Resource Tagging [#resource-tagging] Attach DBStudio resources directly to your messages: | Resource Type | Example | | ------------- | ------------------------------ | | Query | Saved queries from the library | | ERD | Saved ERD diagrams | | Schema | Generated schema files | | API | Generated API endpoints | Write the **#** symbol in the chat and select a resource to include it in your message. Recipients can click through to view or run the resource. Availability [#availability] | Tier | Access | | ----- | --------------------------------- | | Hobby | ❌ (Only one local-to-team bridge) | | Pro | ❌ (Only contextual comments) | | Team | ✅ (Full access) | Team Chat is only available within **Team Workspaces**. Personal workspaces do not include chat. *** # Workspaces Workspaces [#workspaces] DBStudio uses Workspaces to organize your databases and tools. Personal Workspace [#personal-workspace] Every user starts with a free Personal Workspace. Use this for your private projects and local databases. Team Workspace [#team-workspace] Collaboration is at the heart of the **Team** plan. * **Shared Projects**: Any database connections added to a Team Workspace is visible to all members. * **Team Chat**: Built-in chat for team workspaces. Tag members with `@username`. * **Resource Tagging**: Reference specific tables or queries using `#resource` in the chat. * **Role-Based Access**: Control who can access and change resources. # API Generator Stop writing boilerplate. DBStudio's API Generator takes your existing database schema and generates complete, type-safe backend code. Supported ORMs [#supported-orms] * **Drizzle ORM**: Generate modern, type-safe schema definitions and select/insert/update/delete handlers. * **Prisma**: Generate standard `schema.prisma` definitions and client initializations. What is Generated? [#what-is-generated] When you run the generator, DBStudio creates: 1. **Schema Definitions**: Exact TypeScript representations of your tables, indexes, and relations. 2. **Next.js API Routes**: Complete API endpoints for CRUD operations. 3. **Validation Schemas**: Zod or TypeBox validators based on your database constraints. *** The generated code follows industry best practices for separation of concerns and type-safety, allowing you to build APIs that are scalable and maintainable from day one. # Connections Database Connections [#database-connections] DBStudio supports a wide range of database engines and connection types. Supported Engines [#supported-engines] * **PostgreSQL**: Standard, Neon, Supabase, etc. * **MySQL**: Standard, PlanetScale, Tidb, etc. * **SQLite**: Local files and **Turso** (remote). Connection Types [#connection-types] Local Connections [#local-connections] Perfect for development. Just point to your `.sqlite` file or your local PG/MySQL instance. Remote Connections [#remote-connections] Connect to your production or staging databases securely. Credentials are encrypted and stored safely. Multiple Active Connections [#multiple-active-connections] Available on **Pro** and **Team** plans. You can have multiple connections open in different tabs/windows simultaneously, allowing you to compare data or move data between environments easily. Saving Connections [#saving-connections] Save your frequently used connections with custom names and icons for quick access. # Data Visualizer The Data Visualizer lets you turn raw query results into actionable insights through a variety of chart types. Getting Started [#getting-started] After running any query in the [Query Editor](/docs/features/query-editor), click the **Visualize** button to open the Data Visualizer. DBStudio without the help of AI automatically: 1. Detects numeric vs. categorical columns. 2. Suggests the best chart type for your data. 3. Warns you about unique/high-cardinality columns that may not visualize well. Chart Types [#chart-types] | Chart | Best For | | ----------- | ------------------------------------------- | | **Bar** | Comparing categories | | **Line** | Time series and trends | | **Area** | Cumulative trends | | **Pie** | Part-to-whole relationships (≤5 categories) | | **Scatter** | Correlations and dot plots | Configuration [#configuration] Axis Selection [#axis-selection] * **X-Axis**: Choose your categorical or time column. * **Y-Axis**: Select one or more numeric columns to plot. Color Themes [#color-themes] Pick from 8 built-in palettes: * Emerald, Ocean, Sunset, Forest * Pastel, Neon, Monochrome, Vibrant AI Suggestions [#ai-suggestions] **Pro feature**: The AI can suggest which columns produce the most meaningful visualizations based on data cardinality and uniqueness. Data Export [#data-export] Export your visualized data: | Format | Tier | | ------ | ---- | | CSV | All | | JSON | All | | Excel | Pro | *** # ERD Visualizer Understanding a complex schema can be difficult through text alone. DBStudio's ERD (Entity-Relationship Diagram) Visualizer provides an interactive, auto-generated map of your database architecture. Core Features [#core-features] Auto-Generated Diagrams [#auto-generated-diagrams] The ERD Visualizer reads your database schema and renders: * **Tables and Views**: All entities as draggable nodes. * **Foreign Keys**: Animated lines connecting related tables. * **Column Details**: Primary keys, types, nullable flags. Interactive Canvas [#interactive-canvas] * **Auto-Layout**: Dagre-powered algorithm organizes tables for readability. * **Drag & Drop**: Reposition tables freely. * **Zoom & Pan**: Navigate large schemas with ease. * **MiniMap**: Quick overview for complex databases. Draft Mode [#draft-mode] Design new tables before they exist in your database: 1. Click **Add Table** to create a draft node. 2. Define columns, types, and constraints. 3. Draw relationships by connecting column handles. 4. Click **Publish** to generate migration SQL. Migration SQL Generation [#migration-sql-generation] When you publish draft tables, DBStudio generates: * `CREATE TABLE` statements with proper types. * `ALTER TABLE` statements for foreign key constraints. * Compatible syntax for your database type (MySQL/PostgreSQL/SQLite). ```sql CREATE TABLE orders ( id SERIAL PRIMARY KEY, customer_id INTEGER REFERENCES customers(id), total DECIMAL(10,2) NOT NULL, created_at TIMESTAMP DEFAULT NOW() ); ``` Sticky Notes [#sticky-notes] Add sticky notes to annotate your ERD: * Document business logic. * Mark areas for refactoring. * Leave notes for teammates. Saving & Loading [#saving--loading] Save your ERD layout to reload later. Useful for: * Preserving custom arrangements. * Sharing designs with teammates. * Versioning schema evolution. Export [#export] Export your ERD as a **PNG screenshot** for documentation or presentations. *** # Query Editor The Query Editor is where you'll spend most of your time in DBStudio. It's a full-featured SQL development environment built for productivity. Core Features [#core-features] SQL Editing [#sql-editing] * **Syntax highlighting** for MySQL, PostgreSQL, and SQLite. * **Auto-completion** powered by your actual schema (table names, column names, keywords). * **Multiple tabs** for working on several queries simultaneously. * **Error toasts** for syntax issues. Query Execution [#query-execution] Run queries with the **Run** button. Results appear instantly in a scrollable, sortable data grid. ```sql SELECT customers.name, COUNT(orders.id) AS order_count, SUM(orders.total) AS revenue FROM customers JOIN orders ON orders.customer_id = customers.id GROUP BY customers.id ORDER BY revenue DESC LIMIT 10; ``` Query History [#query-history] Every query you run is saved automatically. Access your history from the sidebar to: * Re-run previous queries. * Copy SQL to clipboard. * Compare results over time. Data Export [#data-export] Export your query results in multiple formats: | Format | Tier | | ------ | ---- | | CSV | All | | JSON | All | | Excel | Pro | Click the **Export** dropdown after running a query to download results instantly. AI Integration [#ai-integration] The Query Editor integrates deeply with the [AI Copilot](/docs/features/ai-copilot): * **Explain**: Get a plain-English breakdown of complex queries. * **Optimize**: Receive suggestions for indexes and query rewrites. * **Natural Language**: Type in English and generate SQL automatically. *** # Schema Builder The Schema Builder reverse-engineers your database schema into production-ready TypeScript ORM definitions. Supported ORMs [#supported-orms] | ORM | Output | | ----------- | ----------------------------------------- | | **Drizzle** | `schema.ts` with table definitions | | **Prisma** | `schema.prisma` with models and relations | How It Works [#how-it-works] 1. Select your connected database. 2. Choose your preferred ORM format. 3. Click **Generate**—no AI tokens consumed. 4. Copy to clipboard or download the file. The Schema Builder reads your database's information schema directly and produces accurate type definitions including: * Column types with proper TypeScript mappings. * Primary keys and auto-increment flags. * Foreign key relationships. * Indexes and unique constraints. Example Output (Drizzle) [#example-output-drizzle] ```typescript import { pgTable, serial, text, timestamp, integer } from 'drizzle-orm/pg-core'; export const users = pgTable('users', { id: serial('id').primaryKey(), email: text('email').notNull().unique(), name: text('name'), createdAt: timestamp('created_at').defaultNow(), }); export const posts = pgTable('posts', { id: serial('id').primaryKey(), title: text('title').notNull(), authorId: integer('author_id').references(() => users.id), }); ``` Saving Schemas [#saving-schemas] Save generated schemas to your library for later retrieval. Useful for comparing schema evolution over time. *** # Table Explorer The Table Explorer is the heart of DBStudio's user experience. It provides a spreadsheet-like interface for your database tables, supporting SQLite, PostgreSQL, and MySQL. Core Features [#core-features] Data Browsing [#data-browsing] * **Infinite Scroll**: Millions of rows feel responsive. * **Table Views**: show the tables in the database. * **Editing**: Edit rows in the table. * **Search**: Full-text search across visible columns. Inline Editing [#inline-editing] Double-click any cell to edit data directly. Changes are validated against column constraints before saving. Editing respects foreign key constraints. DBStudio will show detailed error messages for constraint violations. Schema Information [#schema-information] Column Details [#column-details] View metadata for each column: * Type and length. * Nullability. * Default values. * Foreign key references. Indexes [#indexes] See all indexes on a table: | Index Name | Type | Columns | | ------------------- | ------- | ------------ | | `pk_users_id` | PRIMARY | `id` | | `idx_users_email` | UNIQUE | `email` | | `idx_users_created` | INDEX | `created_at` | Relationships [#relationships] Quickly see which tables reference this table (inbound) and which tables this table references (outbound). Adding Tables [#adding-tables] Create new tables directly from the Explorer: 1. Right-click in the sidebar. 2. Select **New Table**. 3. Define columns and constraints. 4. Click **Create**. Usage [#usage] 1. Select a **Connection** in the sidebar. 2. Tables are listed automatically. 3. Click any table to open it in a tab. *** # Version History DBStudio's Version History provides a complete audit trail and recovery system for your database assets. It ensures that you never lose a complex query or wonder "who changed this schema?" What is Tracked? [#what-is-tracked] DBStudio automatically versions the following items within a workspace: 1. **Saved Queries**: Every time you save a query, a new commit is created in the history. 2. **Schema Snapshots**: Snapshots of your database structure (tables, columns, indexes). 3. **API Configurations**: Changes to generator settings or selected tables. Team Collaboration [#team-collaboration] For teams, Version History acts as a shared ledger. You can see exactly which team member optimized a query or updated a connection string, providing accountability and context for architectural changes. *** Version History is preserved for **30 days** on Pro plans, **1 year** on Team plans and **3 days** on Free plans.