← All case studies

Engineering this website: a static-first portfolio

Static HTML by default with self-hosted fonts (92.09 KB gzipped), strict TypeScript, and automated build-time truth and size-budget gates.

Praveen Babu S portfolio social card
Live build preview

Designed for speed, density, and zero template feel

Home page desktop screenshot
Services overview desktop screenshot

A static-first engineering portfolio rebuilt with Astro 7, self-hosted variable fonts under 95 KB, physics-computed spring motion tokens, build-time Satori OG image cards, and four automated post-build verification scripts checking content truth, internal links, JSON-LD entity graphs, and gzipped page weight on every build.

Context and problem

A portfolio for a solo engineer is itself a technical artefact. If a site claims discipline in performance, accessibility, and system architecture while shipping a heavy client-side bundle or unverified numbers, the medium contradicts the message.

The previous version of this site was a client-rendered React single-page application using Three.js and React Three Fiber. While interactive, it forced every visitor—including search crawlers and AI answer engines—to wait for JavaScript hydration before seeing primary content, relied on external font CDNs, and mixed unverified marketing claims with real engineering work.

The goal of the redesign was straightforward: rebuild the site so that every page renders as clean, static HTML with strict semantic structure, enforces truth rules at compile time, and holds every route under explicit gzipped transfer budgets measured on every build.

Constraints and architectural decisions

Every major choice in this build came with a concrete trade-off. Rather than hiding those trade-offs, here are the four decisions that shaped the architecture.

Decision 1: Astro 7 static output over a React SPA

  • Options considered: Keep React + Vite with prerendering, migrate to Next.js static export, or adopt Astro 7 with zero-JS islands.
  • Choice: Astro 7 (output: 'static', build.format: 'file', trailingSlash: 'never').
  • Why: Content pages, case studies, and service guides need zero framework runtime in the browser. Astro renders plain HTML at build time and lets interactive pieces—such as the theme toggle, command palette, and filter controls—run as small vanilla TypeScript custom elements (<x-name>).
  • Trade-off accepted: Cross-page shared-element transitions rely on native browser @view-transition rather than a client-side router. Browsers without cross-document View Transitions fall back to standard navigation without a JavaScript polyfill.

Decision 2: Self-hosted variable fonts with pinned ROND and opsz axes

  • Options considered: Load Google Fonts from a CDN, self-host the full Google Sans Flex variable font, or subset and instance the font at build time.
  • Choice: Self-host subset WOFF2 files generated with fonttools, keeping wght (300–800) and wdth (75–100) while pinning ROND and opsz at defaults, paired with JetBrains Mono for technical labels.
  • Why: Keeping all variable axes pushed the main font file to 242 KB, far above our 110 KB site-wide font budget. Pinning opsz and ROND brought the total font payload (main Latin, rupee symbol face, and JetBrains Mono) down to 92.09 KB gzipped while preserving weight and width axes for typography.
  • Trade-off accepted: Display headings do not use automatic optical-size adjustments; metric-matched Arial and Consolas fallbacks are used to minimize layout shift while fonts load.

Decision 3: Computed spring physics instead of hand-guessed easing curves

  • Options considered: Hand-authored cubic-bezier() approximations, a runtime JS spring library on every component, or build-time spring physics sampled into CSS linear().
  • Choice: A build-time TypeScript spring solver (src/lib/spring-math.ts) that integrates underdamped, critical, and overdamped spring equations (mass = 1) and emits both src/styles/motion.css and src/lib/springs.ts.
  • Why: CSS linear() gives real spring overshoot and settling without shipping a physics engine to the browser. Generating both CSS and TS from one source guarantees that CSS transitions and JavaScript animations stay identical, and a unit test fails if the generated files go stale.
  • Trade-off accepted: Using a single consistent 0.1% settle threshold produces slightly longer settle durations than rough spec estimates (for example, snappy settles in 460 ms rather than ~300 ms).

Decision 4: Build-time truth rules and post-build HTML verification

  • Options considered: Manual QA checklists before deploy, or automated build gates that inspect the generated dist/ output.
  • Choice: Zod content schemas plus four Node scripts (check-content.mjs, check-links.mjs, validate-schema.mjs, size-budget.mjs) wired directly into npm run build.
  • Why: Rules that are not automated eventually slip. The Zod schemas reject testimonials without consent: true, reject metrics that lack a measurement method and ISO date, and reject unknown topic IDs. After Astro writes dist/, the post-build scripts parse every HTML file with parse5 to verify heading counts, meta lengths, internal links, redirect chains, JSON-LD @id graph resolution, and gzipped transfer sizes.
  • Trade-off accepted: Adding a new case study or service takes longer upfront because every page must clear word minimums, answer-summary limits, and schema checks before the build succeeds.

System architecture

