Development Workflow¶
Requirements¶
- Node.js 20+ and npm 10+ (as documented in
README.md)
Setup¶
- Install dependencies.
- Configure environment variables (see below).
- Run the dev server.
Common commands (from package.json):
- npm run dev for the Next.js dev server (webpack)
- npm run dev:turbo for Turbo dev server
- npm run build for production build
- npm run start for production server
- npm run lint, npm run typecheck
- npm run test, npm run test:e2e, npm run test:all
- npm run lhci for Lighthouse CI
- npm run analyze for bundle analysis
Environment Variables¶
Validated by Zod in utils/env.ts:
- NEXT_PUBLIC_WEB3FORMS_ACCESS_KEY
- NEXT_PUBLIC_GA_MEASUREMENT_ID
- NEXT_PUBLIC_GTM_ID
- NEXT_PUBLIC_CLARITY_ID
- NEXT_PUBLIC_HOTJAR_ID
Notes:
- NEXT_PUBLIC_ENABLE_SW=true enables the service worker; otherwise it unregisters and clears SW caches. See components/ServiceWorkerRegistration.tsx.
Image Optimization¶
npm run build runs scripts/optimize-images.js via prebuild.
- Targets public/**/*.(png|jpg|jpeg)
- Generates .webp and .avif at 800px width (keeps originals)
- Uses Sharp and incremental processing based on file mtime
Testing¶
- Unit tests with Vitest (see
vitest.config.ts) - E2E tests with Playwright (see
playwright.config.ts) - Optional Lighthouse CI via
npm run lhci