GraphPolaris Frontend
Preparing to Run Locally
Be sure that you have node.js (v18 or up) and pnpm installed. Please use pnpm for building and running the scripts of package.json. Due to the way auth works (using a sameSite cookie), the procedure for running locally is a little different than usual. These steps will only have to be done, after that everything should 'just' work.
Running Locally
Install
First run pnpm i
on the root of the workspace to install all dependencies. It will create a node_module folder in the root of the workspace as well as one for each app/library within it.
If you need to install a new dependency or upgrade an existing one, do so in the respective package.json and rerun pnpm i
in the root of the workspace. If you find any issues, feel free to delete the node_modules folder from the workspace root and from the app/lib which you are changing the dependency and rerun the pnpm i
command from the root of the workspace. Most issues are solved by then.
Running Storybook.js
To run the dev storybook (implementing visualizations) simply run pnpm sb
and once it is running, ctrl-click the link what appears in the terminal. The url should be [http://localhost:6006].
Dev server
The dev server (as of now) expects the backend to be also running in your machine. Therefore, for it to be useful you will need first to have the Backend
running. After that you also need to be sure tp update your hosts file. Finally, to run the application simply run pnpm dev
from the workspace root.
Hosts file
To configure the hosts file, you need to first find it in your machine.
- Windows: c:\Windows\System32\Drivers\etc\hosts
- Mac/Linux: /etc/hosts
Open the file with administrative privileges (e.g. sudo nano, sudo vim, or use vscode and when you try to save it will prompt you to save as an administrator) and add these two lines at the end:
127.0.0.1 local.graphpolaris.com
127.0.0.1 api.graphpolaris.com
This will make the dev server to try to connect to the backend running in your own machine. If you want to make the dev server to call the production (cloud-based) backend of graph polaris, only add the first line of the two like so:
127.0.0.1 local.graphpolaris.com
Other Commands
You can run pnpm commands (see available ones in packages.json) from the root of the workspace, which will trigger turborepo to run it in all libraries and apps of the workspace. You can run pnpm test
or pnpm lint
this way to test or lint the entire workspace.
You can also go into a specific lib/app and run pnpm commands from there to scope the task to only that part of the workspace.