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:

Terminal
npm install

2. Create a Prisma Postgres Instance

Create a Prisma Postgres instance by running the following command:

Terminal
npx prisma init --db

This command is interactive and will prompt you to:

  1. Log in to the Prisma Console
  2. Select a region for your Prisma Postgres instance
  3. 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:

Terminal
touch .env

Then update the .env file by replacing the existing DATABASE_URL value with the one you previously copied:

Terminal
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:

Terminal
AUTH_SECRET="RANDOM_32_CHARACTER_STRING"

You can generate a random 32 character string for the AUTH_SECRET with this command:

Terminal
npx auth secret

4. Migrate the Database

Run the following command to set up your database and Prisma schema:

Terminal
npx prisma migrate dev --name init

5. Seed the Database

Add initial data to your database:

Terminal
npx prisma db seed

6. Run the App

Start the development server:

Terminal
npm run dev

Once the server is running, visit http://localhost:3000 to start using the app.