This server acts as a proxy that intercepts requests to otherwise open FHIR servers and requires those requests to be properly authorized. It also provides a SMART implementation that is loose enough to allow for apps to launch against this server without having to register clients first.
Make sure you have git
and NodeJS
16 or higher, and then run:
git clone https://github.com/smart-on-fhir/smart-launcher-v2
cd smart-launcher-v2
npm i
Although this server is designed to work without any configuration, one might
want to customize a few things. To do so, create a file named .env
in the
root folder of the project. There is a file named example.env
containing some
default settings which you can copy and rename to .env
:
mv example.env .env
Then read the comments above each environment variable and decide what you would like to change.
NOTE: The .env
file is included in .gitignore
and cannot be pushed with git.
If you want to deploy this to remote server, you will have to create another
.env
file on the server, or set those environment variables in some other way.
There are two major ways to start the launcher:
Use when you want to run the launcher normally, either locally or deployed online.
- Set
NODE_ENV = "production"
in your.env
file (unless it is already set in your environment) - Set
PORT
in your.env
file (unless it is already set in your environment) - Make sure
LAUNCHER_PORT
env variable is not set - Run
npm run build
- Run
npm start
Use when you want to modify the source code.
- Set
NODE_ENV = "development"
in your.env
file - Run
npm run start:server:watch
to start the backend - In another terminal run
npm start
to start the frontend - Optionally, in another terminal run
npm npm run test:server:watch
to test changes
- To execute the backend tests run
test:server
- To execute the backend tests continuously run
test:server:watch
- To check the code coverage, after executing the tests open
coverage/lcov-report/index.html
To generate new certificates for your ssl server:
- Make sure you have
openssl
(comes pre-installed on Mac) cd
to the project root- Execute
npm run cert
Then (re)start the server and it will use the new keys.
The launcher is also available as a Docker image. To use that simply run
docker run -t -p 8080:80 smartonfhir/smart-launcher-2:latest
and open http://localhost:8080