Skip to content
thebridgedevPublic

About

The Bridge core client: sign-in flows, sessions and token refresh, feature flags, billing state and the management API for any JavaScript app.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

The Bridge auth core

npm version MIT license

Website · Getting started · Docs · Set up with your AI assistant

The Bridge auth core

@nebulr-group/bridge-auth-core is the framework-agnostic client behind every Bridge SDK: sign-in flows, sessions and token refresh, feature flags, billing state and the management API. Use it directly in any JavaScript app, or reach for the framework package that wraps it.

The Bridge is a hosted backend for SaaS apps. It gives you sign-in (passwords, magic links, passkeys, social login and SSO), multi-tenant workspaces with roles, Stripe subscriptions with plan limits, and feature flags, all managed from one dashboard. Your AI coding assistant can set it up for you through the Bridge MCP server.

Let your AI assistant set it up. Connect the Bridge MCP server to Claude, Cursor, Copilot or Gemini CLI and ask it to add Bridge to your app. Not using MCP? Run npx @nebulr-group/bridge-cli guide add-login in your project: it detects your framework from package.json and prints the steps for your assistant to follow. npx @nebulr-group/bridge-cli doctor checks the result.

Install

npm install @nebulr-group/bridge-auth-core

Sign users in

import { BridgeAuth } from '@nebulr-group/bridge-auth-core';

const bridge = new BridgeAuth({
  appId: 'your-app-id',
  callbackUrl: 'https://your-app.com/auth/oauth-callback',
});

// A "Sign in" button sends the user to the hosted sign-in page
signInButton.addEventListener('click', () => bridge.login());

// On your callback route, exchange the code for tokens
const code = new URLSearchParams(location.search).get('code');
if (code) await bridge.handleCallback(code);

bridge.getCurrentUser();                     // the signed-in user, or null
await bridge.isFeatureEnabled('new-editor'); // feature flags

BridgeAuth also covers in-app sign-in: passwords, magic links, passkeys, SSO, MFA, signup and workspace switching. Tokens are stored in localStorage in the browser and in memory on the server; pass storage to use your own.

Manage your app from code

BridgeManagement uses an API key, so it belongs on your server, in CI or in a script, never in a browser.

import { BridgeManagement } from '@nebulr-group/bridge-auth-core';

const mgmt = new BridgeManagement({ apiKey: process.env.BRIDGE_API_KEY });
const tenants = await mgmt.tenants.list();
const flags = await mgmt.flags.list();

Using a framework?

The framework packages below wrap this core with components, route guards and decorators. Start there if your framework is listed.

Learn more

Other Bridge packages

Package For
@nebulr-group/bridge-svelte SvelteKit
@nebulr-group/bridge-react React
@nebulr-group/bridge-nextjs Next.js
@nebulr-group/bridge-angular Angular
@nebulr-group/bridge-nestjs NestJS
@nebulr-group/bridge-express Express
@nebulr-group/bridge-cli CLI for people and AI agents

License

MIT © Nebulr. Built by The Bridge.

About

The Bridge core client: sign-in flows, sessions and token refresh, feature flags, billing state and the management API for any JavaScript app.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages