SEQN Auth JS Quickstart

The SDK is dependency-free ESM and works in modern browsers, Node 20+, Bun, and Deno runtimes that provide fetch.

Fastest path: copy the setup prompt

Open https://auth.seqn.in/, sign in or create the workspace that should own the dashboard, select the stack icon for your app, click Copy setup prompt, and paste it into your coding agent or IDE. The copied prompt starts with secure SEQN Auth onboarding: it opens hosted sign-in/sign-up when needed, may ask for an email only to prefill the hosted page, and keeps password entry inside SEQN Auth. Never paste a SEQN password into an AI chat or terminal prompt. The picker includes Next.js, React/Vite, Express, FastAPI, Django, Flask, Laravel, Rails, and generic REST API prompts.

The Next.js prompt gives the agent the exact App Router setup path for auth and user management:

  1. Use the existing package manager.
  2. Install the SEQN Auth SDK from https://auth.seqn.in/sdk/seqn-auth-js-0.1.0.tgz.
  3. Ask CLI-style questions after hosted sign-in: Project name?, Local app URL?, and Framework detected?.
  4. Create proxy.ts with seqnMiddleware().
  5. Add the provider shell, local /sign-in and /sign-up pages, and user button.
  6. Render SEQN Auth sign-in/sign-up windows inside the app; Google and email/password both use the secure SEQN Auth handoff.
  7. Preserve existing API base URLs, proxy routes, backend ports, and dashboard/data fetching behavior.
  8. Run locally in keyless mode; claim production keys later from the console.

That is the recommended first run. The SEQN account is used to unlock and link the copied prompt; no project key, env var, Google OAuth credential, or custom auth screen is required before localhost works.

For non-JavaScript backend frameworks, the copied prompt wires hosted SEQN Auth redirects and a server-only backend health check. Native user-session middleware for those backends is not part of this quickstart yet, so keep protected API routes behind your app's existing session/authorization until a backend session exchange is enabled.

Keyless first run

For Next.js App Router, the same setup prompt is stored here:

docs/seqn-auth/nextjs-app-router-prompt.md

No project key or env var is required for the first local run. SEQN Auth falls back to keyless dev mode, shared Google OAuth, and a localhost project. Claim/configure the application later from the hosted console tied to the account that copied the prompt.

For manual setup, install the package:

npm install https://auth.seqn.in/sdk/seqn-auth-js-0.1.0.tgz

Then answer the same CLI-style questions when they are not obvious from your repo: Project name?, Local app URL?, and Framework detected?

Using those answers, the agent defaults the local app to http://localhost:3000 when no better local URL is found, adds the local sign-in/sign-up pages, adds account controls, and writes seqn-auth.config.json without secrets. Everything else can be configured later from the dashboard.

One-prompt setup for an IDE or agent

If you already have a project key, create or open a project in the hosted console, then give the agent this endpoint:

https://auth.seqn.in/v1/setup/agent-context?publishable_key=pk_live_your_project_key&framework=nextjs

Use framework=fastapi, django, flask, laravel, rails, or rest for backend/API setup context. The response includes install commands, env names, redirect URLs, JavaScript origins, hosted route URLs, and the shared-development Google OAuth mode. It intentionally does not include secret keys; copy the one-time project secret from the console or rotate it there when a backend needs SEQN_AUTH_SECRET_KEY.

From the SDK:

const setup = await auth.loadAgentSetupContext({ framework: "nextjs" });
console.log(setup.aiAgentPrompt);

Install

Until public npm publishing is enabled:

npm install https://auth.seqn.in/sdk/seqn-auth-js-0.1.0.tgz

Subpath helpers are available without adding runtime dependencies to the core SDK:

import { createSeqnAuthClient, createHostedAuthUrls } from "@seqn/auth-js";
import { createSeqnAuthReact } from "@seqn/auth-js/react";
import { createSeqnAuthNextHelpers } from "@seqn/auth-js/next";
import { createSeqnAuthExpressHelpers } from "@seqn/auth-js/express";

From this repo while the package is unpublished:

cd D:\sil\packages\seqn-auth-js
npm test

Use the core client:

import { createSeqnAuthClient, createHostedAuthUrls } from "./packages/seqn-auth-js/src/index.js";

const auth = createSeqnAuthClient({
  baseUrl: "https://auth.seqn.in",
  publishableKey: "pk_live_your_project_key"
});

const config = await auth.loadPublicConfig();
const hosted = createHostedAuthUrls({
  baseUrl: "https://auth.seqn.in",
  config,
  returnTo: "https://app.example.com/dashboard"
});

console.log(config.application.name);
console.log(hosted.signInUrl);

Verify backend key health

Run the smoke check without deploying anything:

cd D:\sil\packages\seqn-auth-js
$env:SEQN_AUTH_BASE_URL="https://auth.seqn.in"
$env:SEQN_AUTH_PUBLISHABLE_KEY="pk_live_your_project_key"
$env:SEQN_AUTH_SECRET_KEY="sk_live_your_project_secret"
npm run smoke

Equivalent JS:

import { createSeqnAuthClient } from "./packages/seqn-auth-js/src/index.js";

const auth = createSeqnAuthClient({
  baseUrl: "https://auth.seqn.in",
  publishableKey: process.env.SEQN_AUTH_PUBLISHABLE_KEY,
  secretKey: process.env.SEQN_AUTH_SECRET_KEY
});

const publicConfig = await auth.loadPublicConfig();
const backendHealth = await auth.verifyBackendKeyHealth();

console.log({ publicConfig, backendHealth });

Browser usage

<script type="module">
  import { createSeqnAuthClient, createHostedAuthUrls } from "/vendor/seqn-auth-js/index.js";

  const auth = createSeqnAuthClient({
    baseUrl: "https://auth.seqn.in",
    publishableKey: "pk_live_your_project_key"
  });

  const config = await auth.loadPublicConfig();
  const hosted = createHostedAuthUrls({ config, returnTo: window.location.href });
  document.documentElement.dataset.authApplication = config.application.slug;
  document.querySelector("[data-sign-in]").href = hosted.signInUrl;
</script>

Never ship sk_live_ keys to browsers. Use secret keys only from trusted backend or operations environments.

Framework pages