Flexpa Forward Deployment is our collaborative service where our engineers work directly with your team to implement Flexpa into your application. This guide provides a detailed overview of the integration process, requirements, and best practices to ensure a smooth and successful implementation.
This collaborative approach:
A complete Flexpa integration involves several key components working together to enable patient data access:
These components work together in a flow that starts with patient consent and ends with your application accessing and utilizing their health records.
We recommend a backend-first implementation approach for Flexpa integrations. This strategy prioritizes building the foundational components before adding the user-facing elements:
This approach offers several advantages:
The frontend implementation is typically the most straightforward part of a Flexpa integration, with our Link component handling most of the complexity of user consent flows. By focusing on backend components first, you can ensure that when users begin connecting their health plans, your system is fully prepared to securely process and utilize their data.
A typical Forward Deployment implementation follows these phases:
The timeline can vary based on your specific requirements, architecture complexity, and team availability. Our goal is to minimize the impact on your development team while ensuring a high-quality integration.
The backend portion of your Flexpa integration requires several essential components:
import FlexpaClient from '@flexpa/node-sdk' async function exchangeToken(publicToken) { try { const client = await FlexpaClient.fromExchange( publicToken, process.env.FLEXPA_SECRET_KEY ); const accessToken = client.getAccessToken(); const authorizationId = client.getAuthorizationId(); // Store these securely in your database await storeConsent({ accessToken, authorizationId, userId: 'your-user-id' }); return { success: true }; } catch (error) { console.error('Token exchange failed:', error); return { success: false, error }; } }
The frontend component of your integration primarily involves implementing Flexpa Link to facilitate the user consent flow:
user.externalId
Integrate the Consent SDK via the @flexpa/node-sdk package with OAuth 2.0 PKCE. See the Quickstart for implementation examples.
@flexpa/node-sdk
import FlexpaClient from '@flexpa/node-sdk'; async function startOAuthFlow() { // Generate PKCE parameters const codeVerifier = await FlexpaClient.generateCodeVerifier(); const codeChallenge = await FlexpaClient.generateCodeChallenge(codeVerifier); // Store verifier for callback sessionStorage.setItem('flexpa_code_verifier', codeVerifier); // Build authorization URL and redirect const authUrl = FlexpaClient.buildAuthorizationUrl({ publishableKey: 'pk_test_...', redirectUri: 'https://yourapp.com/callback', codeChallenge, externalId: 'usr_1234', }); window.location.href = authUrl; }
For detailed descriptions of all configuration options, see our Consent SDK documentation.
Before beginning the implementation, several key decisions need to be made about your integration architecture:
You'll need to decide how to store consents and health records:
Relational Databases (PostgreSQL, MySQL):
Document Databases (MongoDB, DynamoDB):
Object Storage (S3):
FHIR Server (Medplum, etc.):
We generally recommend using object storage (like S3) for FHIR resources and a relational database for consent management when initially starting. This approach offers a good balance of performance, cost, and operational simplicity.
Simple needs, existing SQL DB: Use your existing relational DB for consents and S3 for FHIR resources
Complex needs, FHIR queries: Consider a dedicated FHIR server like Medplum
Serverless architecture: DynamoDB for consents, S3 for FHIR resources
Effective schema design is crucial for managing consents and FHIR resources. The schemas below provide a starting point for your implementation. Your actual schema design may vary based on your specific requirements, existing infrastructure, and application needs.
State values might include:
Exchanging
Retrieving
Ready
Errored
Refreshing
If storing FHIR resources in a database rather than object storage:
We don't recommend storing FHIR resources as JSON in a relational database. The complex schema and large size of FHIR resources can lead to performance issues. For relational databases, store the resource as text instead.
Decide how to integrate Flexpa into your application architecture:
Dedicated Flexpa Service or Services:
Integrated Approach:
Hybrid Approach:
Your decision should align with your organization's existing architectural patterns, frameworks, and operational practices.
Being aware of potential challenges can help ensure a smooth integration:
Our Forward Deployment engineers have experience navigating these challenges across many different environments and architectures. We'll work with you to anticipate and address issues before they impact your implementation.
To prepare for a successful Forward Deployment, please consider these questions:
Your Flexpa Forward Deployed Engineer will guide you through these questions in detail before the technical implementation begins.
Based on our experience with numerous successful integrations, we recommend: