This is a Next.js project bootstrapped with create-next-app.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
- 将
.env.example复制为.env.local,并填写DATABASE_URL。 - 运行
npm run db:migrate。该命令由 Node.js 直接连接 PostgreSQL,不要求本机安装psql,本地与线上环境都可使用。 - 启动项目后访问
/account,即可注册、登录和退出。
迁移文件位于 database/migrations/。每个迁移只会执行一次,执行记录和校验值保存在数据库的 schema_migrations 表中。上线时应在发布流程中先执行 npm run db:migrate,成功后再发布应用;不要把数据库迁移放进 Vercel 的每次 Serverless 请求。
密码使用 bcrypt 强哈希保存;浏览器只保存 HttpOnly、SameSite=Lax 的随机会话令牌,数据库仅保存令牌的 SHA-256 摘要。
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.