Next.js frontend for the Archetype project.
- Node.js
>=22 - pnpm
>=10 - Docker (for containerized local runs)
Copy the sample file and adjust values as needed:
cp .env.example .envImportant variables:
NEXT_PUBLIC_API_URL(required)NEXT_PUBLIC_IIIF_UPSTREAM(required)NEXT_PUBLIC_SITE_URL(required)CORS_ALLOWED_ORIGINS(required, used by/api/*headers)
Install dependencies:
pnpm installStart the dev server:
pnpm devApp URL: http://localhost:3000
pnpm lint
pnpm test
pnpm buildThe Dockerfile builds a production image and runs Next.js in standalone mode on port 3000.
docker build \
--build-arg NEXT_PUBLIC_API_URL=https://betaarchetype.gla.ac.uk \
--build-arg NEXT_PUBLIC_IIIF_UPSTREAM=https://betaarchetype.gla.ac.uk \
--build-arg NEXT_PUBLIC_SITE_URL=https://betaarchetype.gla.ac.uk \
--build-arg CORS_ALLOWED_ORIGINS=https://betaarchetype.gla.ac.uk \
--build-arg DOCKER_IMAGE_HASH=local-dev \
-t archetype-frontend:local .If your API is reachable on another host/IP, set that URL in NEXT_PUBLIC_API_URL during build.
docker run --rm \
--name archetype-frontend \
-p 3000:3000 \
archetype-frontend:localThe container listens on 0.0.0.0 internally (already configured in the image), and -p 3000:3000 publishes it on your machine.
NEXT_PUBLIC_* values are set at image build time via --build-arg; passing them at docker run can override server-side behavior.
To open the app from another device on the same network:
- Find your machine IP (example on macOS):
ipconfig getifaddr en0
- Ensure port
3000is allowed by your firewall. - Open from another device:
http://<YOUR_MACHINE_IP>:3000
If backend/image services are on your machine, they must also be reachable from the container and from client devices (CORS and host/IP values in env vars may need to be updated).
pnpm dev
pnpm build
pnpm start
pnpm lint
pnpm lint:fix
pnpm test