First you have to install NodeJS if you don't already have it from https://nodejs.org/. This app requires Node version 20+. We recommend using the Node Version Manager (nvm).
Then clone the repo, install the dependencies and start it:
git clone https://github.com/smart-on-fhir/bulk-data-server.git
cd bulk-data-server
npm i
Run the following command:
npm start
You should see "Server listening on http://localhost:9443", and can open that URL in your browser to load the server's front end.
The bulk-data server can be accessed by clients like the FHIR Downloader. To connect a client, you will need the server's FHIR endpoint that is displayed in the "FHIR Server URL" field towards the bottom of the page.
The server can also handle authenticated requests using the SMART Backend Services specification. To use it you should have a pair of RS256 private and public keys (the server only require you to input the public key). Alternatively, you can generate the key pair by clicking on the "Generate Keys" button. The other required piece is the "Service URL" which acts as a unique identifier of your client. Once you have the public key and the Service URL, the server will generate a Client ID
for you. You can also download the settings a client will need in JSON format by using the "Download as JSON" button. These settings include:
private_key
- Only included if keys are generated by the serverclient_id
- client_id to send while authorizingfhir_url
- where to send your FHIR requeststoken_url
- where to send your authorization requestsservice_url
- client identifier
Note that changing options may also change some of these settings (the fields that change will flash green).
- Use the Synthea Patient Generator to generate patients.
- Import these patients into the server's database:
npm run import -- -f 4 -d /path/to/my/patients/
Note that -f
is for FHIR version and is required. Use 4
for R4
, 3
for STU3
or 2
for DSTU2
.
You can customize your settings by editing the file config.js
. You can also pass the following environment variables:
NODE_ENV
- Typically this isproduction
,development
ortest
. Defaults toproduction
.PORT
- The port to listen on. Defaults to9444
for running tests and9443
otherwise.BASE_URL
- The base url for the link generation. Defaults tohttp://localhost:${PORT}
.SECRET
- The secret for signing jwt tokens. Defaults to "this-is-our-big-secret". You must set this one.