-
Setup a database.
Use the predefined
docker-compose.yml
configuration for localpostgres
instance.docker-compose up -d
don't forget about
.env
Also, you can use any DB supported by Prisma(docs)
-
Start developing.
Navigate into your new site’s directory install modules and start it up.
npm i npm run dev
-
Open the source code and start editing!
Your site is now running at localhost:3000!
Open the
starter
directory in your code editor of choice and editsrc/pages/index.tsx
. Save your changes, and the browser will update in real-time!
Starter use Prisma for db queries.
-
Modify your schema file.
Open the
starter
directory in your code editor of choice and editprisma/schema.prisma
. Add Book model for example.model Book { id String @id @default(cuid()) title String authors User[] @relation(references: [id]) published Boolean @default(false) content String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt }
-
Generate migration files.
Use Prisma migrate tool.
prisma migrate dev --create-only --name init
You can find migration files in
prisma/migrations
. -
Apply migration.
Use Prisma migrate tool.
prisma migrate dev
-
Generate new fresh Prisma client.
npm run generate
More info about Prisma Migrate you can find in docs
- Starter use next-auth - it's a complete open source authentication solution for Next.js applications.
- For graphql queries protection and auth rules you can use graphql-shield. Starter has a basic setup for it.
Prisma Studio is a visual editor for your database. Open prisma studio interface:
npm run studio
Starter use ApolloServer and it's provide graphql-playground in dev
mode.
You can find it on localhost:3000/api/graphql
Starter use Apollo Client and it's provide apollo-client-devtools in dev
mode.
To use it you need to install browser extension:
Download for Firefox | Download for Chrome
Use .env.local
on production or .env.development
on dev. Read more
# Database
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/prisma?schema=public"
# Auth providers
AUTH_SECRET="this-is-a-secret-value-with-at-least-32-characters"
NEXTAUTH_URL="http://localhost:3000"
PROVIDER_GITHUB_ID=""
PROVIDER_GITHUB_SECRET=""
PROVIDER_SMTP_HOST=""
PROVIDER_SMTP_PORT=""
PROVIDER_SMTP_USER=""
PROVIDER_SMTP_PASSWORD=""
PROVIDER_SMTP_FROM=""
Before deploy, you need to set up a database.