forked from carrydela/Rs_blog_front
first commit
This commit is contained in:
102
README.md
102
README.md
@@ -1,36 +1,98 @@
|
||||
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).
|
||||
# Minimalist AI Blog Frontend
|
||||
|
||||
## Getting Started
|
||||
## 项目简介
|
||||
|
||||
First, run the development server:
|
||||
基于 Next.js 16 + Rust 后端的极简主义博客系统前端。采用瑞士风格设计(黑白灰配色、Inter 字体),专注于内容展示。
|
||||
|
||||
## 技术栈
|
||||
|
||||
- **框架**: Next.js 16 (App Router)
|
||||
- **语言**: TypeScript
|
||||
- **样式**: Tailwind CSS v4 + @tailwindcss/typography
|
||||
- **渲染**: React Markdown + Rehype Highlight (代码高亮)
|
||||
- **部署**: Docker + Docker Compose
|
||||
|
||||
## 功能特性
|
||||
|
||||
- 🎨 **极简设计**: 纯粹的内容阅读体验,无干扰元素
|
||||
- 📝 **Markdown 支持**: 完美支持 GFM 语法和代码高亮 (GitHub Light 主题)
|
||||
- 📱 **完全响应式**: 适配移动端和桌面端
|
||||
- 🔐 **后台管理**: 集成登录、文章发布、编辑和删除功能
|
||||
- ⚡ **高性能**: 基于 Next.js 静态生成与增量更新
|
||||
- 🐳 **Docker 部署**: 一键构建与启动
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 1. 本地开发
|
||||
|
||||
```bash
|
||||
# 安装依赖
|
||||
npm install
|
||||
|
||||
# 启动开发服务器
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
访问 `http://localhost:3000` 查看效果。
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
### 2. 构建生产版本
|
||||
|
||||
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.
|
||||
```bash
|
||||
npm run build
|
||||
npm start
|
||||
```
|
||||
|
||||
## Learn More
|
||||
## Docker 部署
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
本项目支持使用 Docker Compose 一键部署,无需手动配置 Node.js 环境。
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
### 部署步骤
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
1. **克隆仓库**
|
||||
```bash
|
||||
git clone <your-repo-url>
|
||||
cd rs-blog
|
||||
```
|
||||
|
||||
## Deploy on Vercel
|
||||
2. **配置后端地址**
|
||||
打开 `docker-compose.yml` 文件,修改 `NEXT_PUBLIC_API_URL` 为你的服务器公网 IP 或域名:
|
||||
```yaml
|
||||
args:
|
||||
# 将此处修改为你的服务器 IP 或域名
|
||||
NEXT_PUBLIC_API_URL: http://your-server-ip:8765
|
||||
```
|
||||
> **注意**: 不要使用 `127.0.0.1` 或 `localhost`,因为这是构建在前端代码中的地址,用户浏览器需要能够直接访问该地址。
|
||||
|
||||
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.
|
||||
3. **启动服务**
|
||||
```bash
|
||||
docker-compose up -d --build
|
||||
```
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
4. **查看日志** (可选)
|
||||
```bash
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
服务将在 `http://your-server-ip:3000` 启动。
|
||||
|
||||
## 环境变量
|
||||
|
||||
| 变量名 | 描述 | 默认值 |
|
||||
|--------|------|--------|
|
||||
| `NEXT_PUBLIC_API_URL` | 后端 API 地址 | `http://127.0.0.1:8765` |
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
src/
|
||||
├── app/ # Next.js 页面路由
|
||||
│ ├── admin/ # 后台管理页面
|
||||
│ ├── login/ # 登录页面
|
||||
│ └── posts/ # 文章详情页
|
||||
├── components/ # React 组件
|
||||
│ ├── layout/ # 布局组件 (Header, Footer)
|
||||
│ ├── post/ # 文章相关组件
|
||||
│ └── ui/ # 基础 UI 组件 (Button, Input)
|
||||
├── lib/ # 工具库 (API 客户端, Hooks)
|
||||
└── types/ # TypeScript 类型定义
|
||||
```
|
||||
Reference in New Issue
Block a user