AI/ML Engineer Portfolio built with React, TypeScript, and Vite. Deployed on GitHub Pages with Cloudflare CDN.
π Live Site: pk13055.com
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build locally
npm run preview
# Deploy to GitHub Pages
npm run deploy
# Deploy and purge Cloudflare cache (requires env vars)
npm run deploy:fullNote:
npm run build(viaprebuild) also generates the resume PDF, which requires a LaTeX engine β see Resume PDF Pipeline.
- Framework: React 18 + TypeScript
- Build Tool: Vite 5
- Styling: Tailwind CSS 4
- Animations: Framer Motion
- UI Components: Radix UI
- Icons: Tabler Icons
- Deployment: GitHub Pages + Cloudflare CDN
- SEO: React Helmet Async
The site serves a downloadable resume at /resume.pdf (also wget/curl friendly), generated in two steps from the single source of truth src/data/resume.js:
- Generate LaTeX β
scripts/generate-resume-tex.jsparses the resume data and coalesces it into a formal LaTeX document atpublic/resume.tex(also served at/resume.tex). - Compile PDF β
scripts/compile-resume-pdf.jscompiles it intopublic/resume.pdfusing Tectonic (falls back tolatexmk,pdflatex, or Docker if Tectonic isn't installed; override withRESUME_TEX_COMPILER).
# One-time local setup (macOS)
brew install tectonic
# Run both steps (tex generation + PDF compile)
npm run resume:pdf
# Or run steps individually
npm run resume:tex # src/data/resume.js β public/resume.tex
npm run resume:compile # public/resume.tex β public/resume.pdfNotes:
npm run resume:pdfis wired intoprebuild, so everynpm run buildregenerates the PDF automatically β to update the resume, just editsrc/data/resume.jsand build.- The first Tectonic compile downloads LaTeX packages (~2-3 min); subsequent compiles take seconds.
public/resume.texandpublic/resume.pdfare build artifacts and gitignored.- In CI (
.github/workflows/deploy.yml), Tectonic is installed and cached automatically β no manual steps needed.
This site implements comprehensive performance optimizations addressing PageSpeed Insights recommendations:
- Client-side caching with cache-first strategy for assets
- Network-first strategy for HTML to ensure fresh content
- Automatic cache management and updates
Aggressive bundle size reduction addressing "Reduce unused JavaScript":
- Advanced code splitting: 6 optimized chunks instead of monolithic bundle
- Tree shaking: Removes unused code from dependencies
- Aggressive minification: Terser with console removal and 2-pass compression
- Modern ES2020 target: Smaller output, faster execution
- Smart chunking: React (50KB), React-DOM (132KB), Framer Motion (76KB) cached separately
- Bundle analyzer: Visualize what's in your bundle with
npm run build:analyze
Result: 44% reduction in main bundle size, better caching strategy
π See BUNDLE_OPTIMIZATION.md for detailed analysis and further optimizations.
Since the site is behind Cloudflare, follow these steps to maximize cache efficiency:
-
Navigate to Cloudflare Dashboard β Your Site β Rules β Cache Rules
-
Create these rules (in order):
Rule 1: Cache Hashed Assets (JS/CSS)
- When incoming requests match:
- Field:
URI Path - Operator:
starts with - Value:
/assets/ - AND Field:
File extension - Operator:
is in - Value:
js css
- Field:
- Then:
- Cache eligibility: Eligible for cache
- Edge TTL: 1 year
- Browser TTL: 1 year
Rule 2: Cache Images
- When incoming requests match:
- Field:
File extension - Operator:
is in - Value:
png jpg jpeg gif svg webp ico avif
- Field:
- Then:
- Cache eligibility: Eligible for cache
- Edge TTL: 1 year
- Browser TTL: 1 year
Rule 3: Bypass HTML Cache
- When incoming requests match:
- Field:
File extension - Operator:
equals - Value:
html - OR Field:
URI Path - Operator:
equals - Value:
/
- Field:
- Then:
- Cache eligibility: Bypass cache
Rule 4: Bypass Service Worker
- When incoming requests match:
- Field:
URI Path - Operator:
equals - Value:
/sw.js
- Field:
- Then:
- Cache eligibility: Bypass cache
π Quick Setup: CLOUDFLARE_RULE_SETUP.md - Step-by-step with screenshots
π Detailed Guide: cloudflare-cache-rules.md - Technical details
Implements modern responsive images to reduce bandwidth and improve load times:
- Responsive srcset: Serves appropriate image sizes for each device
- Modern formats: WebP with PNG fallback for better compression
- Lazy loading: Below-the-fold images load on demand
- Priority loading: Critical above-the-fold images load immediately
- Cloudflare Polish: Automatic image optimization at the edge
Setup: Enable Cloudflare Polish (5 minutes)
- Dashboard β Speed β Optimization β Image Optimization
- Enable Polish (Lossless or Lossy)
- Enable WebP conversion
π See IMAGE_OPTIMIZATION.md and cloudflare-images-setup.md for detailed guides.
For advanced cache control, deploy the provided Cloudflare Worker:
# The worker code is in public/cloudflare-worker.js
# Deploy via Cloudflare Dashboard β Workers & Pages β Create WorkerSet up automatic Cloudflare cache purging after deployments:
-
Get your Cloudflare credentials:
- Zone ID: Dashboard β Overview β Zone ID (right sidebar)
- API Token: Dashboard β My Profile β API Tokens β Create Token
-
Set environment variables:
export CLOUDFLARE_ZONE_ID="your_zone_id" export CLOUDFLARE_API_TOKEN="your_api_token"
-
Deploy with cache purging:
npm run deploy:full
After implementing these optimizations:
- β Efficient cache policy: 1 year cache for static assets
- β Proper image sizing: 70%+ bandwidth savings on images
- β Modern image formats: WebP reduces size by 30-40%
- β Reduced server requests: Assets cached at edge and client
- β Faster TTFB: Cloudflare edge caching
- β Better PageSpeed scores: Addresses multiple recommendations
- β Instant repeat visits: Service worker + edge caching
Real-world impact:
- First visit: Faster image loading
- Repeat visit: 80-95% faster overall
- Mobile users: 70%+ less data usage
- PageSpeed score: +15-30 points improvement
pk13055/
βββ src/
β βββ components/
β β βββ layout/ # Navigation, Footer
β β βββ sections/ # Page sections (Hero, About, etc.)
β β βββ ui/ # Reusable UI components
β βββ lib/ # Utilities and helpers
β β βββ animations.ts # Animation configurations
β β βββ seo.ts # SEO utilities
β β βββ utils.ts # Common utilities
β β βββ registerSW.ts # Service worker registration
β βββ App.tsx # Main app component
β βββ main.tsx # Entry point
β βββ index.css # Global styles
βββ public/ # Static assets
β βββ sw.js # Service worker
β βββ _headers # Cache headers (for Cloudflare/Netlify)
β βββ cloudflare-worker.js # Optional Cloudflare Worker
βββ scripts/
β βββ generate-resume-tex.js # Resume data β public/resume.tex
β βββ compile-resume-pdf.js # public/resume.tex β public/resume.pdf
β βββ purge-cloudflare-cache.js # Auto cache purging
βββ vite.config.ts # Vite configuration
βββ cloudflare-cache-rules.md # Cloudflare setup guide
vite.config.ts- Build optimization and chunk splittingtailwind.config.js- Tailwind CSS configurationtsconfig.json- TypeScript configurationcomponents.json- shadcn/ui configuration
# Run development server (with hot reload)
npm run dev
# Type check
npm run build # TypeScript compilation is part of build
# Build for production
npm run build
# Preview production build
npm run previewThe site automatically builds and deploys to GitHub Pages on push to the master branch via GitHub Actions (.github/workflows/deploy.yml), which installs Tectonic, builds the site (including the resume PDF), publishes dist/ to GitHub Pages, and purges the Cloudflare cache (if the CLOUDFLARE_API_TOKEN / CLOUDFLARE_ZONE_ID repo secrets are set).
Manual deployment:
# Build and deploy
npm run deploy
# Deploy with Cloudflare cache purge
npm run deploy:fullMonitor your site's performance:
This project is open source and available under the MIT License.
For implementation questions or issues, please refer to: