TOKI Take Home Full Stack Challenge
Required
- you should have received a
.envfile- it contains a variable w/ the URL for the
Cloud Function
- it contains a variable w/ the URL for the
- you should have received a file
toki-challenge-service-account.json- this is service account for the used
Google Cloud Function
- this is service account for the used
Optional
- you have
Dockeranddocker-composeinstalled
- backend consists of a Google
Cloud Function- in order to keep service accounts a secret
- TOKI's account for accessing their data is stored in
Google Secret Manager- if the backend is run locally, the function makes a request to the
Secret Manager - if run in production environment, the account secret is mounted as volume
- it is then read in directly by as if it is a file
- if the backend is run locally, the function makes a request to the
- TOKI's account for accessing their data is stored in
- there is a
Cloud Triggeronpushevent to themainbranch- automated CI/CD Pipeline is started
- using
Cloud BuildandCloud Run
- using
- automated CI/CD Pipeline is started
- in order to keep service accounts a secret
- frontend is written in
ReactJSin order to respect TOKI's tech stack- chart is using
recharts- the period of data in the charts can be adjusted via the UI w/ a
brush
- the period of data in the charts can be adjusted via the UI w/ a
- the client can view Monthly, Daily or Hourly data
- w/ prices of the electrcity
- or usage by the facilities he/she owns
- the client can choose which facilities to be displayed
- Monthly data shows aggregated and averaged Monthly data
- Daily data shows aggregated and averaged Daily data
- Hourly data shows raw data which is in Hours
- the client can see Suggestions on how to reduce costs
- this is based on an algorithm which finds from when until when electricity price is in a "peak"
- this is called a
PricesIncreasedCycle
- this is called a
- this is based on an algorithm which finds from when until when electricity price is in a "peak"
- chart is using
/app- ReactJS SPA Application (frontend)/common- shared between frontend and backend datatypes/functions- Google Cloud Functions (backend)
- clone the project
git clone https://github.com/vikrusev/toki-challenge.git
- go to the root directory of the project
cd toki-challenge
- copy
toki-challenge-service-account.jsonin./functions - add an
./app/.envfile w/ variable (or copy the .env.example)- REACT_APP_CLOUD_FUNCTION_URL=
- run Docker containers w/ the default
docker-compose.ymlconfig filedocker-compose up -d
ReactJS App should be available at localhost:3000
- go to the
appdirectory of the projectcd ./toki-challenge/app
- install required
npmpackagesnpm ci
- run the fronend
npm start
ReactJS App should be available at localhost:3000
- go to the
functionsdirectory of the projectcd ./toki-challenge/functions
- install required
npmpackagesnpm ci
- run the backend
npm run watch
- visit
localhost:3000in your browser- choose Time Basis
- different
react-datepickercalendars will be shown - choose the desired date
- different
- select some of the available Metering Point Ids
- click the Send Request button
- wait a moment for the data to load :)
- a
rechartschart should be shown- the blue line is the price of Electricity thourghout the time period
- differently colored bars are the Metering Points
- there is a recharts
brushbeneath the chart- it is used to interactively change the time period to be seen
- choose Time Basis
- more
Unit Tests