本地运行vercel模板项目vercel/nextjs-postgres-auth-starter
官方指南链接:https://vercel.com/templates/next.js/prisma-postgres-auth-starter
关于这个项目
This is a Next.js starter kit that uses NextAuth.js for simple email + password login and a Postgres database to persist the data.
创建项目create-next-app
npx create-next-app nextjs-typescript-starter --example "https://github.com/vercel/nextjs-postgres-auth-starter"
进入nextjs-typescript-starter
cd nextjs-typescript-starter
从.env.example复杂创建.env
填入POSTGRES_URL、AUTH_SECRET
AUTH_SECRET随便填
下面是POSTGRES_URL怎么获取,可以使用本地postgres,也可以使用vercel的云数据库
从https://vercel.com/postgres登录个人控制台;
点击Create databases
复制连接url
回到本地项目
pnpm dev
打开http://localhost:3000/