Web app for visualizing Covid-19 data generated by mysymptoms.mil.
Ensure the following packages are installed.
- Create a file named
.env
at project root with the following in it. You can change theUSER_EDIPI
value to any 10 digit number greater than 1 to create a new user.
USER_EDIPI=0000000001
- Navigate to the project root and run the following.
npm install
npm run seed-dev
npm run dev
The client uses certificates for login in production rather than a typical login page, which is why we use the
USER_EDIPI
environment variable as a development workaround. To switch users, change the value of USER_EDIPI
in
your .env
file and restart the development server.
When modifying database models, it can be useful to continuously sync the database schema during development. To do
so, add the following to your .env
file:
SYNC_DATABASE=true
This functionality can't be used in production, so you'll still need to remember to write migrations to deploy changes to the schema.
Migrations will automatically be run on app startup, or they can be manually run with npm run migration-run
.
The recommended way to create a new migration is to run npm run migration-generate {name}
, where {name}
is the name of
the migration you want to create. The generate script will automatically run migrations to make sure you're up to date,
then it will generate a new migration for you in /server/migrations
with the necessary changes to match your current
models.
NOTE: There's currently a known bug in TypeORM's migration generator, where it will always add unnecessary alterations
on date columns that use default: () => 'null'
. So make sure you review the generated migration and remove any of
these unnecessary alterations before committing them (and also format the generated file to match our eslint rules).
If you want to write a migration from scratch, you can create a new blank migration with npm run migration-create {name}
,
where {name}
is the name of the migration you want to create. An empty template will be generated in
/server/migrations
.
If your local database schema falls out of sync with migrations and you want to get back to a clean state, you can
run npm run seed-dev
. This will automatically recreate the database, apply the current migrations, and get the app back
into a usable state.
npm test
This project was bootstrapped with create-react-app, and uses rescripts to customize the build configuration.
As the project requirements grow, we may need to eject from create-react-app/rescripts. However, they greatly simplify management of the build configuration, so we should avoid ejecting if possible.