Skip to content

DBCDK/merkur-frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

edf0dbe · Jan 20, 2025
Jan 15, 2025
Apr 4, 2024
Oct 13, 2021
Mar 20, 2024
Apr 4, 2024
Jan 12, 2022
Aug 18, 2021
Feb 27, 2024
Aug 16, 2021
Aug 16, 2021
Feb 26, 2024
Mar 1, 2024
Aug 16, 2021
Feb 28, 2024
Apr 28, 2022
Aug 16, 2021
Sep 9, 2024
Apr 28, 2022
Aug 16, 2021
Oct 11, 2021
Jan 15, 2025
Jan 15, 2025
Mar 1, 2024

Repository files navigation

Merkur-frontend

This is the code behind https://posthus.netpunkt.dk, written in Next.js

Getting started

The development environment may be set up using either npm or docker-compose.

Set up your local environment

To run this locally you need to set some environment variables. The following must be set in the application:

  • CLIENT_ID Client id from adgangsplatformen/smaug
  • CLIENT_SECRET Client secret from adgangsplatformen/smaug
  • NEXTAUTH_URL This is the return url from adgangsplatformen
  • NEXTAUTH_SECRET Next-auth secret for encrytion JWTs
  • APIKEYS JSON array of valid API logins
  • FILESTORE_URL Full URL to the filestore API

The following environment variables can be set in the application

  • PORT Port on which Next.js runs. Default is 3000.
  • STORYBOOK_PORT Port on which storybook runs. Defaults is 4000.

Create a file in the root of the project called .env.local

This file is ignored by git and will and should not be added to the GitHub repository. This is a local environment file for your personal workspace.

.env.local

CLIENT_ID=<Client id from adgangsplatformen/smaug>
CLIENT_SECRET=<Client secret from adgangsplatformen/smaug>
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET=<Next-auth secret from staging deploy project>
APIKEYS={"010100":{"apikey":"pass"},"820030":{"apikey":"pass"},"test":{"apikey":"test"},"810010":{"apikey":"pass"}}
FILESTORE_URL=http://dataio-filestore-service.metascrum-staging.svc.cloud.dbc.dk/dataio/file-store-service

Start application

npm

  • npm install install dependencies
  • npm run dev:storybook starts a Storybook development server for developing React components in isolation
  • npm run dev:next starts Next.js development server that runs the actual application

docker-compose

  • docker-compose -f docker-compose-dev.yml up will start Storybook on port 4000, Next.js on port 3000

Running the tests

Start the wiremock server first:

npm run mock

Then start the next development environment pointing to mocked filestore:

export FILESTORE_URL=http://localhost:8080; npm run dev:next

Run cypress tests in interactive mode

npm run cy:open

or headless

npm run cy:run