Skip to content

Get started using Flexpa to connect your digital health app to new Patient Access APIs

Notifications You must be signed in to change notification settings

flexpa/quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flexpa logo Flexpa Quickstart

This repository is a companion to Flexpa's quickstart guide which also provides a detailed explanation of how this code example works. Please use our community discussions for support and issues with this code.

Prerequisites

The quickstart assumes you have NodeJS (v16.14.2+) and npm already installed.

Clone repo

First, clone the quickstart repository:

git clone https://github.com/flexpa/quickstart.git

Set API keys

Second, create an account in our developer portal to get your test mode keys. (When you're ready, you can request live mode access within the developer portal.)

You'll need to add your publishable and secret API keys to the .env files in the client and server directories.

Rename the .env.template file as .env in both directories.

cd quickstart
cp client/.env.template client/.env 
cp server/.env.template server/.env 

Open both client/.env and server/.env and add your test mode API keys.

# client/.env
VITE_FLEXPA_PUBLISHABLE_KEY=
# server/.env
FLEXPA_API_SECRET_KEY=

Run project

The quickstart code includes two components:

  • Frontend client for creating the Flexpa Link connection to a health plan
  • Backend server that swaps a public token for an access token

Run both components simultaneously to test the application. From the root of the project, run the frontend client:

# Navigate into the client directory
cd client

# Set the correct node version
nvm use

# Install the dependencies
npm install

# Run the frontend server
npm run dev

Note: nvm is not supported on Windows. If you are using Windows, ensure you have the correct version of Node installed. See .nvmrc for the recommended version.

Next, from the root of the project in a new terminal, run the backend server:

# Navigate into the server directory
cd server

# Set the correct node version
nvm use

# Install the dependencies
npm install

# Compile the TypeScript to JavaScript code
npm run build

# Run the backend server
npm run dev

Test application

To test the quickstart app:

  1. Open http://localhost:3000 in your browser.
  2. Click the "Connect your health plan with Flexpa Link" to open the Flexpa Link modal.
  3. Select any health plan payer from the list.
  4. When directed to the provider's site, authenticate using a test mode login.
  5. When Flexpa Link indicates success, click "Continue".

Upon successful authentication, you'll be redirected back to localhost. The server script automatically exchanges the public token for an access token, and then the client app performs a FHIR request and reports upon the result. (This may take a moment to complete.)

Use Docker

To use Docker Compose with this project, add your Flexpa publishable and secret keys to compose.yaml:

VITE_FLEXPA_PUBLISHABLE_KEY=
FLEXPA_API_SECRET_KEY=

Then, run the project with:

docker-compose up --build

About

Get started using Flexpa to connect your digital health app to new Patient Access APIs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published