Although mixing React and Svelte is unusual, we can do so via svelte-preprocess-react. If you prefer to build your own custom UI, you can also use
@getpara/web-sdk
@alpha directly. Reach out to use for help with custom UI integration.Prerequisites
To use Para, you need an API key. This key authenticates your requests to Para services and is essential for integration.Don’t have an API key yet? Request access to the Developer Portal to create API keys, manage billing, teams, and more.
Installing Dependencies & Peer Dependencies
First, install the Para React SDK and needed peer dependencies, plus React dependencies using your preferred package manager:Setting Up the Svelte Preprocessor and Vite Polyfills
Svelte Preprocessor for React
You must configure your Svelte app to accept React components. For that, install and configuresvelte-preprocess-react
:
svelte.config.js
:
svelte.config.js
Vite Polyfills
Like other React-based setups, you may need Node.js polyfills for features likecrypto
, buffer
, and stream
.
Install vite-plugin-node-polyfills
:
vite.config.js
or vite.config.ts
:
vite.config.ts
Creating a QueryClient Instance
client/queryClient.ts
Setting Up the Para SDK
Now that you’ve installed the necessary dependencies, let’s set up the Para SDK in your Svelte application. This involves creating a client instance and integrating the Para Modal.Creating a Para Client Instance
Much like in React or Vue, you’ll need a Para client instance. Keep it in a dedicated file (e.g.,client/para.ts
):
client/para.ts
If you’re using a legacy API key (one without an environment prefix) you must provide the
Environment
as the first argument to the ParaWeb
constructor. You can retrieve your updated API key from the Para Developer Portal at https://developer.getpara.com/Integrating the Para Modal in Svelte
Withsvelte-preprocess-react
, you can directly use React components in Svelte:
Beta Testing Credentials In the
BETA
Environment, you can use any email ending in @test.getpara.com
(like
dev@test.getpara.com) or US phone numbers (+1) in the format (area code)-555-xxxx
(like (425)-555-1234). Any OTP
code will work for verification with these test credentials. These credentials are for beta testing only. You can
delete test users anytime in the beta developer console to free up user slots.Customizing the Para Modal
Just like in React, you can provide any additional props to the<ParaProvider>
component. For example, customizing modal
theming:
ParaModalProps
, refer to the customization guide: