静态页面,按需交互
主要页面由 Astro 生成静态 HTML;导航、主题与语言切换、表单、证书信息和 Chat 等交互再由 React 负责,因此公开内容不依赖浏览器完成加载后才能阅读。
PersonalWeb
我同时把 PersonalWeb 当作中英双语作品集和一个持续维护的工程项目。公开页面由 Astro 生成,交互部分使用 React,AI Chat 由 Flask 后端提供,Nginx 让网站与 API 保持同源。仓库还记录了各部分如何测试、部署和维护。
主要页面由 Astro 生成静态 HTML;导航、主题与语言切换、表单、证书信息和 Chat 等交互再由 React 负责,因此公开内容不依赖浏览器完成加载后才能阅读。
独立 Chat 页面和首页浮动窗口使用同一个站内地址。导览问题只依据网站和公开仓库信息回答,浮动窗口的加载协议与模型请求分别维护。
Vitest、Playwright 浏览器检查、Astro 构建、GitHub Actions,以及公开记录的 Nginx 与 CSP 约束,让每次变更都能被检查和重复执行。
PersonalWeb
I maintain PersonalWeb as both my bilingual portfolio and a working engineering project. Astro serves the public pages, React handles focused interactions, Flask powers Chat, and Nginx keeps the site and API on one origin. The repository also shows how I test, deploy, and document each part.
Astro renders the main pages as static HTML. React is reserved for navigation, theme and language controls, forms, certification details, and Chat, so public content remains readable before hydration.
The direct Chat page and floating widget share the same-origin route. Guided questions use public information from this site and its repositories, while the iframe-ready protocol stays separate from model requests.
Vitest, Playwright browser checks, Astro builds, GitHub Actions, and documented Nginx and CSP constraints make changes inspectable and repeatable.
Click here to view the English Version in Github
这是我维护的个人网站,也是一个持续演进的公开工程项目。它把中英双语作品集、AI 对话、 技术文档、测试和自动部署放在同一个可审查的代码库中。
网站链接: 🌐 www.rendazhang.com
公开页面也包含 SEO / GEO、结构化数据和 AI 摘要入口,方便搜索与阅读。
我同时把 PersonalWeb 当作中英双语作品集和一个持续维护的工程项目。主要页面由 Astro 生成静态 HTML,导航、主题、语言、表单、证书信息和 Chat 等交互再由 React 负责。
AI Chat 提供独立页面和首页浮动窗口;两者通过同源地址连接 Flask 后端。导览问题只依据网站和 公开仓库信息回答,普通 Chat 仍保留原有请求方式。
Vitest、Playwright 浏览器检查、Astro 构建和 GitHub Actions 组成可重复执行的验证与发布流程。 仓库还记录了前端、后端、Nginx、CSP、目录所有权和运维命令之间的边界。
可以从以下入口继续了解:
PersonalWeb 是我持续维护的个人项目,不能说明高流量规模、私人客户系统或大型商业 SaaS。 公开仓库不会包含密钥、访客消息、表单内容、私人日志或服务器细节。
另一个公开仓库 📁 Renda Cloud LAB 聚焦云原生服务器架构,可用于查看与 PersonalWeb 不同的设计范围。
| 分类 | 技术 |
|---|---|
| 前端 | Astro, React, TypeScript |
| 状态管理 | React useState、useContext(可扩展 Zustand 等) |
| 构建工具 | Astro 内置 (基于 Vite) |
| 后端 | Flask + OpenAI API |
| 部署 | GitHub Actions + Nginx |
src/
├── assets/
├── constants/ # 站点元信息、资源路径与应用设置
├── features/ # 按业务划分的模块
│ ├── chat/
│ │ ├── components/
│ │ ├── hooks/
│ │ └── services/
│ └── auth/
│ ├── components/
│ ├── hooks/
│ └── services/
├── hooks/ # 业务逻辑自定义 hooks
├── styles/
│ ├── core/ # 核心变量
│ │ ├── tokens.css # 设计 Token(颜色、间距等)
│ │ └── _gradients.css # 渐变系统
│ ├── components/ # 组件样式
│ ├── utilities/ # 工具类
│ └── theme.css # 主入口文件
├── scripts/
├── utils/ # 通用工具函数
├── models/ # 领域模型
├── services/ # API interaction layer
└── components/
├── ui/
├── layouts/
├── forms/
├── chat/
├── sections/
└── providers/
ASCII 图示:
Web Application Architecture
============================
Frontend (
Astro + React
- 负责用户界面和交互
) → CI/CD (
GitHub Actions 自动构建部署
) → Server (
Ubuntu (操作系统)
↓
Nginx (静态文件服务)
↓
systemd 服务 (进程管理)
↓
Gunicorn + Gevent (WSGI 服务器)
↓
Backend: Flask App (处理业务逻辑和 API 请求)
)
Mermaid Flow 图示:
flowchart TD
A[Web] --> B[Frontend: Astro + React]
A --> C[Server]
B -->|负责用户界面和交互| C
subgraph Server
direction TB
D[Ubuntu: 操作系统] --> E[Nginx: 静态服务]
E --> F[systemd 服务: 进程管理]
F --> G[Gunicorn + Gevent: WSGI 服务器]
G --> H[Backend: Flask App: 处理业务逻辑和 API 请求]
end
本仓库就是前端项目:📁 Renda Zhang WEB
src/layouts/BaseLayout.astro 是站点的全局页面框架,用于设置 <head> 元信息、SEO 标签以及根级插槽。导航栏与汉堡菜单虽然依赖浏览器环境,但现在通过 client:load 先在服务端渲染静态结构,再在客户端水合以避免语言闪烁等问题。保留该文件为 Astro 组件的主要考虑如下:
client:load 在服务端输出静态 HTML 后于客户端水合,其余内容保持零 JS,以最小化 bundle 体积。如果整体改写为 React,会带来额外脚本和水合开销。<slot>、is:inline 等 Astro 专属语法在布局中被广泛使用,若迁移到 React 需额外封装或插件支持,增加维护成本。只有在计划将站点全面迁移到 React,或需要在布局层共享复杂的 React 状态/上下文时,才考虑改写 BaseLayout.astro。在现阶段,维持 Astro 版本更简洁高效。
为满足 Nginx 的 CSP 限制并在 404/500 等纯静态页面中复用主题与语言逻辑,原有的内联初始化脚本已抽离为阻塞式外部脚本 /js/base-layout-init.js。该文件由 src/scripts/base-layout-init.ts 编译生成,并通过 data-theme-key、data-palette-key、data-lang-key 等属性向脚本传递存储键,在渲染前完成主题 mode、调色板和语言初始化。
安装依赖并启用 pre-commit:
npm install
pip install pre-commit
pre-commit install
运行本地开发服务器:
npm run dev
构建并预览生产版本:
npm run build
npm run preview
如需连接自定义后端接口,可在根目录 .env / .env.local 文件设置 PUBLIC_API_BASE_URL:
PUBLIC_API_BASE_URL=https://api.example.com
Sentry 集成还需要以下变量:
SENTRY_DSN=<server dsn>
PUBLIC_SENTRY_DSN=<browser dsn>
SENTRY_PROJECT=<your project>
SENTRY_AUTH_TOKEN=<auth token>
本地检查或提交前如需跳过 Sentry 上报,可临时添加环境变量:
SKIP_SENTRY=true pre-commit run --all-files
SKIP_SENTRY=true npm run astro -- check --incremental
如需临时跳过 ESLint 检查以加快提交,可设置:
SKIP_ESLINT=true pre-commit run --all-files
环境变量说明
本地可以配置在 .env 或者 .env.local,并通过 src/utils/env.ts 的 getEnv() 读取:
# 公开信息
PUBLIC_SITE_BASE_URL = "https://www.rendazhang.com"
PUBLIC_CDN_BASE="https://cdn.jsdelivr.net/gh/rendazhang/rendazhang@1.0.1/"
PUBLIC_API_BASE_URL="/cloudchat"
PUBLIC_SENTRY_DSN="https://e184a284f1b7342d197ee0a0151f8353@o4509770577543168.ingest.us.sentry.io/4509770780377088"
PUBLIC_TAG_NAME="v1.0.1"
NODE_ENV="production"
PUBLIC_NODE_ENV="development" # 本地调试覆盖为 development
SKIP_SENTRY="true" # 跳过 Sentry
SKIP_ESLINT="true" # 跳过 ESLint 检查
# 敏感配置(如下为示例)
SENTRY_AUTH_TOKEN="sntrys_xxx"
SENTRY_DSN="https://private-key@xxx.ingest.us.sentry.io/xxx"
SENTRY_PROJECT="xxx"
SENTRY_ORG="xxx"
执行 npm run build 后,dist/_astro 目录会生成带有哈希后缀的静态文件,方便浏览器长时间缓存。
浏览器访问 http://localhost:4321 查看效果。
构建后的静态文件可使用 npm run preview 验证。
Push 到 master 分支会触发 GitHub Actions 自动部署:
actions/checkout@v5 检出代码。actions/setup-node@v6 安装 Node.js 24,并启用 npm 缓存。npm ci,以 package-lock.json 为准安装依赖。npm run sync、npm run lint、npm run typecheck、npm run check 和 npm run test:coverage。npm run build 生成 dist/ 静态文件;生产环境会删除 source map。appleboy/scp-action 将 dist/ 内容上传到服务器指定目录(如 /var/www/html)。本地提交不会自动运行完整 Astro 检查,如需校验请手动执行:
npm run check
需要在仓库 Secrets 中配置服务器 IP、SSH 用户和私钥等信息。详情见 📄 配置 GitHub Actions。
部署完成后可直接访问各模块页面。
如下是我的网站的每个页面的链接:
关于网站的核心功能体系,请参考以下文档链接:📄 核心功能体系。该文档详细描述了网站的核心功能模块,包括功能设计和技术实现,是开发与维护的重要参考。
各页面核心职责如下(均由 .astro 文件生成):
index.astro:主页,也是张人大介绍页,展示张人大的信息、教育、技能、博客及工作经验。certifications.astro:证书列表页。deepseek_chat.astro:AI 聊天界面。docs.astro:技术文档页面。profile.astro:用户账号信息页。login.astro:登录页。register.astro:注册页。404.astro,500.astro:错误页面。返回主页
导航栏菜单跳转
client:load 在客户端水合,既保留交互又避免 Hydration 报错。登录页面跳转
Mermaid Flow 图示:
flowchart TD
A[主页] -->|汉堡菜单| B[AI 聊天页]
A -->|汉堡菜单| C[证书页]
A -->|汉堡菜单| D[技术文档页]
A -->|汉堡菜单| F[账号信息页]
A -->|人像图标| E[登录页面]
B -->|主页按钮| A
C -->|主页按钮| A
D -->|主页按钮| A
E -->|主页按钮| A
F -->|主页按钮| A
style A fill:#9f9,stroke:#333
style B fill:#f9f,stroke:#333
style C fill:#ff9,stroke:#333
style D fill:#99f,stroke:#333
style E fill:#f99,stroke:#333
style F fill:#9ff,stroke:#333
index.astro:多 Section 主页,包含 "Hero"、"自我介绍"、"教育"、"博客"、"技能与能力"、"经历"、"联系我吧" 等模块,并默认悬挂 ChatWidget 浮标。certifications.astro:栅格卡片形式展示证书,并嵌入 Credly 验证链接。deepseek_chat.astro:由聊天记录区域与输入框组成的对话界面,支持流式输出并实时渲染 AI 返回的 Markdown 内容,提供一键复制原始内容的功能,并在页面刷新后自动保留历史记录,同时加载 github-code-highlight.css 和 github-markdown-light.css 以保持代码高亮与排版一致。聊天组件已拆分为 ChatMessageList、ChatInput 等子组件,方便复用与维护。docs.astro:技术文档页面,使用同样的两份 GitHub 样式表配合 highlight.js 渲染 Markdown 与代码。profile.astro:账号信息页,展示当前登录用户的信息。login.astro:登录表单页。register.astro:注册表单页。404.astro / 500.astro:用于处理页面不存在(404)和服务器内部错误(500)的定制化错误页面,提供清晰的错误信息、友好的用户引导和返回主页的链接,以提升用户体验。自适应布局:优化页面在不同设备上的显示效果,减少不必要的资源加载和布局计算,从而提高性能。确保页面在不同屏幕尺寸(如桌面、平板、手机)上都能良好显示,提升用户体验。
懒加载:所有图片开启了懒加载 + Loading 动画,其中,针对高清图片采用 LQIP 懒加载优化(比如主页的 Hero 区域)
项目的核心色彩使用 OKLCH 设计令牌并通过 color-mix 提供 sRGB 回退,以保证明暗模式下的感知一致性。
详情参考文档内容:📄 配色方案
后端部署的具体步骤和配置,请参考以下项目:📁 Python Cloud Chat。该项目提供了完整的后端实现和部署指南,帮助您快速搭建和运行后端服务。
前端项目通过 GitHub Actions 自动化构建后,会直接推送到服务器的
/var/www/html目录,并由 Nginx 提供静态资源服务。
关于 Nginx 的详细配置和操作说明,请查看以下仓库:📁 Nginx Conf。该仓库包含了常用的 Nginx 配置文件和使用示例,方便您快速上手。
为充分利用构建生成的指纹文件,可在 Nginx 中为
/_astro/路径添加长效缓存配置:
location /_astro/ {
access_log off;
add_header Cache-Control "public, max-age=31536000, immutable";
}
如果您需要更重量级的服务器解决方案,可以参考我的云原生项目:📁 Renda Cloud LAB。该项目提供了基于云原生的完整架构设计,适用于大规模和高可用性场景。
项目采用
master/develop双主线,并约定feature、hotfix、experiment等分支的命名规范与合并策略,详见:📄 Git Workflow。
deploy.yml定义了推送到master时触发的自动部署流程,包括标签管理、发布分支与环境变量映射等,可参考:📄 CI / CD Pipeline。
前端验证、deploy run 检查、deploy log 噪声分类、依赖审计、后端/Nginx docs-only 同步规则、生产只读检查和本地 roadmap 维护命令见:📄 Operations Maintenance Guide。
当前 dependency audit / Dependabot 状态、
npm audit fix --force禁止原因、Astro 7 实施结果和安全补丁升级阈值见:📄 Dependency Security Risk Register。
Astro 7 的 Go/No-Go 结论、实施结果、目标包集合、Vite 8/Rolldown 风险、Sentry source-map、CSP、Chat Widget smoke 和回滚计划见:📄 Astro 7 Upgrade Precheck。
Astro 6 升级前的当前基线、目标包集合、Node/Vite/Sentry 兼容性风险、验证清单和回滚策略见:📄 Astro 6 迁移预检。
Astro 页面、
BaseLayout、React Islands、Hydration、服务层、工具函数、样式 Token、CSP 与 iframe 约束的当前约定见:📄 前端架构约定。
src/components、src/services、src/utils、src/styles、src/content、src/stores和src/controllers的目录职责边界见:📄 前端目录所有权地图。
浮动 Chat Widget 与
/deepseek_chat/同源 iframe 的postMessageready 协议、origin/source 校验、加载生命周期和后续重构约束见:📄 Chat Widget 协议说明。
Phase 8 的浏览器 smoke、hydration 安全、主题 mode 与 palette/accent 分离、调色板切片顺序和交互标准规划见:📄 前端体验平台 RFC。
modal、popover/menu、toast/status、loading、disabled/empty/error state、键盘行为、focus 管理和 browser smoke 门禁见:📄 交互组件标准。
Phase 15 的中英文写作语气、第一人称表达、技术术语、CTA、证据边界、视觉个性和 owner 输入规则见:📄 Human Voice And Personal Expression。
Phase 10 的个人品牌内容、可信证明、PersonalWeb 项目证明、证书、工作/学习经历与 SEO/GEO 一致性规划见:📄 内容可信度与个人定位。
Phase 11 的访客路径、隐私安全匿名事件、first-party telemetry 边界和 Chat Guide 公开内容范围见:📄 Site Intelligence And Visitor Journey。
Phase 14 的作品证明、访问路径、PersonalWeb case-study surface、首页 proof path、Chat Guide 入口和浏览器/移动端转化 QA 规划见:📄 Portfolio Proof And Visitor Conversion。
Phase 12 的 Chat Guide 公开知识边界、答案质量问题、后端公共知识包方案和后续切片顺序见:📄 Chat Guide Quality Architecture。
canonical host、sitemap、
llms.txt、/docs/SSR 正文和 soft-404 验证规则见:📄 SEO / GEO 维护说明。
前端开发过程中遇到的 BUG 及其解决方案,请参考以下文档:📄 前端 BUG 跟踪数据库。该文档详细记录了 BUG 的描述、复现步骤、解决方案以及相关开发者的处理记录,帮助您快速定位和解决问题。
项目的功能需求、优先级以及开发计划,请参考以下文档:📄 项目需求清单。该文档列出了当前版本的所有需求,并提供了需求的详细描述和开发状态,方便您了解项目进展和规划开发任务。
用户认证与密码重置的页面路由、API 契约、密码策略和安全注意事项等内容,请参考:📄 用户鉴权规范。
前端目前采用 Astro + React 的架构,基于分层设计理念,通过 GitHub Actions 实现自动化构建,并将构建产物部署到服务器 Nginx 的指定目录下。
具体的从原生前端升级的操作步骤,请参考以下文档内容:📄 升级计划。该文档详细描述了从旧版原生前端逐步迁移到基于 Astro 和 React 的新前端架构的完整计划与实施步骤。
开发环境准备的具体步骤,请参考以下文档内容:📄 环境准备。该文档详细说明了如何完成开发环境的配置以及 Astro 项目的初始化工作,确保您能够顺利开始后续的开发任务。
网站图片通过自动化脚本生成响应式版本并内置 LQIP 占位效果,方便在不同设备上快速加载。
详细操作流程与扩展指南请参阅:📄 通用响应式图片处理系统维护文档
Sentry 用于收集运行时异常与网络错误。配置步骤请见 📄 错误跟踪集成.
src/utils/env.ts、src/utils/langUtils.ts、src/utils/storage.ts 与 src/utils/logger.ts 提供统一的环境变量访问、语言解析、多后端存储方案与可扩展的日志接口。
文档详见:📄 工具函数参考文档.
详细预提交钩子说明请参阅:预提交钩子综合指南
项目使用 Vitest 进行单元测试。运行 npm test 即可执行所有测试;npm run test:watch 可在开发过程中持续监听;如需覆盖率报告,可使用 npm run test:coverage。测试文件需以 .test.ts 或 .spec.ts 命名,通常与源码放在同一目录或 __tests__ 子目录下。更多示例与编写说明参见:测试指南。
汇总从 JavaScript 到 TypeScript 的完整迁移过程与经验,包括配置、分步策略和常见报错排查。详见:📄 JS ➜ TS 全量迁移实战指南。
介绍项目的 CSS 架构、基于 OKLCH 的设计 Token 体系与构建流程,展示
postcss-import如何在编译阶段内联theme.css引用的核心与工具样式以减少运行时请求,详见:📄 样式说明。
# 如果还没安装虚拟环境,执行命令:python -m venv venv
source venv/bin/activate
pip install pre-commit
pre-commit install
index.ts 文件✅ 所有提交必须通过 pre-commit 检查;CI 会阻止不符合规范的 PR
本项目以 MIT 许可证 发布,你可以自由使用与修改。请在分发时保留原始许可证声明。
⏰ 维护者:@张人大 — 如果本项目对你有帮助,请不要忘了点亮 ⭐️ Star 支持我们!
This is my personal website and an evolving public engineering project. It brings a bilingual portfolio, AI Chat, technical documentation, tests, and automated delivery into one inspectable repository.
Live Site: 🌐 www.rendazhang.com
The public pages also include SEO/GEO, structured data, and an AI-summary entry point.
I maintain PersonalWeb as both a bilingual portfolio and a working engineering project. Astro generates the main pages as static HTML, while React handles navigation, theme and language controls, forms, certification details, and Chat.
AI Chat is available as a direct page and as a floating homepage window. Both use a same-origin route to the Flask backend. Guided questions use public site and repository information, while ordinary Chat keeps its existing request path.
Vitest, Playwright browser checks, Astro builds, and GitHub Actions provide a repeatable validation and delivery path. The repository also documents the boundaries between the frontend, backend, Nginx, CSP, directory ownership, and routine operations.
Continue with:
PersonalWeb is a maintained personal project. It does not demonstrate high-traffic scale, private customer systems, or a large commercial SaaS. The public repository leaves out secrets, visitor messages, form contents, private logs, and server details.
Another public repository, 📁 Renda Cloud LAB, focuses on cloud-native server architecture and shows a different project scope from PersonalWeb.
| Category | Technologies |
|---|---|
| Frontend | Astro, React, TypeScript |
| State Management | React useState, useContext (Zustand compatible) |
| Build Tools | Astro built-in (Vite-based) |
| Backend | Flask + OpenAI API |
| Deployment | GitHub Actions + Nginx |
src/
├── assets/
├── constants/ # Site metadata, asset paths, and app settings
├── features/ # Feature-based modules
│ ├── chat/
│ │ ├── components/
│ │ ├── hooks/
│ │ └── services/
│ └── auth/
│ ├── components/
│ ├── hooks/
│ └── services/
├── hooks/ # Custom hooks for business logic
├── styles/
│ ├── core/ # Core variables
│ │ ├── tokens.css # Design tokens (colors, spacing, etc.)
│ │ └── _gradients.css # Gradient system
│ ├── components/ # Component styles
│ ├── utilities/ # Utility classes
│ └── theme.css # Main entry file
├── scripts/
├── utils/ # Utility helpers
├── models/ # Domain models
├── services/ # API interaction layer
└── components/
├── ui/
├── layouts/
├── forms/
├── chat/
├── sections/
└── providers/
ASCII Diagram:
Web Application Architecture
============================
Frontend (
Astro + React
- Handles UI and interactions
) → CI/CD (
GitHub Actions auto-build & deploy
) → Server (
Ubuntu (OS)
↓
Nginx (static file serving)
↓
systemd service (process management)
↓
Gunicorn + Gevent (WSGI server)
↓
Backend: Flask App (business logic & API handling)
)
Mermaid Flow Diagram:
flowchart TD
A[Web] --> B[Frontend: Astro + React]
A --> C[Server]
B -->|Handles UI and interactions| C
subgraph Server
direction TB
D[Ubuntu: OS] --> E[Nginx: Static serving]
E --> F[systemd: Process management]
F --> G[Gunicorn + Gevent: WSGI server]
G --> H[Backend: Flask App: Business logic & APIs]
end
This repository contains the frontend project: 📁 Renda Zhang WEB
src/layouts/BaseLayout.astro serves as the global page framework for the site, responsible for setting <head> metadata, SEO tags, and root-level slots. The navigation bar and hamburger menu now render on the server and hydrate with client:load, avoiding language flicker while preserving interactivity. The primary reasons for keeping this file as an Astro component are as follows:
client:load. The rest of the layout remains zero-JS, keeping bundle size minimal. Rewriting the entire layout in React would introduce additional script and hydration overhead.<slot> and is:inline is extensively used in the layout. Migrating to React would require additional encapsulation or plugin support, increasing maintenance costs.Consider rewriting BaseLayout.astro only if there are plans to fully migrate the site to React or if there is a need to share complex React state/context at the layout level. For now, maintaining the Astro version is more concise and efficient.
To satisfy Nginx CSP restrictions and allow static pages like 404/500 to reuse theme and language logic, the former inline initialization script has been moved to a blocking external script /js/base-layout-init.js. The file is generated from src/scripts/base-layout-init.ts and passes storage keys via data-theme-key, data-palette-key, and data-lang-key attributes so that theme mode, palette, and language are applied before the page renders.
Install dependencies and enable pre-commit:
npm install
pip install pre-commit
pre-commit install
Start local dev server:
npm run dev
Build and preview production version:
npm run build
npm run preview
To connect to a custom backend API, set the PUBLIC_API_BASE_URL in the root directory's .env / .env.local file:
PUBLIC_API_BASE_URL=https://api.example.com
Sentry integration also requires:
SENTRY_DSN=<server dsn>
PUBLIC_SENTRY_DSN=<browser dsn>
SENTRY_PROJECT=<your project>
SENTRY_AUTH_TOKEN=<auth token>
When running local checks or pre-commit without Sentry, prepend:
SKIP_SENTRY=true pre-commit run --all-files
SKIP_SENTRY=true npm run astro -- check --incremental
To temporarily skip ESLint checks and speed up commits, use:
SKIP_ESLINT=true pre-commit run --all-files
Environment Variables Explanation
Local configurations can be set in .env or .env.local, and read via the getEnv() function in src/utils/env.ts:
# Public Information
PUBLIC_SITE_BASE_URL = "https://www.rendazhang.com"
PUBLIC_CDN_BASE="https://cdn.jsdelivr.net/gh/rendazhang/rendazhang@1.0.1/"
PUBLIC_API_BASE_URL="/cloudchat"
PUBLIC_SENTRY_DSN="https://e184a284f1b7342d197ee0a0151f8353@o4509770577543168.ingest.us.sentry.io/4509770780377088"
PUBLIC_TAG_NAME="v1.0.1"
NODE_ENV="production"
PUBLIC_NODE_ENV="development" # Override to "development" for local debugging
SKIP_SENTRY="true" # Skip Sentry
SKIP_ESLINT="true" # Skip ESLint checks
# Sensitive configurations (example values below)
SENTRY_AUTH_TOKEN="sntrys_xxx"
SENTRY_DSN="https://private-key@xxx.ingest.us.sentry.io/xxx"
SENTRY_PROJECT="xxx"
SENTRY_ORG="xxx"
After running npm run build, the dist/_astro directory will contain fingerprinted files with hash suffixes, allowing browsers to cache them long-term.
Access via http://localhost:4321.
Verify builds using npm run preview.
Pushing to master triggers GitHub Actions Auto-Deployment:
actions/checkout@v5.actions/setup-node@v6 and enable npm caching.npm ci so dependency installation is based on package-lock.json.npm run sync, npm run lint, npm run typecheck, npm run check, and npm run test:coverage.npm run build to generate the dist/ static files; production builds remove source maps.appleboy/scp-action to upload the contents of dist/ to the server directory, such as /var/www/html.Local commits do not automatically run the full Astro check. To validate manually, run:
npm run check
Configure server IP, SSH user, and private key in Repository Secrets. Details: 📄 GitHub Actions Setup
Access all modules post-deployment:
For details on the core functionality system of the website, please refer to the following documentation link: 📄 Core Functionality System. This document provides a detailed description of the website's core functional modules, including feature design and technical implementation. It serves as an essential reference for development and maintenance.
The core responsibilities of each page are as follows (all generated by .astro files):
index.astro: Homepage, also the introduction page for Zhang Renda, showcasing Zhang Renda's information, education, skills, blog, and work experience.certifications.astro: Certifications list page.deepseek_chat.astro: AI chat interface.docs.astro: Technical documentation page.profile.astro: User account information page.login.astro: Login page.register.astro: Registration page.404.astro, 500.astro: Error pages.Return to Homepage All pages have "Home" button in navigation
Navigation Menu Redirection
client:load, ensuring interactivity while avoiding hydration errors.Login Page Access Profile icon in nav redirects to login
flowchart TD
A[Home] -->|Hamburger| B[AI Chat]
A -->|Hamburger| C[Certifications]
A -->|Hamburger| D[Tech Docs]
A -->|Hamburger| F[Account Profile]
A -->|Profile Icon| E[Login]
B -->|Home Button| A
C -->|Home Button| A
D -->|Home Button| A
E -->|Home Button| A
F -->|Home Button| A
style A fill:#9f9,stroke:#333
style B fill:#f9f,stroke:#333
style C fill:#ff9,stroke:#333
style D fill:#99f,stroke:#333
style E fill:#f99,stroke:#333
style F fill:#9ff,stroke:#333
index.astro: A multi-section homepage containing modules such as "Hero", "About Me", "Education", "Blog", "Skills & Abilities", "Experience", and "Contact Me", with a default floating ChatWidget badge.certifications.astro: Grid-based certification cards with Credly verificationdeepseek_chat.astro: A conversational interface consisting of a chat history area and an input box, supporting streaming output and real-time rendering of AI-generated Markdown content. It provides a one-click copy feature for the original content and automatically retains the chat history upon page refresh, and loads both github-code-highlight.css and github-markdown-light.css for consistent GitHub-style code highlighting. The chat UI has been refactored into reusable components such as ChatMessageList and ChatInput for better maintainability.docs.astro: Technical documentation page that loads both github-code-highlight.css and github-markdown-light.css together with highlight.js for GitHub-style Markdown layout and code highlighting.profile.astro: Account information page, displaying the information of the currently logged-in user.login.astro: Login form page.register.astro: Register form page.404.astro/500.astro: Custom error pages designed to handle Page Not Found (404) and Internal Server Error (500) scenarios. These pages provide clear error messages, user-friendly guidance, and a link to return to the homepage, enhancing the overall user experience.Adaptive Layout: Optimizes the display effect of the page on different devices, reduces unnecessary resource loading and layout calculations, and thereby improves performance. Ensures that the page displays well on various screen sizes (e.g., desktop, tablet, mobile), enhancing user experience.
Lazy Loading: All images have lazy loading enabled with a loading animation. For high-definition images, LQIP (Low-Quality Image Placeholder) lazy loading optimization is applied (e.g., the Hero section on the homepage).
The core colors of the project are designed using OKLCH design tokens and provide sRGB fallback through color-mix to ensure perceptual consistency across light and dark modes.
For detailed information, refer to the documentation: 📄 Color Scheme.
For detailed steps and configurations on backend deployment, please refer to the following project: 📁 Python Cloud Chat. This project provides a complete backend implementation and deployment guide, helping you quickly set up and run backend services.
The frontend project is automatically built via GitHub Actions and pushed to the
/var/www/htmldirectory on the server, where Nginx serves the static resources.
For detailed Nginx configurations and operational instructions, please check the following repository: 📁 Nginx Conf. This repository includes commonly used Nginx configuration files and examples, making it easy for you to get started.
To fully leverage the hashed assets under
/_astro, add a long-term cache rule in Nginx:
location /_astro/ {
access_log off;
add_header Cache-Control "public, max-age=31536000, immutable";
}
If you need a more robust server solution, you can refer to my cloud-native project: 📁 Renda Cloud LAB. This project provides a complete cloud-native architecture design, suitable for large-scale and high-availability scenarios.
The project follows a
master/developdual-branch model with conventions forfeature,hotfix, andexperimentbranches. Details: 📄 Git Workflow.
deploy.ymldefines the deployment process triggered when code is pushed or merged intomaster, including tag management and environment variable mappings. See: 📄 CI / CD Pipeline.
Frontend validation, deploy-run inspection, deploy-log noise classification, dependency audits, backend/Nginx docs-only sync rules, production read-only checks, and local roadmap maintenance commands are documented in: 📄 Operations Maintenance Guide.
Current dependency audit / Dependabot residual risk, the reason
npm audit fix --forceis disallowed, Astro 7 upgrade boundaries, and security patch escalation thresholds are documented in: 📄 Dependency Security Risk Register.
The Astro 7 Go/No-Go decision, target package set, Vite 8/Rolldown risks, Sentry source-map checks, CSP gate, Chat Widget smoke scope, and rollback plan are documented in: 📄 Astro 7 Upgrade Precheck.
The current baseline, target package set, Node/Vite/Sentry compatibility risks, validation checklist, and rollback plan for the Astro 6 upgrade are documented in: 📄 Astro 6 Migration Precheck.
Current conventions for Astro pages,
BaseLayout, React Islands, hydration, service boundaries, utilities, style tokens, CSP, and iframe constraints are documented in: 📄 Frontend Architecture Conventions.
Directory ownership for
src/components,src/services,src/utils,src/styles,src/content,src/stores, andsrc/controllersis documented in: 📄 Frontend Directory Ownership Map.
The same-origin iframe
postMessageready protocol between the floating Chat Widget and/deepseek_chat/, including origin/source checks, loading lifecycle, and refactor constraints, is documented in: 📄 Chat Widget Protocol.
Phase 8 planning for browser smoke coverage, hydration safety, theme mode vs palette/accent separation, palette slice order, and interaction standards is documented in: 📄 Frontend Experience Platform RFC.
Modal, popover/menu, toast/status, loading, disabled/empty/error state, keyboard behavior, focus management, and browser smoke gates are documented in: 📄 Interaction Component Standards.
Phase 15 rules for bilingual voice, first-person writing, technical terminology, CTAs, evidence boundaries, visual expression, and owner input are documented in: 📄 Human Voice And Personal Expression.
Phase 10 planning for personal-brand content, credibility proof, PersonalWeb project evidence, certifications, work/education narrative, and SEO/GEO alignment is documented in: 📄 Content And Credibility Positioning.
Phase 11 visitor journey, privacy-safe anonymous events, first-party telemetry boundaries, and Chat Guide public-content scope are documented in: 📄 Site Intelligence And Visitor Journey.
Phase 14 planning for portfolio proof, visitor proof paths, the PersonalWeb case-study surface, homepage proof flow, Chat Guide entry points, and browser/mobile conversion QA is documented in: 📄 Portfolio Proof And Visitor Conversion.
Phase 12 documents the Chat Guide public knowledge boundary, answer-quality architecture, backend-owned public knowledge package, and delivery sequence: 📄 Chat Guide Quality Architecture.
Canonical host, sitemap,
llms.txt,/docs/SSR content, and soft-404 validation rules are documented in: 📄 SEO / GEO Maintenance.
For BUGs encountered during frontend development and their solutions, please refer to the following document: 📄 Frontend BUG Tracking Database. This document provides detailed records of BUG descriptions, reproduction steps, solutions, and developer notes, helping you quickly identify and resolve issues.
For project feature requirements, priorities, and development plans, please refer to the following document: 📄 Project Requirements List. This document lists all requirements for the current version, along with detailed descriptions and development statuses, making it easy for you to track project progress and plan development tasks.
For details on page routing, API contracts, password policies, and security considerations related to user authentication and password reset, please refer to: 📄 Authentication Specification.
The front-end currently adopts an architecture based on Astro + React, following a layered design philosophy. It utilizes GitHub Actions for automated builds and deploys the build artifacts to a specified directory on the server's Nginx.
For detailed steps on upgrading from native frontend, please refer to the following documentation: 📄 Upgrade Plan. This document provides a comprehensive plan and implementation steps for gradually migrating from the old native frontend to a new frontend architecture based on Astro and React.
For detailed steps on setting up the development environment, please refer to the following documentation: 📄 Environment Preparation. This document provides a comprehensive guide on configuring the development environment and initializing an Astro project, ensuring you can smoothly proceed with subsequent development tasks.
The website uses an automated pipeline to generate responsive images with built-in LQIP placeholders. For maintenance and extension instructions, see 📄 Responsive Image System Maintenance
Sentry collects runtime and network errors. See 📄 Error Tracking Integration for configuration.
src/utils/env.ts, src/utils/langUtils.ts, src/utils/storage.ts, and src/utils/logger.ts provide unified access to environment variables, language parsing, multi-backend storage solutions, and an extensible logging interface.
Docs: 📄 Utilities Reference.
For a detailed explanation of the pre-commit hooks, refer to the Comprehensive Pre-Commit Guide.
Introduce the project's CSS architecture, the OKLCH-based design token system, and the build process. Demonstrate how
postcss-importinlines the core and utility styles referenced bytheme.cssduring the compilation phase to reduce runtime requests. For details, see: 📄 Style Guide.
# If the virtual environment is not yet installed, run: python -m venv venv
source venv/bin/activate
pip install pre-commit
pre-commit install
index.ts files✅ All commits must pass the pre-commit checks; CI will block PRs that do not meet the standards.
Released under MIT License - free for use and modification. Retain original license notices when redistributing.
⏰ Maintainer: @RendaZhang — If this project helps you, please give it a ⭐️!