Skip to Content
Getting started

Getting started

How I run the portfolio locally, which variables exist, and the fixes for the problems that come up most.

Prerequisites

  • Node.js 26. The version is in .nvmrc.
  • PNPM 10. Run corepack enable once and Corepack installs the version pinned in packageManager.
  • Chromium for Playwright, only if you will run the tests: npx playwright install chromium.

Install and run

pnpm install pnpm dev

Open http://localhost:3000. The app needs no environment variables to run. The docs site has its own install:

pnpm --dir docs-site install pnpm --dir docs-site dev

Environment variables

Every variable is optional. Without them the site runs, the resume dialog works, no email is sent, and analytics is off. The schemas in src/config/env/client.ts and src/config/env/server.ts are the source of truth, and .env.example is a template to copy to .env.local.

VariableEffect
NEXT_PUBLIC_SITE_URLCanonical origin for metadata, the sitemap and the social preview. Defaults to https://antmejia.com
NEXT_PUBLIC_APP_ENVdevelopment (default), staging or production. Staging serves noindex metadata and a disallow-all robots.txt
POSTHOG_ANALYTICS_KEYPublic PostHog project key. Analytics runs only in a production build, never on staging, and only with this set
POSTHOG_API_KEYSecret. A PostHog personal API key used at build time to upload source maps
POSTHOG_PERSONAL_API_KEY, POSTHOG_PROJECT_ID, POSTHOG_HOSTSecret. Server-side read of field Web Vitals for /performance. Without the key and project id the route is a 404
FLAGSSecret. Vercel Flags SDK key for the command-palette flag. Without it the palette is off in production and on in development
FLAGS_SECRETSecret. Authenticates Flags Explorer against /.well-known/vercel/flags and decrypts toolbar overrides. Set by Vercel when Flags Explorer is enabled
RESEND_API_KEY, RESUME_FROM, RESUME_NOTIFY_TOResend key, verified sender, and where notifications to me go
TURNSTILE_SECRET_KEY, TURNSTILE_SITE_KEYCloudflare Turnstile bot check. In production the API refuses requests when the secret is missing
NEXT_PUBLIC_SANITY_PROJECT_ID, NEXT_PUBLIC_SANITY_DATASET, SANITY_API_READ_TOKEN, SANITY_WEBHOOK_SECRETBlog backed by Sanity. Without a project ID the blog is off and /blog returns 404. See Blog
DOCS_BASE_PATHDocs site only. Mounts it under a path such as /docs

Vercel Preview builds run with NODE_ENV=production, so never set the PostHog key for the Preview environment. The reasoning is in Analytics. The docs and Storybook Vercel projects read the same POSTHOG_ANALYTICS_KEY, for Production only, and send their own events: see Docs site and Storybook.

Commands

CommandWhat it does
pnpm dev, pnpm build, pnpm startDevelopment server, production build, production server
pnpm type-checktsc --noEmit
pnpm lintESLint over src/**
pnpm format:checkPrettier over the whole repository. pnpm format fixes it
pnpm testUnit tests, plus every Storybook story (prototypes excluded) as a test in headless Chromium
pnpm storybookThe component workshop on port 6006
pnpm email:devLive preview of the email templates on port 3030
pnpm icons:generateRewrites the favicon set from logo.svg. pnpm icons:check fails if the committed set is stale
pnpm probe:transitions, pnpm probe:route-scrollMotion and navigation regression probes. They need pnpm build && pnpm start running. See Motion probes

Before you hand a change back, run the same checks CI runs. They are listed in Quality gates.

Troubleshooting

pnpm build fails with Invalid URL. SKIP_ENV_VALIDATION is set. It skips the schema default for NEXT_PUBLIC_SITE_URL, which the build needs. Unset it.

pnpm test fails before running any story. Playwright’s Chromium is not installed. Run npx playwright install chromium once.

A Storybook test fails once and passes on rerun. The Glass Surface story is timing-sensitive when several jobs run in parallel. Rerun it alone before treating it as a regression.

ExperimentalWarning: localStorage is not available during the build. Harmless. It comes from a package the Vanilla Extract plugin uses on Node 25 and later. No application code reads storage on the server. See Node runtime.

The pre-commit hook does nothing. It is off by default. Put HUSKY_ENABLED=true in .husky/_/pre-commit.options to turn it on. The commit-msg hook always runs, so a commit message that is not a Conventional Commit is rejected.

A probe fails or cannot connect. Probes drive a production server, not pnpm dev. Run pnpm build && pnpm start, and set PROBE_BASE if the server is not on port 3000.

Docs search says it is unavailable. The index is generated by pnpm --dir docs-site build. Build once, then start the dev server. See Documentation search.

An edit to a page under /reference disappears. Those pages are copied from the repository’s docs/ folder on every docs build. Edit the file in docs/.

Do not edit CHANGELOG.md or the version in package.json. Release Please owns both. See Release process.

Last updated on