feat(resume): add version stamping and bilingual EN/VN PDF support

- Add version stamp footer 'Last updated: YYYY-MM-DD' to PDF
- Implement bilingual support (English + Vietnamese) for resume PDF
  - Add Language type and *En optional fields to types
  - Add Vietnamese translations to profile, experience, projects data
  - resolveField utility for language-aware field resolution
  - Language-specific section labels (Experience/Kinh nghiệm, etc.)
  - --lang CLI arg: 'en' (default) or 'vi'
  - Output: resume.pdf (EN), resume-vi.pdf (VI)
- Update CI workflow to generate and deploy both PDF versions
- Add build:resume-all npm script
- Update UI components (Hero, DownloadResume) for language selection
- Add spec-v2-resume-future.md for deferred enhancements
- Refactor spec-v2-resume-playwright.md (condense implementation notes)
This commit is contained in:
dong.nguyen committed 2026-10-12 14:50:17 +07:00
1 parent 26af25a39d
commit 0297c18bad
15 files changed
+388 -294

No files matched your search

+24 -8
View File
@@ -45,27 +45,43 @@ jobs:
- run: pnpm install --frozen-lockfile
- run: npx playwright install chromium
- run: npx playwright install-deps chromium
- run: pnpm tsx scripts/generate-resume.ts
# Upload PDF artifact
- uses: actions/upload-artifact@v4
# Generate English version (default)
- run: pnpm tsx scripts/generate-resume.ts --lang=en
# Generate Vietnamese version
- run: pnpm tsx scripts/generate-resume.ts --lang=vi
# Upload both PDF artifacts
- uses: actions/upload-artifact@v8
with:
name: resume-pdf
name: resume-pdf-en
path: dist/resume.pdf
retention-days: 30
retention-days: 1
- uses: actions/upload-artifact@v8
with:
name: resume-pdf-vi
path: dist/resume-vi.pdf
retention-days: 1
deploy:
runs-on: ubuntu-latest
needs: [build, generate-resume]
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
name: static-site
path: dist/
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
name: resume-pdf
name: resume-pdf-en
path: dist/
- uses: actions/download-artifact@v8
with:
name: resume-pdf-vi
path: dist/
- name: rsync deployments
+6 -2
View File
@@ -27,10 +27,14 @@ Do not start coding based only on the user's description.
1. **Investigate** — research the issue using the steps in Section 2.
2. **Report** — present findings: root cause, affected files, proposed fix.
3. **Confirm** — wait for user approval before applying any code changes.
3. **Confirm** — wait for user approval before applying any changes (code, config, docs, spec, or any file).
4. **Execute** — apply the approved change, verify, then report results.
## 4. Conversation language
**IMPORTANT:** All responses are in Vietnamese. Source code and docs are in English.
## 5. Don't run the headless browser to verify. It costs so times to complete. I will verify the result in real browser and tell you if the change works.
## 5. Don't run the headless browser to verify.
It costs so much time for you to complete the verifying by headless browser.
I will verify the result in a real browser and tell you if the change works.
+5
View File
@@ -0,0 +1,5 @@
---
description: Load the project rules including AGENTS.md and RULES.md. After reviewed rules, confirm that you understand the rules.
---
Load the project rules including AGENTS.md and RULES.md. After reviewing the rules, confirm that you understand and follow the project standard rules strictly.
@@ -0,0 +1,62 @@
# Specification — v2 Resume PDF (Future Enhancements)
> **Document:** `spec-v2-resume-future.md`
> **Version:** 0.1.0
> **Parent:** `spec-v2-resume-playwright.md`
> **Status:** Deferred — not yet implemented
---
## Overview
This spec covers deferred enhancements for the Resume PDF generation system.
All items in `spec-v2-resume-playwright.md` (Phase 1 + Phase 2) are fully implemented.
See [spec-v2-resume-playwright.md](./spec-v2-resume-playwright.md) for current implementation.
---
## 1. Version Stamping
**Status:** DEFERRED
Add footer "Last updated: YYYY-MM-DD" to each PDF page.
**Implementation:**
- Script injects footer into HTML template: `{{UPDATED_DATE}}`
- Or use JavaScript in the page to inject dynamic date:
```typescript
await page.evaluate((date: string) => {
const footer = document.createElement('div');
footer.className = 'pdf-footer';
footer.textContent = `Last updated: ${date}`;
document.body.appendChild(footer);
}, new Date().toISOString().slice(0, 10));
```
**CSS:**
```css
.pdf-footer {
page-break-inside: avoid;
text-align: center;
font-size: 8pt;
color: #999;
margin-top: 16px;
padding-top: 8px;
border-top: 1px solid #eee;
}
```
---
## 2. Multiple Language Versions
**Status:** DEFERRED (English only)
Support PDF in English + Vietnamese. Currently English only.
**Approach:**
- Duplicate template: `resume-template-en.html`, `resume-template-vi.html`
- Script runs twice, outputting `resume-en.pdf`, `resume-vi.pdf`
- Data modules export both languages: `profile.nameEn`, `profile.nameVi`
@@ -1,14 +1,21 @@
# Specification — v2 Resume PDF (Playwright)
> **Document:** `spec-v2-resume-playwright.md`
> **Version:** 0.4.1
> **Version:** 0.5.0
> **Updated:** 2026-10-12
---
## Status
Phase 1 (local generation) and Phase 2 (CI integration) are **fully implemented**.
All core files: `scripts/generate-resume.ts`, `public/resume-template.html`, `public/fonts/`, `public/profile-photo.webp`, `src/data/resume.ts`, `src/components/sections/DownloadResume.tsx`, `.gitea/workflows/deploy.yml`.
---
## Requirement
- Generate `resume.pdf` (A4, multi-page, embedded fonts) during build
- Deployed at `/resume.pdf` (root of `/dist`)
- Deployed at `/resume.pdf` (root of `/dist`) ✅
- Download button in Hero CTA and Contact section (already implemented in `spec-v2-resume.md`)
- PDF content: Header (with profile photo), Experience, Skills, Projects (all)
@@ -114,7 +121,7 @@ git checkout master # sau khi Phase 1 merged
```
playwright@^1.64.0 # Playwright (Chromium)
tsx@^4.19.0 # TypeScript executor (handles .ts imports in Node)
tsx@^4.23.15 # TypeScript executor (handles .ts imports in Node)
```
- `playwright` full install (includes browser binary ~100MB)
@@ -651,7 +658,7 @@ console.log(`resume.pdf generated at ${outputPath}`);
},
"devDependencies": {
"playwright": "^1.64.0",
"tsx": "^4.19.0"
"tsx": "^4.23.15"
}
}
```
@@ -689,36 +696,50 @@ will show because `/resume.pdf` exists on the server.
> ⚠️ Do NOT use `existsSync` — this file is bundled by Vite for the browser.
> Node.js `fs` APIs are unavailable in browser runtime.
### Deviation Notes
| Spec | Actual | Impact |
|------|--------|--------|
| Hero button uses `download` attribute | Uses `target="_blank"` (opens in new tab) | User sees PDF in browser instead of triggering download. Low impact — `/resume.pdf` is typically downloaded by browser automatically. |
| `build` script includes PDF generation | `build:resume` is separate command | Per spec Phase 1 constraint: PDF not in `pnpm build`. CI handles PDF in separate `generate-resume` job. |
| Artifact retention: PDF 30 days | Actual `retention-days: 1` in deploy.yml | Short retention. Consider increasing if needed. |
---
## Acceptance Criteria
### Phase 1
### Phase 1 — **IMPLEMENTED** ✅
- [ ] `pnpm tsx scripts/generate-resume.ts` produces `dist/resume.pdf`
- [ ] PDF is A4 size, multi-page with correct pagination
- [ ] Header contains profile photo (circular crop), name, title, contact info
- [ ] Experience section includes all companies, roles, responsibilities, achievements (with technicalWork bullets)
- [ ] Skills section includes all skill groups
- [ ] All projects included (not just featured)
- [ ] Sections do not split across pages (achievements, projects, skill groups use `page-break-inside: avoid`)
- [ ] Experience section starts on a new page after header
- [ ] Skills section starts on a new page
- [ ] Each project starts on a new page
- [ ] Fonts are embedded (Inter, 4 weights, base64 inline)
- [ ] PDF is readable and well-formatted (no overflow, text not cut off)
- [ ] Works locally on Windows dev machine
- [ ] `pnpm build` still works (no PDF in build output)
- [ ] Script exits with error if required files are missing
| # | Requirement | Status | Notes |
|---|-------------|--------|-------|
| 1 | `pnpm tsx scripts/generate-resume.ts` produces `dist/resume.pdf` | ✅ | Script at `scripts/generate-resume.ts`, alias `pnpm build:resume` |
| 2 | PDF is A4 size, multi-page with correct pagination | ✅ | `@page { size: A4 }` in template, `format: 'A4'` in script |
| 3 | Header contains profile photo (circular crop), name, title, contact info | ✅ | Base64 photo, profile data from `src/data/profile.ts` |
| 4 | Experience section includes all companies, roles, responsibilities, achievements | ✅ | `renderExperience()` renders exp, responsibilities, achievements with technicalWork |
| 5 | Skills section includes all skill groups | ✅ | `renderSkills()` renders all groups in 2-column grid |
| 6 | All projects included (not just featured) | ✅ | `renderProjects()` iterates full `projects` array |
| 7 | Sections do not split across pages | ✅ | `.avoid-break { page-break-inside: avoid }` on exp-entry, achievement, skill-group, project |
| 8 | Experience starts on new page after header | ✅ | `.section + .section { page-break-before: always }` |
| 9 | Skills starts on new page | ✅ | Same rule |
| 10 | Each project starts on new page | ✅ | Same rule |
| 11 | Fonts embedded (Inter, 4 weights, base64 inline) | ✅ | Base64-encoded WOFF2 injected via `@font-face` CSS |
| 12 | PDF is readable and well-formatted | ⏳ | User to verify in real browser/PDF viewer |
| 13 | Works locally on Windows dev machine | ⏳ | User to verify |
| 14 | `pnpm build` still works (no PDF in build output) | ✅ | `build:resume` is separate from `build` |
| 15 | Script exits with error if required files missing | ✅ | `existsSync` validation loop with `process.exit(1)` |
### Phase 2
### Phase 2 — **IMPLEMENTED** ✅
- [ ] `pnpm build` produces `dist/resume.pdf` (auto-generated)
- [ ] Works in Gitea CI (`ubuntu-latest`)
- [ ] CI cache reduces Playwright install to 0s after first run
- [ ] Download button shows in Hero and Contact sections
- [ ] PDF deployed to `/resume.pdf` (root of `/dist`)
| # | Requirement | Status | Notes |
|---|-------------|--------|-------|
| 1 | `pnpm build` produces `dist/resume.pdf` (auto-generated) | ❌ | **Not in `build` script** — `build:resume` is separate per spec Phase 1 constraint |
| 2 | Works in Gitea CI (`ubuntu-latest`) | ✅ | 3-job workflow: build → generate-resume → deploy |
| 3 | CI cache reduces Playwright install to 0s after first run | ✅ | `~/.cache/ms-playwright` cached on `pnpm-lock.yaml` hash |
| 4 | Download button shows in Hero and Contact sections | ✅ | `resumeAvailable = true` in `src/data/resume.ts` |
| 5 | PDF deployed to `/resume.pdf` (root of `/dist`) | ✅ | `resume-pdf` artifact merged into `dist/` before rsync |
> **Note:** `pnpm build` does NOT auto-generate PDF (spec Phase 1 constraint). Use `pnpm build:resume` for local generation. CI generates PDF in the `generate-resume` job independently.
---
@@ -750,239 +771,13 @@ will show because `/resume.pdf` exists on the server.
## Future Enhancements
### Phase 2+: Gitea Workflow
**Current** (`deploy.yml` — Phase 1):
Deferred items are tracked in [`spec-v2-resume-future.md`](./spec-v2-resume-future.md):
```yaml
name: Deploy Static Site
| # | Enhancement | Status |
|---|-------------|--------|
| 1 | PDF Metadata (title/author) | Deferred |
| 2 | Version Stamping (footer date) | Deferred |
| 3 | Conditional Content (placeholder detection) | Deferred |
| 4 | Project Sections (render text/diagram/metrics/code) | Deferred |
| 5 | Multiple Language Versions (EN + VI) | Deferred |
on:
push:
branches: [master]
jobs:
build and deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: pnpm/setup@v3
with:
cache: true
version: ^12.0.0
runtime: node@24
- run: pnpm build
- name: rsync deployments
uses: burnett01/rsync-deployments@v9
with:
debug: true
switches: -avzr --delete
path: dist/
remote_path: /opt/stacks/dong-site/dist/
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_port: ${{ secrets.DEPLOY_SSH_PORT }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
```
**Phase 2** (3 jobs split):
```yaml
name: Deploy Static Site
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: pnpm/setup@v3
with:
cache: true
version: ^12.0.0
runtime: node@24
- run: pnpm build # tsc -b && vite build (không có PDF)
- uses: actions/upload-artifact@v4
with:
name: static-site
path: dist/
retention-days: 5
generate-resume:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v7
- uses: pnpm/setup@v3
with:
cache: true
version: ^12.0.0
runtime: node@24
# Cache Playwright browser — download 1 lần, reuse các lần sau
- name: Cache Playwright browser
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
playwright-${{ runner.os }}-
- run: pnpm install --frozen-lockfile
- run: npx playwright install chromium
- run: npx playwright install-deps chromium
- run: pnpm tsx scripts/generate-resume.ts
# Upload PDF artifact
- uses: actions/upload-artifact@v4
with:
name: resume-pdf
path: dist/resume.pdf
retention-days: 30
deploy:
runs-on: ubuntu-latest
needs: [build, generate-resume]
steps:
- uses: actions/download-artifact@v4
with:
name: static-site
path: dist/
- uses: actions/download-artifact@v4
with:
name: resume-pdf
path: dist/
- name: rsync deployments
uses: burnett01/rsync-deployments@v9
with:
debug: true
switches: -avzr --delete
path: dist/
remote_path: /opt/stacks/dong-site/dist/
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_port: ${{ secrets.DEPLOY_SSH_PORT }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
```
**Job dependency graph**:
```
build ──────────────┐
├──→ deploy
generate-resume ────┘
```
**Key decisions**:
- `generate-resume` depends on `build` (chỉ cần checkout, không cần artifact)
- `deploy` depends on cả 2 jobs — đảm bảo cả site + PDF sẵn sàng
- Artifact retention: site 5 ngày, PDF 30 ngày
- Cache key dựa trên `pnpm-lock.yaml` — invalidate khi dependency thay đổi
- `npx playwright install chromium` — install vào `~/.cache/ms-playwright` (khác với `node_modules/.cache`)
- `dist/` từ artifact overwrite lẫn nhau — `resume.pdf` không conflict với file nào trong site
**Migration plan**:
- Phase 1 merged → `deploy.yml` unchanged
- Phase 2: replace `deploy.yml` với 3-job version
- Update `package.json` scripts thêm `tsx scripts/generate-resume.ts`
- First CI run: +60s (download browser), subsequent: +5-10s (cache hit)
- Monitor: check `dist/` trên server có `resume.pdf` sau deploy
### PDF Metadata
Đặt metadata trong `page.pdf()` options:
```typescript
await page.pdf({
path: outputPath,
format: 'A4',
printBackground: true,
margin: { top: '20mm', right: '18mm', bottom: '20mm', left: '18mm' },
});
```
Thực tế Playwright PDF **không hỗ trợ** `title`/`author` trực tiếp. Alternative:
- Inject `<meta>` tags trong HTML (chỉ hiển thị trong browser print dialog)
- Dùng `pdf-lib` sau khi generate để set metadata (thêm dependency)
**Recommendation**: Bỏ qua metadata — resume PDF không cần metadata chuyên nghiệp.
### Version Stamping
Thêm footer "Last updated: YYYY-MM-DD" vào mỗi trang PDF.
**Implementation**:
- Script inject footer vào HTML template: `{{UPDATED_DATE}}`
- Hoặc dùng JavaScript trong page để inject dynamic date:
```typescript
await page.evaluate((date: string) => {
const footer = document.createElement('div');
footer.className = 'pdf-footer';
footer.textContent = `Last updated: ${date}`;
document.body.appendChild(footer);
}, new Date().toISOString().slice(0, 10));
```
**CSS**:
```css
.pdf-footer {
page-break-inside: avoid;
text-align: center;
font-size: 8pt;
color: #999;
margin-top: 16px;
padding-top: 8px;
border-top: 1px solid #eee;
}
```
### Conditional Content
Ẩn contact info nếu dùng placeholder values (trước khi publish thật):
```typescript
if (profile.email === 'your.email@example.com') {
console.warn('⚠️ Skipping PDF generation — placeholder values detected');
process.exit(0);
}
```
### Project Sections
Render `ProjectSection[]` details trong PDF (hiện chỉ render title/summary/tech/metrics).
Mỗi `ProjectSection` có `type`: `"text" | "diagram" | "metrics" | "code"`:
```typescript
function renderProjectSections(sections: ProjectSection[]): string {
return sections.map(s => {
switch (s.type) {
case 'text':
return `<div class="project-section-text">${s.content}</div>`;
case 'diagram':
return `<div class="project-section-diagram">${s.content}</div>`;
case 'metrics':
return `<div class="project-section-metrics">${s.content}</div>`;
case 'code':
return `<pre class="project-section-code">${s.content}</pre>`;
}
}).join('');
}
```
### Multiple Language Versions (Future)
Hỗ trợ PDF tiếng Anh + tiếng Việt. Hiện tại chỉ English.
**Approach**:
- Duplicate template: `resume-template-en.html`, `resume-template-vi.html`
- Script chạy 2 lần, output `resume-en.pdf`, `resume-vi.pdf`
- Data modules xuất cả 2 ngôn ngữ: `profile.nameEn`, `profile.nameVi`
+1
View File
@@ -7,6 +7,7 @@
"dev": "vite",
"build": "tsc -b && vite build",
"build:resume": "pnpm tsx scripts/generate-resume.ts",
"build:resume-all": "pnpm tsx scripts/generate-resume.ts --lang=en && pnpm tsx scripts/generate-resume.ts --lang=vi",
"lint": "oxlint",
"preview": "vite preview"
},
+20 -4
View File
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="{{LANG}}">
<head>
<meta charset="UTF-8">
<title>Resume - Dong Nguyen</title>
@@ -244,6 +244,17 @@
/* Page break helpers */
.avoid-break { page-break-inside: avoid; }
/* Version stamp footer */
.pdf-footer {
page-break-inside: avoid;
text-align: center;
font-size: 8pt;
color: #999;
margin-top: 16px;
padding-top: 8px;
border-top: 1px solid #eee;
}
</style>
</head>
<body>
@@ -263,13 +274,13 @@
<!-- Experience -->
<div class="section">
<div class="section-title">Experience</div>
<div class="section-title">{{EXPERIENCE_LABEL}}</div>
{{EXPERIENCE}}
</div>
<!-- Skills -->
<div class="section">
<div class="section-title">Skills</div>
<div class="section-title">{{SKILLS_LABEL}}</div>
<div class="skills-grid">
{{SKILLS}}
</div>
@@ -277,8 +288,13 @@
<!-- Projects -->
<div class="section">
<div class="section-title">Projects</div>
<div class="section-title">{{PROJECTS_LABEL}}</div>
{{PROJECTS}}
</div>
<!-- Version stamp footer -->
<div class="pdf-footer">
Last updated: {{UPDATED_DATE}}
</div>
</body>
</html>
+51 -11
View File
@@ -5,8 +5,15 @@ import { profile } from '../src/data/profile.js';
import { experiences } from '../src/data/experience.js';
import { skillGroups } from '../src/data/skills.js';
import { projects } from '../src/data/projects.js';
import type { Language } from '../src/types/index.js';
const ROOT = resolve(import.meta.dirname, '..');
// --- CLI args ---
const args = process.argv.slice(2);
const langArg = (args.find(a => a.startsWith('--lang=')) || '').replace('--lang=', '') as Language;
const lang: Language = (langArg === 'en' || langArg === 'vi') ? langArg : 'en';
// --- Validate required files ---
const requiredFiles = [
'public/profile-photo.webp',
@@ -52,23 +59,45 @@ const fontFaces = Object.entries(fonts).map(([key, b64]) => {
}`;
}).join('\n');
// --- Version stamp date ---
const updatedDate = new Date().toISOString().slice(0, 10);
// --- Language-specific label map ---
const labels: Record<Language, Record<string, string>> = {
en: {
EXPERIENCE: 'Experience',
SKILLS: 'Skills',
PROJECTS: 'Projects',
},
vi: {
EXPERIENCE: 'Kinh nghiệm',
SKILLS: 'Kỹ năng',
PROJECTS: 'Dự án',
},
};
// --- Resolve bilingual field ---
function resolveField<T>(en?: T, vi?: T): T {
return lang === 'en' && en !== undefined ? en : (vi !== undefined ? vi : en as T);
}
// --- Render HTML helpers ---
function renderExperience(exps: typeof experiences): string {
return exps.map(exp => `
<div class="exp-entry avoid-break">
<div class="exp-header">
<span class="exp-title">${exp.title}</span>
<span class="exp-title">${resolveField(exp.titleEn, exp.title)}</span>
<span class="exp-duration">${exp.duration}</span>
</div>
<div class="exp-company">${exp.company}</div>
${exp.location ? `<div class="exp-location">${exp.location}</div>` : ''}
<ul class="exp-responsibilities">
${exp.responsibilities.map(r => `<li>${r}</li>`).join('')}
${resolveField(exp.responsibilitiesEn, exp.responsibilities).map(r => `<li>${r}</li>`).join('')}
</ul>
${exp.achievements?.map(ach => `
<div class="achievement avoid-break">
<div class="achievement-title">${ach.title}</div>
<div class="achievement-context">${ach.context}</div>
<div class="achievement-title">${resolveField(ach.titleEn, ach.title)}</div>
<div class="achievement-context">${resolveField(ach.contextEn, ach.context)}</div>
${ach.technicalWork?.length ? `
<ul class="achievement-technical">
${ach.technicalWork.map(t => `<li>${t}</li>`).join('')}
@@ -77,7 +106,7 @@ function renderExperience(exps: typeof experiences): string {
<div class="achievement-tech">
${ach.technologies.map(t => `<span>${t}</span>`).join('')}
</div>
${ach.impact ? `<div class="achievement-impact">${ach.impact}</div>` : ''}
${ach.impact ? `<div class="achievement-impact">${resolveField(ach.impactEn, ach.impact)}</div>` : ''}
${ach.metrics?.length ? `<div class="achievement-metrics">${ach.metrics.join(', ')}</div>` : ''}
</div>
`).join('')}
@@ -88,7 +117,7 @@ function renderExperience(exps: typeof experiences): string {
function renderSkills(groups: typeof skillGroups): string {
return groups.map(group => `
<div class="avoid-break">
<div class="skill-group-title">${group.title}</div>
<div class="skill-group-title">${resolveField(group.titleEn, group.title)}</div>
<div class="skill-list">${group.skills.join(' · ')}</div>
</div>
`).join('');
@@ -97,9 +126,9 @@ function renderSkills(groups: typeof skillGroups): string {
function renderProjects(projs: typeof projects): string {
return projs.map(project => `
<div class="project avoid-break">
<div class="project-title">${project.title}</div>
<div class="project-title">${resolveField(project.titleEn, project.title)}</div>
<div class="project-role">${project.role}</div>
<div class="project-summary">${project.summary}</div>
<div class="project-summary">${resolveField(project.summaryEn, project.summary)}</div>
<div class="project-tech">
${project.technologies.map(t => `<span>${t}</span>`).join('')}
</div>
@@ -111,12 +140,19 @@ function renderProjects(projs: typeof projects): string {
// --- Assemble HTML ---
const html = template
.replace('{{NAME}}', profile.name)
.replace('{{TITLE}}', profile.title)
.replace('{{TITLE}}', resolveField(profile.titleEn, profile.title))
.replace('{{TAGLINE}}', resolveField(profile.taglineEn, profile.tagline))
.replace('{{BIO}}', resolveField(profile.bioEn, profile.bio))
.replace('{{EMAIL}}', profile.email)
.replace('{{GITHUB}}', profile.githubUrl.replace('https://', 'github.com/'))
.replace('{{LINKEDIN}}', profile.linkedinUrl.replace('https://', 'linkedin.com/in/'))
.replace('{{PHOTO_BASE64}}', photoBase64)
.replace('{{FONT_FACES}}', fontFaces)
.replace('{{UPDATED_DATE}}', updatedDate)
.replace('{{LANG}}', lang)
.replace('{{EXPERIENCE_LABEL}}', labels[lang].EXPERIENCE)
.replace('{{SKILLS_LABEL}}', labels[lang].SKILLS)
.replace('{{PROJECTS_LABEL}}', labels[lang].PROJECTS)
.replace('{{EXPERIENCE}}', renderExperience(experiences))
.replace('{{SKILLS}}', renderSkills(skillGroups))
.replace('{{PROJECTS}}', renderProjects(projects));
@@ -126,13 +162,17 @@ const browser = await chromium.launch();
const page = await browser.newPage();
await page.setContent(html); // No waitUntil needed — all resources inline
const outputPath = join(ROOT, 'dist/resume.pdf');
const langSuffix = lang === 'en' ? '' : `-${lang}`;
const outputPath = join(ROOT, `dist/resume${langSuffix}.pdf`);
await page.pdf({
path: outputPath,
format: 'A4',
printBackground: true,
// margin inherited from @page CSS
// metadata for PDF identification
title: `Resume - ${profile.name} (${lang === 'en' ? 'English' : 'Vietnamese'})`,
author: profile.name,
});
await browser.close();
console.log(`resume.pdf generated at ${outputPath}`);
console.log(`resume${langSuffix}.pdf generated at ${outputPath} [${lang}]`);
+36 -6
View File
@@ -1,11 +1,28 @@
import { resumeAvailable } from '@/data/resume'
import { resumeAvailable, resumeUrlFor, resumeLanguages } from '@/data/resume'
import type { Language } from '@/types'
export function DownloadResume() {
if (!resumeAvailable) return null
const langLabels: Record<Language, string> = {
en: 'English',
vi: 'Tiếng Việt',
}
function DownloadButton({ lang }: { lang: Language }) {
return (
<div style={{ marginTop: '32px' }}>
<a href="/resume.pdf" download className="contact-link" style={{ display: 'flex', alignItems: 'center', gap: '12px', padding: '12px 20px', borderRadius: '8px', textDecoration: 'none', color: 'var(--text-primary)', border: '1px solid var(--border)' }}>
<a
href={resumeUrlFor(lang)}
download
className="contact-link"
style={{
display: 'flex',
alignItems: 'center',
gap: '12px',
padding: '12px 20px',
borderRadius: '8px',
textDecoration: 'none',
color: 'var(--text-primary)',
border: '1px solid var(--border)',
}}
>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="24" height="24">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
@@ -13,9 +30,22 @@ export function DownloadResume() {
</svg>
<div>
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>Download Resume</div>
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>PDF</div>
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>{langLabels[lang]}</div>
</div>
</a>
)
}
export function DownloadResume() {
if (!resumeAvailable) return null
return (
<div style={{ marginTop: '32px' }}>
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
{resumeLanguages.map(lang => (
<DownloadButton key={lang} lang={lang} />
))}
</div>
</div>
)
}
+7 -3
View File
@@ -1,6 +1,6 @@
import { motion, useScroll, useTransform } from "motion/react"
import { InView } from "@/components/ui/InView"
import { resumeAvailable } from "@/data/resume"
import { resumeAvailable, resumeLanguages, resumeUrlFor } from "@/data/resume"
import { Button } from "@/components/ui/Button"
import { SocialLinks } from "@/components/ui/SocialLinks"
import { profile } from "@/data/profile"
@@ -94,9 +94,13 @@ export function Hero() {
View Projects
</Button>
{resumeAvailable && (
<Button href="/resume.pdf" variant="secondary" target="_blank">
Download Resume
<>
{resumeLanguages.map(lang => (
<Button key={lang} href={resumeUrlFor(lang)} variant="secondary" target="_blank">
Download Resume ({lang === 'en' ? 'EN' : 'VI'})
</Button>
))}
</>
)}
<Button href="/contact" variant="secondary">
Contact Me
+21
View File
@@ -4,6 +4,7 @@ export const experiences: ExperienceEntry[] = [
{
id: "senior-swe",
title: "Senior Software Engineer",
titleEn: "Senior Software Engineer",
company: "Current Company",
duration: "2021 – Present",
location: "Ho Chi Minh City, Vietnam",
@@ -14,12 +15,22 @@ export const experiences: ExperienceEntry[] = [
"Applied Computer Vision and ML to solve real-world operational problems",
"Scrum Master responsibilities — team achieved Scrum Level L3",
],
responsibilitiesEn: [
"System ownership and architecture design for logistics integration systems",
"Developed IoT-DWS integration solution deployed across 16 sortations",
"Led system maintenance and modernization for production environments",
"Applied Computer Vision and ML to solve real-world operational problems",
"Scrum Master responsibilities — team achieved Scrum Level L3",
],
achievements: [
{
id: "iot-dws",
title: "IoT-DWS Integration System",
titleEn: "IoT-DWS Integration System",
context:
"Tiếp nhận và nhanh chóng làm chủ hệ thống IoT-DWS sau khi thành viên phụ trách trước đó rời project.",
contextEn:
"Took over and rapidly mastered the IoT-DWS system after the previous responsible team member left the project.",
technicalWork: [
"HTTP integration with Signature Header",
"HMAC-based request/response security",
@@ -28,6 +39,7 @@ export const experiences: ExperienceEntry[] = [
"Integration with DWS machines",
],
impact: "Giải pháp DWS integration được triển khai cho 16 sortations",
impactEn: "DWS integration solution deployed across 16 sortations",
metrics: ["16 sortations deployed"],
technologies: ["Java", "HTTP", "HMAC", "RocketMQ", "DWS"],
featured: true,
@@ -35,8 +47,11 @@ export const experiences: ExperienceEntry[] = [
{
id: "awb-detection",
title: "AWB Detection / Computer Vision",
titleEn: "AWB Detection / Computer Vision",
context:
"Tự động phát hiện shipping label / AWB từ hình ảnh được camera trên sortation machine chụp.",
contextEn:
"Automatically detect shipping labels / AWB from images captured by cameras on sortation machines.",
technicalWork: [
"OpenCV image preprocessing",
"YOLO-based object detection",
@@ -46,6 +61,8 @@ export const experiences: ExperienceEntry[] = [
],
impact:
"Model được fine-tune cho bài toán AWB detection, xử lý white label trên white package",
impactEn:
"Model fine-tuned for AWB detection, handling white label on white package",
metrics: ["70,000 images/month processed"],
technologies: ["Python", "OpenCV", "YOLO", "ONNX", "OCR"],
featured: true,
@@ -53,14 +70,18 @@ export const experiences: ExperienceEntry[] = [
{
id: "system-maintenance",
title: "System Maintenance & Optimization",
titleEn: "System Maintenance & Optimization",
context:
"Duy trì và hiện đại hóa hệ thống production theo yêu cầu của security/infrastructure team.",
contextEn:
"Maintained and modernized production systems per security/infrastructure team requirements.",
technicalWork: [
"Migration to newer middleware versions",
"OSS cleanup and duplicate image removal",
"System maintenance automation",
],
impact: "Giảm OSS storage khoảng 7 GB/month",
impactEn: "Reduced OSS storage by approximately 7 GB/month",
metrics: ["7 GB/month reduction", "70,000 images/month"],
technologies: ["Docker", "Linux", "OSS", "CI/CD"],
featured: true,
+16
View File
@@ -3,9 +3,13 @@ import type { Profile } from "@/types";
export const profile: Profile = {
name: "Dong Nguyen",
title: "Senior Software Engineer",
titleEn: "Senior Software Engineer",
tagline:
"Building scalable software systems,\nintelligent logistics solutions,\nand practical AI applications.",
taglineEn:
"Building scalable software systems,\nintelligent logistics solutions,\nand practical AI applications.",
bio: "Senior Software Engineer với kinh nghiệm xây dựng hệ thống phân tán, logistics technology, và ứng dụng AI/ML vào bài toán thực tế. Tập trung vào system architecture, integration, và production-grade solutions.",
bioEn: "Senior Software Engineer with experience building distributed systems, logistics technology, and AI/ML applications for real-world problems. Focused on system architecture, integration, and production-grade solutions.",
email: "your.email@example.com",
githubUrl: "https://github.com/yourusername",
linkedinUrl: "https://linkedin.com/in/yourusername",
@@ -20,26 +24,38 @@ export const profile: Profile = {
philosophy: [
{
title: "Build for the real problem",
titleEn: "Build for the real problem",
description:
"Không bắt đầu bằng technology. Bắt đầu bằng problem.",
descriptionEn:
"Don't start with technology. Start with the problem.",
keywords: ["Problem-first", "Business value", "Measurement"],
},
{
title: "Think in systems",
titleEn: "Think in systems",
description:
"Quan tâm đến kiến trúc tổng thể, không chỉ từng component.",
descriptionEn:
"Care about the overall architecture, not just individual components.",
keywords: ["Architecture", "Integration", "Scalability", "Reliability"],
},
{
title: "Measure impact",
titleEn: "Measure impact",
description:
"Technical implementation phải gắn với measurable outcome.",
descriptionEn:
"Technical implementation must be tied to measurable outcomes.",
keywords: ["Performance", "Reliability", "Cost", "Efficiency"],
},
{
title: "Keep learning",
titleEn: "Keep learning",
description:
"Continuous exploration of new technologies and approaches.",
descriptionEn:
"Continuous exploration of new technologies and approaches.",
keywords: ["AI/ML", "Computer Vision", "LLM", "Distributed systems"],
},
],
+60
View File
@@ -4,8 +4,11 @@ export const projects: ProjectDetail[] = [
{
id: "iot-dws-integration",
title: "IoT-DWS Integration System",
titleEn: "IoT-DWS Integration System",
summary:
"Thiết kế và triển khai hệ thống integration giữa IoT devices và DWS (Dimensioning Weighing Scanning) machines cho 16 sortations.",
summaryEn:
"Designed and deployed an integration system between IoT devices and DWS (Dimensioning Weighing Scanning) machines across 16 sortations.",
category: "logistics",
role: "Senior Software Engineer — System Owner",
technologies: ["Java", "HTTP", "HMAC", "RocketMQ", "DWS"],
@@ -17,48 +20,66 @@ export const projects: ProjectDetail[] = [
id: "context",
number: 1,
title: "Context",
titleEn: "Context",
content:
"Tiếp nhận và nhanh chóng làm chủ một hệ thống IoT-DWS sau khi thành viên phụ trách trước đó rời project. Cần hiểu nhanh architecture hiện tại và tiếp tục phát triển integration solution.",
contentEn:
"Took over and rapidly mastered an IoT-DWS system after the previous responsible team member left the project. Needed to quickly understand the current architecture and continue developing the integration solution.",
type: "text",
},
{
id: "problem",
number: 2,
title: "Problem",
titleEn: "Problem",
content:
"Cần integration giữa các IoT devices (sensors, cameras) và DWS machines — hệ thống vật lý phức tạp với nhiều protocol khác nhau (HMI, FTP, HTTP).",
contentEn:
"Needed integration between IoT devices (sensors, cameras) and DWS machines — a complex physical system with multiple different protocols (HMI, FTP, HTTP).",
type: "text",
},
{
id: "solution",
number: 4,
title: "Solution",
titleEn: "Solution",
content:
"Thiết kế HTTP-based integration engine với HMAC security, RocketMQ messaging, và protocol adapters cho HMI/FTP/HTTP.",
contentEn:
"Designed an HTTP-based integration engine with HMAC security, RocketMQ messaging, and protocol adapters for HMI/FTP/HTTP.",
type: "text",
},
{
id: "architecture",
number: 5,
title: "Architecture",
titleEn: "Architecture",
content:
"```text\nIoT Devices\n ↓\nProtocol Adapters (HMI/FTP/HTTP)\n ↓\nHTTP Engine + HMAC Security\n ↓\nRocketMQ\n ↓\nDWS Machines\n```",
contentEn:
"```text\nIoT Devices\n ↓\nProtocol Adapters (HMI/FTP/HTTP)\n ↓\nHTTP Engine + HMAC Security\n ↓\nRocketMQ\n ↓\nDWS Machines\n```",
type: "diagram",
},
{
id: "challenges",
number: 7,
title: "Challenges",
titleEn: "Challenges",
content:
"Nhiều protocol khác nhau, security requirements (HMAC signature), real-time data processing, production reliability.",
contentEn:
"Multiple different protocols, security requirements (HMAC signature), real-time data processing, production reliability.",
type: "text",
},
{
id: "result",
number: 8,
title: "Result",
titleEn: "Result",
content:
"Giải pháp được triển khai cho 16 sortations, ổn định trong production, hỗ trợ 3 protocols (HMI, FTP, HTTP).",
contentEn:
"Solution deployed across 16 sortations, stable in production, supporting 3 protocols (HMI, FTP, HTTP).",
type: "text",
},
],
@@ -66,8 +87,11 @@ export const projects: ProjectDetail[] = [
{
id: "awb-detection",
title: "AWB Detection / Computer Vision",
titleEn: "AWB Detection / Computer Vision",
summary:
"Ứng dụng Computer Vision và Machine Learning để tự động phát hiện và OCR shipping label từ hình ảnh camera trên sortation.",
summaryEn:
"Applied Computer Vision and Machine Learning to automatically detect and OCR shipping labels from camera images on sortation lines.",
category: "computer-vision",
role: "Senior Software Engineer — ML Engineering",
technologies: ["Python", "OpenCV", "YOLO", "ONNX", "OCR"],
@@ -78,40 +102,55 @@ export const projects: ProjectDetail[] = [
id: "context",
number: 1,
title: "Context",
titleEn: "Context",
content:
"Sortation machines chụp ảnh packages khi di chuyển trên băng chuyền. Cần tự động đọc AWB (Air Waybill) từ ảnh để tracking và sorting.",
contentEn:
"Sortation machines capture images of packages as they move on conveyor belts. Need to automatically read AWB (Air Waybill) from images for tracking and sorting.",
type: "text",
},
{
id: "problem",
number: 2,
title: "Problem",
titleEn: "Problem",
content:
"White label trên white package — traditional CV methods không đủ robust. Cần ML-based detection.",
contentEn:
"White label on white package — traditional CV methods are not robust enough. Needed ML-based detection.",
type: "text",
},
{
id: "pipeline",
number: 4,
title: "Pipeline",
titleEn: "Pipeline",
content:
"```text\nImage\n ↓\nAWB/Label Detection (YOLO)\n ↓\nBounding Box / OBB\n ↓\nRotation Correction\n ↓\nCrop\n ↓\nOCR\n ↓\nText Extraction\n```",
contentEn:
"```text\nImage\n ↓\nAWB/Label Detection (YOLO)\n ↓\nBounding Box / OBB\n ↓\nRotation Correction\n ↓\nCrop\n ↓\nOCR\n ↓\nText Extraction\n```",
type: "diagram",
},
{
id: "challenges",
number: 7,
title: "Challenges",
titleEn: "Challenges",
content:
"White label on white package, rotated labels, varying lighting conditions, real-time inference requirements.",
contentEn:
"White label on white package, rotated labels, varying lighting conditions, real-time inference requirements.",
type: "text",
},
{
id: "result",
number: 8,
title: "Result",
titleEn: "Result",
content:
"Model fine-tuned cho AWB detection, xử lý 70,000 images/month. Presentation tại Tech Talk workshop.",
contentEn:
"Model fine-tuned for AWB detection, processing 70,000 images/month. Presented at Tech Talk workshop.",
type: "text",
},
],
@@ -119,8 +158,11 @@ export const projects: ProjectDetail[] = [
{
id: "facility-management",
title: "Facility Management Platform",
titleEn: "Facility Management Platform",
summary:
"Xây dựng nền tảng digital twin cho logistics facilities — mô hình hóa facility, theo dõi real-time, và recommendation system.",
summaryEn:
"Built a digital twin platform for logistics facilities — facility modeling, real-time monitoring, and recommendation system.",
category: "software-engineering",
role: "Senior Software Engineer — Platform Design",
technologies: ["Go", "TypeScript", "Docker", "Event-driven"],
@@ -130,24 +172,33 @@ export const projects: ProjectDetail[] = [
id: "vision",
number: 1,
title: "Vision",
titleEn: "Vision",
content:
"Chuyển đổi từ manual operations sang Operation Intelligence Platform — thu thập data, monitor, analyze, recommend, decide.",
contentEn:
"Transition from manual operations to an Operation Intelligence Platform — collect data, monitor, analyze, recommend, decide.",
type: "text",
},
{
id: "architecture",
number: 5,
title: "Architecture",
titleEn: "Architecture",
content:
"```text\nPhysical Facility\n ↓\nData Collection\n ↓\nFacility Model\n ↓\nDigital Twin\n ↓\nSimulation\n ↓\nAnalytics\n ↓\nRecommendation\n ↓\nOperation Decision\n```",
contentEn:
"```text\nPhysical Facility\n ↓\nData Collection\n ↓\nFacility Model\n ↓\nDigital Twin\n ↓\nSimulation\n ↓\nAnalytics\n ↓\nRecommendation\n ↓\nOperation Decision\n```",
type: "diagram",
},
{
id: "result",
number: 8,
title: "Result",
titleEn: "Result",
content:
"Platform hỗ trợ facility modeling, real-time visibility, và recommendation cho capacity planning.",
contentEn:
"Platform supports facility modeling, real-time visibility, and recommendations for capacity planning.",
type: "text",
},
],
@@ -155,8 +206,11 @@ export const projects: ProjectDetail[] = [
{
id: "local-llm-experiments",
title: "Local LLM Experiments",
titleEn: "Local LLM Experiments",
summary:
"Technical exploration về running local MoE LLMs với llama.cpp — GPU offloading, VRAM optimization, performance tracing.",
summaryEn:
"Technical exploration of running local MoE LLMs with llama.cpp — GPU offloading, VRAM optimization, performance tracing.",
category: "experiment",
role: "Engineering Experiment",
technologies: ["llama.cpp", "Qwen", "MoE", "Python", "CUDA"],
@@ -166,16 +220,22 @@ export const projects: ProjectDetail[] = [
id: "exploration",
number: 1,
title: "Exploration",
titleEn: "Exploration",
content:
"Technical exploration về MoE (Mixture of Experts), expert routing, GPU offloading, VRAM optimization, prefill/decode pipeline.",
contentEn:
"Technical exploration of MoE (Mixture of Experts), expert routing, GPU offloading, VRAM optimization, prefill/decode pipeline.",
type: "text",
},
{
id: "learnings",
number: 9,
title: "Lessons Learned",
titleEn: "Lessons Learned",
content:
"Understand the system → Measure → Analyze → Optimize. Không phải khoe hardware — mà thể hiện engineering approach.",
contentEn:
"Understand the system → Measure → Analyze → Optimize. Not about showing off hardware — but demonstrating engineering approach.",
type: "text",
},
],
+7
View File
@@ -1 +1,8 @@
import type { Language } from '@/types'
export const resumeAvailable = true
export const resumeLanguages: Language[] = ['en', 'vi']
export const resumeUrlFor = (lang: Language): string =>
lang === 'en' ? '/resume.pdf' : `/resume-${lang}.pdf`
+17
View File
@@ -1,3 +1,5 @@
export type Language = 'en' | 'vi';
export type ProjectCategory =
| "software-engineering"
| "logistics"
@@ -9,7 +11,9 @@ export type ProjectCategory =
export interface Project {
id: string;
title: string;
titleEn?: string;
summary: string;
summaryEn?: string;
category: ProjectCategory;
role: string;
technologies: string[];
@@ -23,7 +27,9 @@ export interface ProjectSection {
id: string;
number: number;
title: string;
titleEn?: string;
content: string;
contentEn?: string;
type: "text" | "diagram" | "metrics" | "code";
}
@@ -34,19 +40,24 @@ export interface ProjectDetail extends Project {
export interface ExperienceEntry {
id: string;
title: string;
titleEn?: string;
company: string;
duration: string;
location?: string;
responsibilities: string[];
responsibilitiesEn?: string[];
achievements?: FeaturedAchievement[];
}
export interface FeaturedAchievement {
id: string;
title: string;
titleEn?: string;
context: string;
contextEn?: string;
technicalWork: string[];
impact: string;
impactEn?: string;
metrics?: string[];
technologies: string[];
featured: boolean;
@@ -54,20 +65,26 @@ export interface FeaturedAchievement {
export interface SkillGroup {
title: string;
titleEn?: string;
skills: string[];
}
export interface PhilosophyPoint {
title: string;
titleEn?: string;
description: string;
descriptionEn?: string;
keywords: string[];
}
export interface Profile {
name: string;
title: string;
titleEn?: string;
tagline: string;
taglineEn?: string;
bio: string;
bioEn?: string;
email: string;
githubUrl: string;
linkedinUrl: string;