This repository contains the code of the frontend application of the AccessMod project.
Docker image can be found in the Github package repository.
The AccessMod application is a Next.js application. It is a frontend app designed to connect to an OpenHexa instance.
The app communicates with OpenHexa through its GraphQL API, and uses the standard OpenHexa cookie-based authentication.
The project is meant to be deployed in a containerized environment, such as Kubernetes.
The following environment variables should be provided at build time (for the docker build
or npm run build
):
RELEASE
: a release identifier, such as a Git tag (used for uploading source maps to Sentry)SENTRY_AUTH_TOKEN
: A valid Sentry authentication token
The following environment variables should be provided at run time:
GRAPHQL_ENDPOINT
: the URL of the OpenHexa GraphQL APISENTRY_DSN
: the Sentry DSNSENTRY_TRACES_SAMPLE_RATE
: the Sentry sampling rate of tracesSENTRY_ENVIRONMENT
: the Sentry environment tag
First, install the dependencies
npm install
Then, copy the sample .env.local.dist
and adapt it to your needs:
cp .env.local.dist .env.local
Finally, run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the result.
npm run dev
: Launch Nextjs in dev mode and watch files to extract graphql code and generate typescript types and hooksnpm run next
: Launch only the Nextjs app in dev modenpm run build
: Build the Nextjs appnpm run start
: Start the app from the build directory (it has to be built before)npm run test
: Run the tests in watch modenpm run test:ci
: Run all the tests in CI modenpm run lint
: Lint files insrc/
usingeslint
npm run format
: Format files insrc/
usingprettier
npm run prepare
: This script is called automatically by npm onnpm install
. It adds the pre-commit hooknpm run schema
: Run an introspection query on the graphql backend and generate aschema.graphql
file. This file is used to generate typescript types & for DX in the IDEnpm run codegen
: Generate typescript types found in all the files based onschema.graphql
npm run i18n:extract
: Extract translatable strings and writemessages.json
files for each language
To extract new strings from the src/
directory, run the extract command:
npm run i18n:extract
Translations are stored in public/locales/[lang]/[namespace].json
. The default namespace
is messages
.