TOKI Take Home Full Stack Challenge
Required
- you should have received a
.env
file- 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
Docker
anddocker-compose
installed
- 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 Trigger
onpush
event to themain
branch- automated CI/CD Pipeline is started
- using
Cloud Build
andCloud Run
- using
- automated CI/CD Pipeline is started
- in order to keep service accounts a secret
- frontend is written in
ReactJS
in 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.json
in./functions
- add an
./app/.env
file w/ variable (or copy the .env.example)- REACT_APP_CLOUD_FUNCTION_URL=
- run Docker containers w/ the default
docker-compose.yml
config filedocker-compose up -d
ReactJS App should be available at localhost:3000
- go to the
app
directory of the projectcd ./toki-challenge/app
- install required
npm
packagesnpm ci
- run the fronend
npm start
ReactJS App should be available at localhost:3000
- go to the
functions
directory of the projectcd ./toki-challenge/functions
- install required
npm
packagesnpm ci
- run the backend
npm run watch
- visit
localhost:3000
in your browser- choose Time Basis
- different
react-datepicker
calendars 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
recharts
chart 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
brush
beneath the chart- it is used to interactively change the time period to be seen
- choose Time Basis
- more
Unit Tests