This is a multi-workspace repo that requires npm v11.11.0. The minimum node version is set to v24.14.0.
Node can be downloaded from the official Node.js site. You may also consider using a Node version manager.
Your version of Node may not ship with npm v11.11.0. To install it, run:
npm install npm@11.11.0If you are using a Node version manager, you can run the following to install the correct version of Node:
nvm install 24.14.0to use the correct version of Node:
nvm use 24.14.0From the root of the project, install dependencies by running:
npm installInstalling from the root of the repository is required to avoid multiple installations of React in the workspaces. When this happens, React will fail to render.
Dependencies can also be installed from the root of the repository. To install a dependency for a specific workspace, you can run:
npm install --save my-package --workspace=packages/coreSince this is a TypeScript project, installing the community type definitions may also be required:
npm install --save-dev @types/my-package --workspace=packages/coreRun the prototype in dev mode with auto-rebuilding:
npm run devBy default, this will start a dev server listening to http://localhost:3000
Note: Recompiling the type definitions for core needs to be done manually:
npm run compile --w=packages/coreRun ESLint for all of the workspaces:
npm run lintRun prettier for all of the workspaces:
npm run formatThis project uses jest for testing.
| Test Type | Filename |
|---|---|
| Unit | *.unit.test.ts |
| Integration | *.int.test.ts |
Tests should live in the same directory as if a single module is under test. Since unit tests should only test a single module, they should also live in the directory. For example,
+ /src
| - monarch.ts
| - monarch.unit.ts
| - monarch.int.ts
npm run test will run unit tests.
npm run test:int will run integration tests.
npm run test:all will run both unit and integration tests.
The portal has support for running in a Docker container To create a docker container:
docker build -t GDCV2 .
to run it:
docker run -p 3000:3000 -t GDCV2
-
Configure your machine to map
localhost.gdc.cancer.govto resolve to127.0.0.1.In Mac or Linux, edit
/etc/hosts(requires sudo):
127.0.0.1 localhost localhost.gdc.cancer.gov
- Install
mkcertand generate a locally trusted certificate (one-time setup - assuming MacOS device):
brew install mkcert
mkcert -installThen from the repo root:
mkdir -p .certs
mkcert -key-file .certs/localhost-key.pem -cert-file .certs/localhost.pem localhost.gdc.cancer.gov- Start the dev server from the repo root:
npm run dev:gdc:https- Open Chrome (or any browser that you use) with web security disabled to suppress CORS warnings:
open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--args --user-data-dir="/tmp/chrome_dev_test" \
--disable-web-security \
https://localhost.gdc.cancer.gov:3000-
You can now access the app at
https://localhost.gdc.cancer.gov:3000and use login and all authentication features. -
Once you login through NIH website, it will redirect you to
https://portal.gdc.cancer.gov/?login=trueand the tab won't close. You will have to manually close it and go to thehttps://localhost.gdc.cancer.gov:3000tab you came from. You might or might not have to refresh the page for session cookie to be picked up by the tab to show that you are logged in. This is a new known behavior.
Note: The
.certs/folder is gitignored. Each developer needs to run themkcertsteps once on their machine.
A mock server can be used to mock responses from outside clients. This can be useful for testing auth related issues. To set up your dev site to use the mock server:
- Create a certificate for your mock server, detailed here: https://www.mocks-server.org/docs/guides/https-protocol/#creating-a-self-signed-certificate. Use
mock-server-key.pemandmock-server-cert.pemfor names. - Uncomment
https://localhost:3100in next.config.js - Set your dev site to point at the mock server for auth calls with
export NEXT_PUBLIC_GDC_AUTH=https://localhost:3100and restart the dev site - Start the mock server with
npm run mocks. In the mock server process, you can selectUse route variantto toggle between different responses.
Update the versions of all workspaces at the same time. (Replace 2.13.0 with the new version to set)
npm run version -- 2.13.0Run build-docs to generate documentation for "portal-proto" and "core" packages For developing applications for the GDC Portal, please review Developer Guide.
npm run build-docsAfter generation documentation can be found in the docs folder
This project is a monorepo managed by lerna. It is composed of the following packages:
packages/core: Contains the state management and function for accessing the APIs of the GDC.packages/portal-proto: The GDC Frontend Framework prototype. This is the main package for the project. It uses NextJS as the application framework and React as the UI framework. For basic components we use Mantine.dev (version 6), as the UI library as it compatiable with our design system and use of Tailwind CSS. Please note that before the final release the package will be renamed topackages/portal.packages/sapien: is the package that contains the Bodyplot UI used on the GDC Portal V2 home page.packages/lighthouse: is the package that contains the Lighthouse UI used on the GDC Portal V2 home page for testing performance.packages/survivalplot: is the package that contains the survival plot UI used on the GDC Portal V2 apps.