Welcome to Superblog
It looks like your database isn't set up yet. Follow the instructions below to get started.
Getting Started
Follow these steps to set up your Next.js & Prisma Postgres Auth Starter:
1. Install Dependencies
After cloning the repo and navigating into it, install dependencies:
npm install
2. Create a Prisma Postgres Instance
Create a Prisma Postgres instance by running the following command:
npx prisma init --db
This command is interactive and will prompt you to:
- Log in to the Prisma Console
- Select a region for your Prisma Postgres instance
- Give a name to your Prisma project
Once the command has terminated, copy the Database URL from the terminal output. You'll need it in the next step.
3. Set Up Your .env File
You need to configure your database connection via an environment variable.
First, create an .env
file:
touch .env
Then update the .env
file by replacing the existing DATABASE_URL
value with the one you previously copied:
DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=PRISMA_POSTGRES_API_KEY"
To ensure your authentication works properly, you'll also need to set env vars for NextAuth.js:
AUTH_SECRET="RANDOM_32_CHARACTER_STRING"
You can generate a random 32 character string for the AUTH_SECRET
with this command:
npx auth secret
4. Migrate the Database
Run the following command to set up your database and Prisma schema:
npx prisma migrate dev --name init
5. Seed the Database
Add initial data to your database:
npx prisma db seed
6. Run the App
Start the development server:
npm run dev
Once the server is running, visit http://localhost:3000
to start using the app.