Database
In this section, we'll guide you through integrating a database into your NextAdmin boilerplate. We use PostgreSQL with Prisma ORM for robust and scalable data management.
1. Configure Database URL
First, you need to obtain a connection string from your database provider (e.g., Supabase (opens in a new tab), Neon (opens in a new tab), or a local PostgreSQL instance).
Once you have the URL, update your .env file:
DATABASE_URL="postgresql://user:password@localhost:5432/nextadmin"2. Sync Database Schema
After configuring the connection, you need to push the Prisma schema to your database and generate the Prisma Client.
Use your preferred package manager to run the following commands:
npx prisma db push npx prisma generate Note: Every time you modify the
prisma/schema.prismafile, you must run thegeneratecommand again to update the Prisma Client.
Next Steps
Now that your database is connected and the schema is synced, you're ready to start building your application logic!