Integration
This guide provides detailed step-by-step instructions for installing and integrating the SDK Loader into your application. For an overview of the concepts and prerequisites, see the Quick Start.
Installation
Note: Before continuing, make sure you meet the prerequisites and have your authentication token ready.
Configure the NPM registry
The SDK Loader package is hosted in a private NPM repository. Create a file .npmrc in the root of your project with the following configuration:
@facephi:registry=https://facephicorp.jfrog.io/artifactory/api/npm/sdk-web-fphi/
//facephicorp.jfrog.io/artifactory/api/npm/sdk-web-fphi/:_password=[YOUR_TOKEN]
//facephicorp.jfrog.io/artifactory/api/npm/sdk-web-fphi/:username=[YOUR_USERNAME]
//facephicorp.jfrog.io/artifactory/api/npm/sdk-web-fphi/:email=[YOUR_EMAIL]
//facephicorp.jfrog.io/artifactory/api/npm/sdk-web-fphi/:always-auth=trueReplace
[YOUR_TOKEN],[YOUR_USERNAME]and[YOUR_EMAIL]with the credentials provided by Facephi.
Install the package
Install the SDK Loader with your preferred package manager:
npm install @facephi/sdk-loaderNote: Other managers such as Bun or Yarn can also be used.
Integration steps
Manage SDK events
Listen to the events emitted by the SDK:
For more SDK configuration options, see the section SDK Configuration below.
Complete example (React + Vite)
Here is a complete example of a basic integration with React and Vite:
App.tsx:
Development server
Run the development server:
Go to http://localhost:3000/. The application will automatically reload if you modify any of the source files.
Build
Generate the project build for production:
The build artifacts will be saved in the dist/.
Framework integrations
The SDK Loader can be integrated into any modern framework. For framework-specific guides:
Integration with Next.js: Server-side rendering considerations and examples with App Router / Pages Router.
Next steps
Check the SDK Configuration for advanced configuration options
Visit the Facephi SDK programming examples for more implementation examples
Last updated