Prisma Studio is a database visualization tool provided by Prisma. It offers a graphical interface that allows you to easily view, edit, and manage data in your database.
Launch Prisma Studio
Run the following command in the project root directory:
npm run db:studioThis command will launch Prisma Studio and open it in your browser at http://localhost:5555 by default.
Environment Variables: Prisma Studio uses the DATABASE_URL from your .env.local file to connect to the database. Make sure your environment variables are configured correctly.
Using Prisma Studio
Browse Data
After launching, you'll see all database models (User, Account, Session, Subscription, etc.) listed on the left side. Click on any model to view all records in that table.
View Record Details
Click on any record to view detailed information, including:
- All field values
- Related records (through relationship fields)
- Record creation and update times
Edit Records
On the record details page, you can:
- Edit field values: Click directly on field values to edit them
- Add new records: Click the "Add record" button in the top right corner
- Delete records: Click the delete button on the record details page
Search and Filter
Prisma Studio provides search functionality, allowing you to:
- Use the search box on the list page to quickly find records
- Filter by field values
- Sort by fields
View Related Data
When viewing a record, if that record has related models (such as User's subscriptions), you can:
- Click on relationship fields to view lists of related records
- Edit or delete related data directly from the related records list
Practical Use Cases
Development Debugging
Prisma Studio is very useful during development:
- Quick data viewing: View database contents without writing SQL queries
- Test data preparation: Manually create test data to verify functionality
- Issue troubleshooting: Check if data is correctly written to the database
Data Management
For small projects or development environments:
- Data cleanup: Delete test data or expired records
- Data repair: Manually correct erroneous data
- Data import: Although CSV import isn't directly supported, you can manually create records
Important Notes
Production Environment: Prisma Studio should not be used in production environments, as it provides direct access and modification capabilities to the database, posing security risks. Use only in development environments.
Performance: For large datasets, Prisma Studio may load slowly. Consider using pagination or limiting query results.
Using Database Client
Learn how to use Prisma Client for database operations in ShipNowKit. Understand basic operations for querying, creating, updating, and deleting records.
Update Schema and Migrate Changes
Learn how to update Prisma Schema and migrate database changes. Understand how to add new models, modify existing models, and safely apply changes to your database.