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 enableonce and Corepack installs the version pinned inpackageManager. - Chromium for Playwright, only if you will run the tests:
npx playwright install chromium.
Install and run
pnpm install
pnpm devOpen 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 devEnvironment 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.
| Variable | Effect |
|---|---|
NEXT_PUBLIC_SITE_URL | Canonical origin for metadata, the sitemap and the social preview. Defaults to https://antmejia.com |
NEXT_PUBLIC_APP_ENV | development (default), staging or production. Staging serves noindex metadata and a disallow-all robots.txt |
POSTHOG_ANALYTICS_KEY | Public PostHog project key. Analytics runs only in a production build, never on staging, and only with this set |
POSTHOG_API_KEY | Secret. A PostHog personal API key used at build time to upload source maps |
POSTHOG_PERSONAL_API_KEY, POSTHOG_PROJECT_ID, POSTHOG_HOST | Secret. Server-side read of field Web Vitals for /performance. Without the key and project id the route is a 404 |
FLAGS | Secret. Vercel Flags SDK key for the command-palette flag. Without it the palette is off in production and on in development |
FLAGS_SECRET | Secret. 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_TO | Resend key, verified sender, and where notifications to me go |
TURNSTILE_SECRET_KEY, TURNSTILE_SITE_KEY | Cloudflare 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_SECRET | Blog backed by Sanity. Without a project ID the blog is off and /blog returns 404. See Blog |
DOCS_BASE_PATH | Docs 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
| Command | What it does |
|---|---|
pnpm dev, pnpm build, pnpm start | Development server, production build, production server |
pnpm type-check | tsc --noEmit |
pnpm lint | ESLint over src/** |
pnpm format:check | Prettier over the whole repository. pnpm format fixes it |
pnpm test | Unit tests, plus every Storybook story (prototypes excluded) as a test in headless Chromium |
pnpm storybook | The component workshop on port 6006 |
pnpm email:dev | Live preview of the email templates on port 3030 |
pnpm icons:generate | Rewrites the favicon set from logo.svg. pnpm icons:check fails if the committed set is stale |
pnpm probe:transitions, pnpm probe:route-scroll | Motion 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.