Source code for the TRASE front end.
Trase brings unprecedented transparency to commodity supply chains revealing new pathways towards achieving a deforestation-free economy.
This project consists of only the frontend application for the TRASE website. All data displayed is loaded through requests to the TRASE API.
This project mainly uses D3 and Leaflet, plus Redux for managing app state. More on the stack here
Besides the frontend code, the project also includes a standalone nodejs web server, which should be used only for development purposes
+-------+ +-------+
| | | |
| | | |
+-------+ ---\ | |
| node | \-------+-------+
+-------+--\ link | node |
| | \ | |
| | \--------+-------+
| | | |
+-------+ +-------+
column column
The project's main configuration values can be set using environment variables
If you are using the included development server, you can set those variables in the .env
file (use the included .env.sample
as an example)
npm i
npm run dev
Vector layers are generated with one of the two workflows:
All can be generated by running:
./gis/getVectorMaps.sh
All dependencies should be installed by npm install, except ogr2ogr (used for shapefile conversion), which you have to install globally with GDAL.
Generate municipalities by state TopoJSON files (only for Brazil for now) by running:
./gis/vector_maps/get_brazil_municip_states.js
cp cp ./gis/cartodb/cartodb-config.sample.json ./gis/cartodb/cartodb-config.json
cartodb-config.json
./gis/getContextMaps.sh
This will use the layers configuration stored in ./gis/cartodb/templates.json
Run npm run build
, it will create a production-ready version of the project in /dist
.
Depending on the environment where you want to deploy, you need to have a .env.staging
or a .env.production
file set up.
Then run
npm run deploy:staging
or
npm run deploy:production
This will build using appropriate env file and upload to server usinc scp.