Skip to content

5. Local Development

Almost there! Let’s get your service running on your machine so you can develop comfortably. This is what your daily workflow will look like.

The app and infrastructure are separate npm projects. For day-to-day development, you only work in src/:

Terminal window
# First time setup (from project root)
npm run co:login # Authenticate with CodeArtifact for @hema/* packages
npm run install-all # Installs root (CDK) + src (Next.js) dependencies
# Daily development
cd src
npm run dev # Starts Next.js at http://localhost:3000

Create src/.env.local with your service’s configuration:

Terminal window
# Sanity CMS
NEXT_PUBLIC_SANITY_PROJECT_ID=your-project-id
NEXT_PUBLIC_SANITY_DATASET=production
NEXT_PUBLIC_SANITY_API_VERSION=2024-01-01
SANITY_API_READ_TOKEN=sk-...
# Service identity
NEXT_PUBLIC_BASE_URL=http://localhost:3000
NEXT_PUBLIC_SERVICE_ID=your-service
ENVIRONMENT=test
# Domains (for next-intl multi-domain routing)
NEXT_PUBLIC_DOMAIN_NL=nl.localhost:3000
NEXT_PUBLIC_DOMAIN_COM=com.localhost:3000
# API access (if your MFE calls backend APIs)
BASE_API_URL=https://api.acc.hema.nl
AUTH_SECRET={"clientId":"...","clientSecret":"...","baseUrl":"https://..."}

Or fetch values from AWS (requires SSO login):

Terminal window
bash scripts/fetch-env-from-aws.sh

Since HEMA uses domain-based i18n routing (hema.nl vs hema.com), you need two local domains. Add to /etc/hosts:

127.0.0.1 nl.localhost
127.0.0.1 com.localhost

Then access:

  • http://nl.localhost:3000 → Dutch (nl-nl)
  • http://com.localhost:3000/nl-be → Belgian Dutch
CommandWhat it does
npm run devStart Next.js dev server
npm run buildProduction build (test before pushing)
npm run testRun Vitest unit tests
npm run test:watchVitest in watch mode
npm run lintESLint check
npm run typecheckTypeScript type check
npm run e2e:bddRun Playwright BDD tests

CapabilityPackage/ToolRequired?
Next.js 15+ with App Routernext
Standalone Docker outputnext.config.tsoutput: 'standalone'
HEMA Design System@hema/hds-components-react, @hema/hds-tailwindcss-presets
Web Shell (layout)@hema/omni-web-app-shell-shell, @hema/omni-web-app-shell-core
Analytics@hema/omni-web-app-shell-analytics
Internationalizationnext-intl
CMS Integration@sanity/client, next-sanityIf content-driven
Server ActionsNext.js built-in + allowedOrigins config
Kong AuthenticationKongAuthenticator class + AUTH_SECRETIf calling backend APIs
GraphQL (PODS)@apollo/client, @apollo/client-integration-nextjsIf consuming product data
Route Groups(shop) pattern for layout variantsRecommended
Gateway Registration@hema/omni-web-gateway-management-library-constructs
Health endpoint/api/health
Unit testsvitest, @testing-library/react
E2E tests@playwright/test, playwright-bdd
Security headersnext.config.ts headers
Feature sandboxesButler + buildspec-ci.yaml
CDK Infrastructureaws-cdk-lib, ECS Fargate + ALB

Once your MFE is running, explore these guides for deeper topics:

TopicGuide
CDK Infrastructure DetailsInfrastructure
Docker BuildDocker Standalone
Gateway RegistrationGateway Registration
Multi-Zone ConfigMulti-Zone
Web ShellWeb Shell
HDS ComponentsDesign System
i18n SetupInternationalization
CMS OverviewSanity CMS
Testing StrategyTesting
Butler SandboxesFeature Sandboxes
MonitoringObservability
Data APIs (PODS)PODS Integration
EnvironmentsEnvironment Map