Skip to content

Chạy local & Deploy ​

TL;DR — npm install once at the repo root, then npm run dev:app / npm run dev:docs to run locally. Deploy each site with npm run deploy:app / npm run deploy:docs after npx wrangler login. Nothing is deployed yet.

1. Chạy local ​

bash
cd aiteen
npm install                 # cài cho cả hai site (npm workspaces)
npm run dev:app             # http://127.0.0.1:5173  — Learning Experience
npm run dev:docs            # http://127.0.0.1:5174  — Docs (tự sinh trang chương trình trước)
npm run check               # kiểm tra tính nhất quán của chương trình

2. Build ​

bash
npm run build               # build cả hai
# kết quả: learning-experience/dist  và  docs-aiteen-learning-experience/.vitepress/dist

3. Triển khai Cloudflare Pages bằng Wrangler ​

Một lần: npx wrangler login. Tạo hai Pages project (lần deploy đầu sẽ hỏi hoặc tự tạo):

bash
npm run deploy:app          # → project  aiteen-learning-experience
npm run deploy:docs         # → project  docs-aiteen-learning-experience

Mỗi lệnh build rồi chạy wrangler pages deploy <thư mục build> --project-name <tên>. Địa chỉ mặc định có dạng https://<project>.pages.dev. Domain riêng cấu hình trong Cloudflare Dashboard.

4. GitHub ​

bash
cd aiteen
git init && git add . && git commit -m "Khởi tạo AI Teen Learning Experience"
git branch -M main
git remote add origin git@github.com:<tổ-chức>/<repo>.git && git push -u origin main

Tùy chọn: nối repo với Cloudflare Pages (Git integration) để mỗi lần push tự build — khi đó đặt Build command và Output directory theo từng thư mục site (npm run build trong learning-experience, output dist; và npm run build trong docs, output .vitepress/dist).

5. Biến môi trường ​

BiếnSiteÝ nghĩa
VITE_API_BASELearning ExperienceĐể trống = chỉ lưu local. Đặt URL Worker khi có backend

6. Xử lý sự cố ​

Triệu chứngCách xử lý
Docs báo lỗi thiếu trang /curriculum/...Chạy npm run gen trong thư mục docs
Giao diện mất kiểuKiểm tra npm install đã cài @tailwindcss/vite và tailwindcss
Mất dữ liệu họcDữ liệu ở localStorage của trình duyệt/thiết bị; xóa dữ liệu trình duyệt sẽ mất
Logo không hiệnMáy không truy cập được sutucon.com; giao diện vẫn dùng chữ thay thế