Stack Auth
GuidesSDKComponentsAPI Reference
Back to home
Platform
OverviewFAQ
Getting Started
SetupUsersProduction
Concepts
API KeysBackend IntegrationCustom User DataEmailsJWT TokensOAuth
OAuth Providers
Orgs and TeamsPermissionsStack AppTeam SelectionWebhooks
Other
Self-hostMCP SetupConvex
Stack Auth Docs

Setup

Welcome to the JavaScript SDK setup guide. If you're looking for guides for other frameworks, check out the React SDK Setup, or the Next.js SDK Setup.

Before getting started, make sure you have a JavaScript project set up (such as Node.js, Vite, or any other JavaScript framework).

We recommend using our setup wizard for a seamless installation experience. The wizard automatically detects your project structure and walks you through the setup process. If you encounter any issues with the wizard, you can follow our manual installation steps instead.

Run installation wizard

Run Stack's installation wizard with the following command:

Terminal
npx @stackframe/init-stack@latest

Update API keys

Then, create an account on the Stack Auth dashboard, create a new project with an API key, and copy its values into the stack/server.ts or stack/client.ts file.

stack/server.ts
import { StackServerApp } from "@stackframe/js";

export const stackServerApp = new StackServerApp({
  // You should store these in environment variables based on your project setup
  projectId: "your-project-id",
  publishableClientKey: "your-publishable-client-key",
  secretServerKey: "your-secret-server-key",
  tokenStore: "memory",
});

Example usage

import { stackServerApp } from "@/stack/server";

const user = await stackServerApp.getUser("user_id");

await user.update({
  displayName: "New Display Name",
});

const team = await stackServerApp.createTeam({
  name: "New Team",
});

await team.addUser(user.id);

Next steps

Check out the Users to learn how to retrieve and update user information, or Example pages to see how to build your sign-in/up pages.

Previous PageFAQ
Next PageUsers

Table of Contents

Navigate this page

On this page

Run installation wizardUpdate API keysInstall npm packageUpdate API keysInitialize the appExample usageNext steps

Stack Auth AI

Documentation assistant

Experimental: AI responses may not always be accurate—please verify important details.

For the most accurate information, please join our Discord or email us.

How can I help?

Ask me about Stack Auth while you browse the docs.