Wednesday, January 8th 2025 · 5 min read
Drizzle Studio: The Complete Guide to Visual Database Management
Learn how to use Drizzle Studio to visually browse, edit, and manage your database. Complete tutorial covering setup, configuration, queries, data editing, and advanced features for PostgreSQL, MySQL, and SQLite.
Drizzle Studio is a powerful visual database browser that comes bundled with Drizzle Kit. It provides a clean, intuitive interface for exploring your database schema, running queries, and editing data—all without leaving your development environment.
What is Drizzle Studio?
Drizzle Studio is a lightweight database GUI that launches directly from your terminal. Unlike standalone database tools like pgAdmin, TablePlus, or DBeaver, Drizzle Studio:
- Understands your schema — It reads your Drizzle schema files directly
- Zero configuration — Uses your existing
drizzle.config.ts - Runs locally — Opens in your browser at
https://local.drizzle.studio - Type-aware — Displays data according to your TypeScript types
Quick Start
If you already have Drizzle ORM set up in your project, launching Studio is simple:
npx drizzle-kit studioOr if you have a custom config path:
npx drizzle-kit studio --config=drizzle.config.tsThis opens Drizzle Studio in your default browser at https://local.drizzle.studio.
Setting Up Drizzle Studio
Prerequisites
- Drizzle ORM installed in your project
- Drizzle Kit as a dev dependency
- A valid drizzle.config.ts configuration file
Installation
npm install drizzle-orm
npm install -D drizzle-kitConfiguration
Create a drizzle.config.ts file in your project root:
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
dialect: 'postgresql', // or "mysql" | "sqlite"
schema: './lib/db/schema/index.ts',
out: './lib/db/migrations',
dbCredentials: {
url: process.env.DATABASE_URL as string
}
});Adding an npm Script
Add a convenient script to your package.json:
{
"scripts": {
"db:studio": "drizzle-kit studio --config=drizzle.config.ts"
}
}Now you can launch Studio with:
npm run db:studioDrizzle Studio Features
1. Schema Browser
The left sidebar displays all your database tables. Click any table to:
- View all columns with their types
- See indexes and constraints
- Understand relationships between tables
2. Data Browser
Select a table to view its data in a spreadsheet-like interface:
- Pagination — Navigate through large datasets
- Sorting — Click column headers to sort
- Filtering — Use the filter bar to narrow results
- Column resizing — Drag column borders to resize
3. Inline Data Editing
Edit data directly in the table view:
- Double-click any cell to edit
- Make your changes
- Press Enter to save or Escape to cancel
- Changes are committed immediately to the database
Warning: Edits are permanent. There's no undo button, so be careful when editing production data.
4. SQL Query Editor
Run custom SQL queries directly in Studio:
SELECT
u.name,
u.email,
COUNT(o.id) as order_count
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
GROUP BY u.id
ORDER BY order_count DESC
LIMIT 10;Results appear in a table below the query editor.
5. Insert New Records
Click the "+" button to add new rows:
- A form appears with all columns
- Fill in the required fields
- Click "Insert" to save
The form respects your schema constraints (NOT NULL, defaults, etc.).
6. Delete Records
Select rows using the checkboxes, then click "Delete" to remove them.
Real-World Schema Example
Here's how a typical SaaS schema looks in Drizzle (the same structure visible in Studio):
import { boolean, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';
export const userTable = pgTable('user', {
id: uuid('id').primaryKey().defaultRandom(),
name: text('name').notNull(),
email: text('email').notNull().unique(),
emailVerified: boolean('email_verified').notNull().default(false),
image: text('image'),
role: text('role').notNull().default('user'),
createdAt: timestamp('created_at', { withTimezone: true })
.notNull()
.defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true })
.notNull()
.defaultNow()
.$onUpdate(() => new Date())
});
export const organizationTable = pgTable('organization', {
id: uuid('id').primaryKey().defaultRandom(),
name: text('name').notNull(),
slug: text('slug').notNull().unique(),
logo: text('logo'),
createdAt: timestamp('created_at', { withTimezone: true })
.notNull()
.defaultNow()
});
export const memberTable = pgTable('member', {
id: uuid('id').primaryKey().defaultRandom(),
organizationId: uuid('organization_id')
.notNull()
.references(() => organizationTable.id, { onDelete: 'cascade' }),
userId: uuid('user_id')
.notNull()
.references(() => userTable.id, { onDelete: 'cascade' }),
role: text('role').notNull().default('member'),
createdAt: timestamp('created_at', { withTimezone: true })
.notNull()
.defaultNow()
});In Drizzle Studio, you'll see these tables with their relationships, making it easy to understand your data model.
Drizzle Studio vs Other Database GUIs
| Feature | Drizzle Studio | pgAdmin | TablePlus | DBeaver |
|---|---|---|---|---|
| Price | Free | Free | $99 | Free |
| Schema-aware | ✅ Yes | ❌ No | ❌ No | ❌ No |
| Zero config | ✅ Yes | ❌ No | ❌ No | ❌ No |
| TypeScript integration | ✅ Yes | ❌ No | ❌ No | ❌ No |
| Multi-database support | ✅ Yes | PostgreSQL only | ✅ Yes | ✅ Yes |
| Inline editing | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
| Query builder | ❌ No | ✅ Yes | ✅ Yes | ✅ Yes |
| ERD diagrams | ❌ No | ✅ Yes | ❌ No | ✅ Yes |
Verdict: Drizzle Studio excels at quick, schema-aware database browsing during development. For complex database administration, use a full-featured tool alongside it.
Common Use Cases
1. Debugging Data Issues
When your app behaves unexpectedly, Studio lets you quickly inspect the actual database state:
npm run db:studioNavigate to the relevant table and verify the data matches your expectations.
2. Seeding Test Data
During development, manually insert test records:
- Open the target table
- Click "+" to add a row
- Fill in test values
- Repeat as needed
3. Cleaning Up Development Data
Select all rows (or use a filter) and delete them to reset your local database state.
4. Verifying Migrations
After running a migration, open Studio to confirm:
- New tables exist
- Columns have correct types
- Indexes are in place
- Constraints are applied
Advanced Configuration
Custom Port
Run Studio on a different port:
npx drizzle-kit studio --port 3333Verbose Mode
Enable detailed logging:
npx drizzle-kit studio --verboseMultiple Databases
If your project uses multiple databases, create separate config files:
npx drizzle-kit studio --config=drizzle.primary.config.ts
npx drizzle-kit studio --config=drizzle.analytics.config.tsTroubleshooting
"Cannot connect to database"
- Verify your
DATABASE_URLenvironment variable is set - Ensure the database server is running
- Check firewall/network settings
# Load env vars before running
dotenv -e .env -- npx drizzle-kit studio"Schema not found"
Ensure your schema path in drizzle.config.ts points to an existing file:
export default defineConfig({
schema: './lib/db/schema/index.ts' // Must exist!
// ...
});"Tables not showing"
If you're using a tablesFilter, ensure it matches your table names:
export default defineConfig({
tablesFilter: ['user_*', 'organization_*'] // Only shows matching tables
// ...
});Best Practices
- Never use Studio on production databases — Accidental edits can cause data loss
- Use for development only — Keep your production database access locked down
- Combine with migrations — Don't use Studio to make schema changes; use migrations instead
- Document your schema — Studio makes it easy to understand your data model; share screenshots with your team
Conclusion
Drizzle Studio is an excellent companion for Drizzle ORM development. It removes the friction of switching to external database tools and provides a fast, schema-aware way to interact with your data.
For a production-ready Next.js starter kit with Drizzle ORM already configured (including Studio), check out Achromatic's Drizzle starter kit.
Related Resources
Related Articles
Prisma Studio: Complete Guide to Visual Database Management
Master Prisma Studio with this comprehensive guide. Learn how to browse, query, edit, and manage your database visually. Covers setup, features, filtering, relations, and best practices for PostgreSQL, MySQL, and SQLite.
Drizzle Starter Kit
Drizzle ORM has been added as an additional starter kit! We've fully ported the monorepo version to Drizzle, providing a lightweight, type-safe and high-performance option that is loved by many.
How to Implement Metered Billing with Stripe in Next.js
Learn how to implement usage-based metered billing with Stripe in your Next.js SaaS. Covers metered subscriptions, usage reporting, and real-time tracking.