Skip to content
/ nextjs-starter Public template

Next.js starter with API Routes and Prisma ORM

Notifications You must be signed in to change notification settings

gdbroman/nextjs-starter

Repository files navigation

nextjs-starter

Kickstart your project with this simple but modern full-stack starter app.

Technologies

  • TypeScript as the programming language
  • Next.js as the React framework
  • Next.js API routes for server-side API routes as the backend
  • Prisma for migrations and database access
  • PostgreSQL as the database
  • NextAuth.js for authentication via GitHub (OAuth)
  • ESLint extended by Prettier for code style
  • Vercel for deployment

Based on Vercel's own Next.js Full-stack Starter.

How to Start Locally

  1. Clone the repository
  2. Install dependencies with yarn
  3. Set up a local PostgreSQL database
  4. Rename .env.template to .env and update DATABASE_URL to your PostgreSQL database URL
  5. Create a GitHub OAuth app, and update the env variables GITHUB_ID and GITHUB_SECRET
  6. Run yarn dev to start the development server locally
  7. Run yarn prisma studio to start the Prisma Studio UI

How to Deploy

  1. Fork this repository (or click the "Use this template" button)
  2. Log in to Vercel and create a new project from the repository
  3. Set up a free PostgreSQL database on Heroku
  4. Create another GitHub OAuth app for production, and update the env variables GITHUB_ID and GITHUB_SECRET
  5. In Vercel, go to Project Settings > Environment Variables and set DATABASE_URL to your Heroku database URL, and GITHUB_ID and GITHUB_SECRET with your production GitHub OAuth app's credentials
  6. Run openssl rand -base64 32 to generate a random string and update the Vercel env variable NEXTAUTH_SECRET with the output, and update NEXTAUTH_URL to https://you-domain.vercel.app/api/auth