This repository contains both Bridge Svelte library and a demo application showcasing its features.
npm install @bridge/svelte
The Bridge SvelteKit SDK is configured by passing a BridgeConfig
object to the bridgeBootstrap
function in your root +layout.ts
file.
Here's an example:
import { bridgeBootstrap, type BridgeConfig } from '@nebulr-group';
export const load = async ({ url }) => {
const config: BridgeConfig = {
appId: 'your_app_id',
callbackUrl: 'http://localhost:5173/auth/oauth-callback',
defaultRedirectRoute: '/protected',
debug: true,
};
await bridgeBootstrap(url, config);
};
These are the primary options you will need to configure for your application.
appId
(required string
): Your unique application identifier from the Bridge dashboard.callbackUrl
(string
): The URL that Bridge will redirect to after a user successfully authenticates.window.location.origin + '/auth/callback'
defaultRedirectRoute
(string
): The route to redirect users to after a successful login.'/'
debug
(boolean
): Set to true
to enable detailed logging from the Bridge SDK to the console.false
These options are typically only needed for development or advanced use cases. In most production scenarios, you can rely on their default values.
authBaseUrl
(string
): The base URL for the Bridge authentication service.'https://auth.nblocks.cloud'
backendlessBaseUrl
(string
): The base URL for Bridge's backendless services, including feature flags.'https://backendless.nblocks.cloud'
loginRoute
(string
): The route within your application that serves as the login page. The SDK will redirect users here if they attempt to access a protected route without being authenticated.'/login'
teamManagementUrl
(string
): The URL for the Bridge team management portal.'https://backendless.nblocks.cloud'
For authentication examples and implementation details, see:
The library provides:
For feature flag examples and implementation details, see:
The library supports:
The demo application in this repository contains runnable examples of bridge usage patterns found in bridge examples documentation.
To run bridge demo:
# From bridge project root
bun install
bun run dev
The demo showcases:
We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under bridge MIT License - see bridge LICENSE file for details.