Dashboard to visualize Covid19 India Data, with User login/Registration.
The Covid Dashboard system has mainly 3 components.
/login
, /home
to interact with system.api-collection
folder of this repository.Setup postgres server with default public schema and database name as coviddb
, we’ll use it to persist api data.
Create below env variables with appropriate values in the system where you want to run covid-data-provider
API
COVID_DB_HOST
: coviddb
hostname or ip addressCOVID_DB_USER
: Database user having admin priviledgeCOVID_DB_PASS
: Password for COVID_DB_USER
JWT_SECRET
: Some unique string which will be used to encrypt user information in JWT. e.g, adfnhjsnvnvnnvfnknsvnkjlnvzjnfvnzsln
you get it anything which an attacker cant guess easily.API_HOST
: Host address of server where our Backend API will be running. We’ll use this address to setup UI-DashboardAfter cloning this repo, follow below steps(basic steps for a maven based project):
cd covid-data-provider
mvn clean package
java -jar target\covid-data-provider-0.0.1-SNAPSHOT.jar
covid-data-provider\src\main\resources\application.yml
which you can tweak to control the setup, viz:
covid19india.timeTravelMinusDays
: number of past days to skip from today, it’s needed as in some cases covid19india API does not get updated regularly. 2
is a good value for this propertycovid19india.pastDataInNumberOfDays
: total number of days we want to pull data from covid19india API. As whole API data polling might take a while as the covid19india API consists data starting from Feb’2020.auth.jwtExpirationMs
: jwt token expiry duration in Milliseconds, from the instant it’s been genearted through /signin
endpointUpdate baseURL
to COVID_DB_HOST
configured in Step 2 from file dashboard\src\_api\covid-internal\internalapi.js
Now you can run UI Dashboard using below commands:
cd dashboard
npm install
npm run start
Visit default url http://localhost:3000
to login/signup a new user.
ADMIN
, as shown in below screenshot. (This need to be refactored for an horizontally scalable deployment, future: implementation should be get the admin key from some auto-updating key configuration server, reason: this feature will fail for horizontal scalling)
/auth/validate
endpoint.(Useful in debugging)http://{API_HOST}:8080/v3/api-docs
User:
- email : String, notnull
- password : char[] , notnull
- username : String , nullable
- roles: String[]
---
Counts:
- confirmed: Long
- deceased: Long
- recovered: Long
- tested: Long
- date: LocalDate
---
State:
- id: Long
- name: String
- counts: Counts[]
- stateCode: String
---
District:
- id: Long
- name: String
- counts: Counts[]
- stateId: Long
JWTToken:
- sub -> username
- iss -> issued Date
- exp -> auth.jwtExpirationMs in app.yaml
letsencrypt
to provide ssl to APIAuthor: pritamprasd
Source Code: https://github.com/pritamprasd/covid-dashboard
#react #reactjs #javascript