Setup

Full installation guide from scratch to production deploy

Setup

Complete guide from git clone to https://dung87.io.vn/ running on Cloudflare Pages.

1. Prerequisites

ToolVersionInstall
Node.js≥ 20https://nodejs.org (LTS) or nvm install 20
npm≥ 10Bundled with Node
Git≥ 2.30https://git-scm.com
GitHub accounthttps://github.com/signup
Cloudflare accountFree tier OKhttps://dash.cloudflare.com/sign-up
Domain dung87.io.vnPointed to Cloudflare NShttps://dash.cloudflare.com → Add site

2. Quick start (5 min)

# 1. Clone
git clone git@github.com:vuhuudung/dung87.io.vn.git
cd dung87.io.vn

# 2. Install
npm install

# 3. Dev server
npm run dev
# → http://localhost:4321

# 4. Validate
npm run validate
npm run lint

# 5. Production build
npm run build
npm run preview
# → http://localhost:4322

3. Cloudflare Pages setup

Step 1: Verify domain

dig NS dung87.io.vn
# Expect: cortney.ns.cloudflare.com, lynn.ns.cloudflare.com

Step 2: Create Pages project

  1. Cloudflare Dashboard → Workers & PagesCreate application
  2. Tab PagesConnect to Git
  3. Authorize GitHub → pick vuhuudung/dung87.io.vn
  4. Project name: dung87-io-vn-hub
  5. Production branch: main
  6. Build settings:
    • Build command: npm run build
    • Build output directory: dist
    • Root directory: (empty)
  7. Environment variables: NODE_VERSION = 20

Step 3: Add custom domains

Pages project → Custom domainsSet up a custom domain:

  • Add dung87.io.vn (apex)
  • Add www.dung87.io.vn

Cloudflare auto-issues SSL cert (~30-90 seconds).

4. GitHub Actions secrets

Go to Settings → Secrets and variables → Actions → New repository secret:

NameValueWhere to get
CLOUDFLARE_API_TOKENToken with Pages:Edit + Account:Read scopehttps://dash.cloudflare.com/profile/api-tokens
CLOUDFLARE_ACCOUNT_IDYour account IDURL ?to=/:account/... in CF dashboard

5. Verify

# DNS
dig CNAME dung87.io.vn
# Expect: <project>.pages.dev

# HTTPS
curl -sI https://dung87.io.vn/ | head -1
# Expect: HTTP/2 200

Open https://dung87.io.vn/ — site displays hero + 4 project cards + skill filter.

Quick troubleshooting

IssueFix
EACCES on npm installUse nvm or sudo chown -R $(whoami) ~/.npm
Port 4321 in usenpx kill-port 4321 or taskkill /PID <pid> /F (Win)
validate fails: Invalid slugFix slug to match /^[a-z0-9-]+$/ (lowercase + a-z, 0-9, -)
GH Actions: Auth errorMint new token, check secret name is correct (case-sensitive)
Site returns old HTMLdig CNAME dung87.io.vn to check DNS, hard reload browser
Custom domain “pending” foreverCheck DNS, wait 5-10 min for cert
/en/ 308 redirectStandard CF Pages behavior, browser auto-follows

Detailed troubleshooting: see SETUP.md on GitHub.

Next steps