|
1 |
| -This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). |
| 1 | +# Next.js Gitee OAuth 示例 |
2 | 2 |
|
3 |
| -## Getting Started |
| 3 | + |
| 4 | + |
4 | 5 |
|
5 |
| -First, run the development server: |
| 6 | + |
| 7 | +这是一个使用 Next.js 15 和 Gitee OAuth 构建的应用示例,展示了如何集成 Gitee 账号登录功能。 |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## 特性 |
| 12 | + |
| 13 | +- ⚡️ [Next.js 15](https://nextjs.org/) 框架,使用 [Turbopack](https://turbo.wiki/pack) 提供极速开发体验 |
| 14 | +- 🔐 集成 [Gitee OAuth](https://gitee.com/api/v5/oauth_doc) 登录 |
| 15 | +- 🎨 基于 [shadcn/ui](https://ui.shadcn.com/) 构建的现代 UI |
| 16 | +- 🌓 支持亮色/暗色主题,可跟随系统设置 |
| 17 | +- 📱 完全响应式设计 |
| 18 | +- 🚀 使用 [pnpm](https://pnpm.io/) 作为包管理器 |
| 19 | + |
| 20 | +## 快速开始 |
| 21 | + |
| 22 | +### 环境要求 |
| 23 | + |
| 24 | +- Node.js >= 18.17.0 |
| 25 | +- pnpm >= 8.0.0 |
| 26 | + |
| 27 | +### 安装 |
6 | 28 |
|
7 | 29 | ```bash
|
8 |
| -npm run dev |
9 |
| -# or |
10 |
| -yarn dev |
11 |
| -# or |
12 |
| -pnpm dev |
13 |
| -# or |
14 |
| -bun dev |
| 30 | +# 克隆项目 |
| 31 | +git clone https://gitee.com/normalcoder/nextjs-gitee-oauth.git |
| 32 | +cd nextjs-gitee-oauth |
| 33 | + |
| 34 | +# 安装依赖 |
| 35 | +pnpm install |
15 | 36 | ```
|
16 | 37 |
|
17 |
| -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
| 38 | +### 开发 |
| 39 | + |
| 40 | +1. 复制环境变量文件: |
| 41 | + ```bash |
| 42 | + cp .env.example .env.local |
| 43 | + ``` |
18 | 44 |
|
19 |
| -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. |
| 45 | +2. 在 `.env.local` 中配置你的 Gitee OAuth 应用信息: |
| 46 | + ```env |
| 47 | + # Gitee OAuth 配置 |
| 48 | + NEXT_PUBLIC_GITEE_CLIENT_ID=你的客户端 ID |
| 49 | + GITEE_CLIENT_SECRET=你的客户端密钥 |
| 50 | + NEXT_PUBLIC_GITEE_REDIRECT_URI=http://localhost:3000/api/auth/callback/gitee |
| 51 | + ``` |
20 | 52 |
|
21 |
| -This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. |
| 53 | +3. 启动开发服务器: |
| 54 | + ```bash |
| 55 | + pnpm dev |
| 56 | + ``` |
22 | 57 |
|
23 |
| -## Learn More |
| 58 | +现在你可以访问 http://localhost:3000 查看应用。 |
24 | 59 |
|
25 |
| -To learn more about Next.js, take a look at the following resources: |
| 60 | +### 构建 |
26 | 61 |
|
27 |
| -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. |
28 |
| -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. |
| 62 | +```bash |
| 63 | +# 生产环境构建 |
| 64 | +pnpm build |
29 | 65 |
|
30 |
| -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! |
| 66 | +# 启动生产服务器 |
| 67 | +pnpm start |
| 68 | +``` |
31 | 69 |
|
32 |
| -## Deploy on Vercel |
| 70 | +## 项目结构 |
| 71 | + |
| 72 | +``` |
| 73 | +. |
| 74 | +├── app/ # Next.js 应用目录 |
| 75 | +│ ├── api/ # API 路由 |
| 76 | +│ ├── dashboard/ # 用户仪表盘页面 |
| 77 | +│ └── page.tsx # 首页 |
| 78 | +├── components/ # React 组件 |
| 79 | +├── lib/ # 工具函数 |
| 80 | +└── public/ # 静态资源 |
| 81 | +``` |
33 | 82 |
|
34 |
| -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. |
| 83 | +## 开源许可 |
35 | 84 |
|
36 |
| -Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. |
| 85 | +本项目基于 [MIT](./LICENSE) 发布 |
0 commit comments