The site is organized into three layers:

  1. Typed facts & content collections (src/data/, src/content/): identity.ts serves as the single source of truth for entity facts, bios, and availability. Every JSON-LD graph, meta tag, llms.txt file, and bio block reads from this registry so external search engines and AI systems see one consistent entity.
  2. Design tokens & capability detection (src/styles/, src/lib/capability.ts): Four color modes (light, dark, theatre, and blueprint) are expressed purely through CSS custom properties with computed WCAG contrast pairs. Before the stylesheet loads, a 352-byte inline head script sets data-motion (full, lite, or static), data-theme, and data-mode on <html> so there is no flash of wrong theme or motion tier.
  3. Post-build audit pipeline (scripts/): Every npm run build generates src/data/site-stats.json directly from the gzipped assets in dist/, ensuring the numbers shown on the site reflect the actual latest build rather than stale manual estimates.

Here is the core spring-sampling check that keeps generated CSS and TypeScript tokens synchronized:

src/lib/capability.ts (excerpt)
export type MotionTier = 'static' | 'lite' | 'full';

export function detectTier(env: CapabilityEnv): MotionTier {
if (env.reducedMotion) return 'static';
if (env.saveData) return 'lite';
if (env.cores !== undefined && env.cores < 4) return 'lite';
if (env.memoryGB !== undefined && env.memoryGB < 4) return 'lite';
if (!env.webgl2) return 'lite';
return 'full';
}

What the build measures today

Because site-stats.json is regenerated on every build, the site reports its own measured footprint directly:

  • Home route gzipped transfer: 164.91 KB total (28.96 KB HTML, 24.35 KB CSS, 19.51 KB JS, 92.09 KB site-wide fonts).
  • Content budget targets: ≤ 50 KB HTML, ≤ 30 KB CSS, ≤ 15 KB JS on standard content pages; ≤ 80 KB HTML, ≤ 35 KB CSS, ≤ 70 KB JS on heavy interactive pages.
  • OG social cards: Rendered at build time via Satori and @resvg/resvg-js into static PNGs capped at 120 KB each.
  • Automated unit tests: Verified with the native Node 22 test runner covering spring math, capability detection across all 128 hardware/preference combinations, pricing and the lead form’s data checks.

What comes next

The foundation and core pages are designed to grow incrementally. Next steps include adding interactive scroll-driven motion scenes gated to the full capability tier, completing owner-verified metrics for client case studies so they can move from draft to published, and running real-device Lighthouse and axe audits across light, dark, and blueprint modes.

Build-time OG cards, accessibility, and truth rules

Several smaller engineering details keep the site honest and maintainable over time:

  • Build-time OG image generation: Rather than maintaining static PNGs by hand or running a headless browser in CI, social preview cards are rendered at build time using Satori and @resvg/resvg-js with a static OFL Google Sans Flex WOFF font. Each generated PNG is checked against a 120 KB ceiling so social cards never bloat the repository or CDN cache.
  • Computed WCAG contrast pairs: Every surface and text token across light, dark, theatre, and blueprint modes was checked against WCAG AA contrast formulas. Where the brand emerald accent (#10B981) fell below 3:1 on white for non-text focus indicators, a dedicated --focus token (accent-ink at 5.48:1 in light mode) was introduced so keyboard focus rings remain clearly visible in every mode.
  • Zero-placeholder enforcement: Content schemas reject testimonials without explicit consent: true and reject metrics that lack a repeatable measurement method and ISO date. Until real measurements and owner-reviewed facts are supplied for client case studies, those entries remain in draft status rather than shipping estimated numbers.
  • Progressive enhancement for interactive islands: Navigation menus, theme and blueprint toggles, the command palette, and work filters are built as small custom elements (<x-name>) that enhance static semantic HTML. With JavaScript disabled, every page, link, FAQ accordion, and email fallback continues to work cleanly.
  • View Transitions without framework lock-in: Cross-document View Transitions provide subtle 300 ms crossfade and 12 px rise animations between pages in supporting browsers, while circular reveal wipes on the theme and blueprint toggles respect prefers-reduced-motion and the static capability tier unconditionally.

Lessons from treating a portfolio like production software

Applying strict budgets and automated truth checks to a personal site surfaced edge cases early—such as variable font axis weight (opsz alone adding nearly 100 KB), Satori absolute-positioning quirks, and focus-ring contrast limits on light surfaces. Catching those in build scripts rather than manual spot-checks means every future article, service, or case study inherits the same engineering floor automatically.

Measured results

Verified numbers from the production build

Static pages built
48
Pagefind + Astro build
Home JS (gzipped)
19.51 KB
Budget: 60 KB
Site-wide fonts
92.09 KB
Budget: 140 KB
Automated CI gates

Four scripts that run on every build

check-content.mjs

Enforces AEO answer summaries, banned-word checks, and word-count floors across all pages.

check-links.mjs

Crawls every built HTML file to confirm zero broken internal routes or hash targets.

validate-schema.mjs

Parses every JSON-LD script block to verify required Schema.org types and entity IDs.

size-budget.mjs

Measures gzipped HTML, CSS, initial JS, lazy JS, and fonts against per-class budgets.

Available for new projects

Building something with similar constraints?

Send a short brief. I contact you based on your quote and my current workload.

Start a projectRequest a call back

    Studio desk

    Start a project

    1. Your pick2. Your project
    Step 1: Your pick and contact details