-
Notifications
You must be signed in to change notification settings - Fork 20
Development
MichaΕ SzaΕowski edited this page Feb 19, 2025
·
1 revision
To set up the development environment for GovTool, ensure you have the following dependencies installed:
- GHC (Glasgow Haskell Compilation System): 9.4.8
- Cabal (Haskell package manager): 3.10.3.0
- Node.js: 20.18.1
- NPM: 11.0.0
- PostgreSQL (psql client): 17.2
To build and run the backend, execute the following commands:
cabal build
cabal run vva-be -- config config.json start-app-
cabal run vva-beβ Runs the Haskell backend application namedvva-be. -
config config.jsonβ Specifies the configuration file to be used (config.json). -
start-appβ Instructs the application to start the backend server.
The config.json file should be based on example-config.json in the same directory and should include the following fields:
{
"dbsyncconfig": {
"host": "localhost",
"dbname": "cexplorer",
"user": "postgres",
"password": "postgres",
"port": 5432
},
"port": 9999,
"host": "localhost",
"cachedurationseconds": 20,
"sentrydsn": "https://username:[email protected]/id",
"sentryenv": "dev"
}-
dbsyncconfigβ PostgreSQL connection settings used by the backend:-
hostβ Database server hostname (default:localhost) -
dbnameβ Database name (default:cexplorer) -
userβ Database username (default:postgres) -
passwordβ Database password (default:postgres) -
portβ Database port (default:5432)
-
-
portβ Port on which the backend server runs (default:9999). -
hostβ Host address for the backend (default:localhost). -
cachedurationsecondsβ Time duration for caching data (default:20seconds). -
sentrydsnβ Sentry DSN URL for error tracking. -
sentryenvβ Environment label for Sentry (devfor development,prodfor production).
To set up the frontend, execute the following commands:
npm install
npm run devBefore running the frontend, ensure the appropriate environment variables are set based on an environment file:
VITE_APP_ENV="development"
VITE_BASE_URL=""
VITE_METADATA_API_URL=""
VITE_NETWORK_FLAG=0
VITE_SENTRY_DSN=""
VITE_GTM_ID=""
VITE_IS_DEV=true
VITE_USERSNAP_SPACE_API_KEY=""
VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED='true'
VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED='true'
VITE_PDF_API_URL=""
VITE_IPFS_GATEWAY=""
VITE_IPFS_PROJECT_ID=""-
VITE_APP_ENVβ Defines the environment for Sentry reporting (e.g.,development,production). -
VITE_BASE_URLβ API URL for the core Haskell backend. -
VITE_METADATA_API_URLβ API URL for the validation service. -
VITE_NETWORK_FLAGβ Determines network type:-
0β Testnets -
1β Mainnet
-
-
VITE_SENTRY_DSNβ DSN for Sentry error tracking. -
VITE_GTM_IDβ Google Tag Manager ID. -
VITE_IS_DEVβ Enables/disables development-specific features (truefor development mode). -
VITE_USERSNAP_SPACE_API_KEYβ API key for Usersnap (bug reporting and feedback tool). -
VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLEDβ Feature flag for enabling/disabling the proposal discussion forum. -
VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLEDβ Feature flag for enabling/disabling the governance outcomes pillar. -
VITE_PDF_API_URLβ API URL for the proposal discussion pillar. -
VITE_IPFS_GATEWAYβ URL for the IPFS gateway. -
VITE_IPFS_PROJECT_IDβ Project ID for IPFS.
To set up the metadata validation service, execute the following commands:
npm install
npm run start:devBefore running the metadata validation service, set the following environment variables:
PORT=3000
IPFS_GATEWAY=https://ipfs.some.gateway
IPFS_PROJECT_ID=ipfsprojectid-
PORTβ Port on which the metadata validation service runs (default:3000). -
IPFS_GATEWAYβ URL of the IPFS gateway used for fetching metadata. -
IPFS_PROJECT_IDβ Project ID required to authenticate with the IPFS gateway.
With all three services running:
-
Frontend should set
VITE_BASE_URLto the running Haskell backend API URL. -
Frontend should set
VITE_METADATA_API_URLto the running metadata validation service API URL.