https://github.com/stack-auth/stack Skip to content Navigation Menu Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + GitHub Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions By size + Enterprise + Teams + Startups By industry + Healthcare + Financial services + Manufacturing By use case + CI/CD & Automation + DevOps + DevSecOps * Resources Topics + AI + DevOps + Security + Software Development Explore + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Enterprise + Enterprise platform AI-powered developer platform Available add-ons + Advanced Security Enterprise-grade security features + GitHub Copilot Enterprise-grade AI features + Premium Support Enterprise-grade 24/7 support * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} stack-auth / stack Public * Notifications You must be signed in to change notification settings * Fork 118 * Star 1.2k Open-source Clerk/Auth0 alternative stack-auth.com License View license 1.2k stars 118 forks Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 12 * Pull requests 7 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights stack-auth/stack This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. dev BranchesTags Go to file Code Folders and files Last Last Name Name commit commit message date Latest commit History 772 Commits .changeset .changeset .github .github .vscode .vscode apps apps docs docs eslint-configs eslint-configs examples examples packages packages .gitignore .gitignore CONTRIBUTING.md CONTRIBUTING.md LICENSE LICENSE README.md README.md dependencies.compose.yaml dependencies.compose.yaml package.json package.json pnpm-lock.yaml pnpm-lock.yaml pnpm-workspace.yaml pnpm-workspace.yaml turbo.json turbo.json vercel.json vercel.json vitest.workspace.ts vitest.workspace.ts View all files Repository files navigation * README * License Stack Logo Docs | [?] Hosted Version | Demo | Discord Stack Auth: Open-source Clerk/Auth0 alternative Stack Auth is a managed user authentication solution. It is developer-friendly and fully open-source (licensed under MIT and AGPL). Stack gets you started in just five minutes, after which you'll be ready to use all of its features as you grow your project. Our managed service is completely optional and you can export your user data and self-host, for free, at any time. We support Next.js frontends, along with any backend that can use our REST API. Check out our setup guide to get started. Stack Setup Table of contents * How is this different from X? * Features * Installation & Setup * Some community projects built with Stack + Templates + Examples * [?] Development & Contribution + Requirements + Setup + Database migrations * [?] Contributors How is this different from X? Ask yourself about X: * Is X open-source? * Is X developer-friendly, well-documented, and lets you get started in minutes? * Besides authentication, does X also do authorization and user management (see feature list below)? If you answered "no" to any of these questions, then that's how Stack Auth is different from X. Features and Sign-in Authentication components that support OAuth, password component credentials, and magic links, with shared development keys to make setup faster. All components support dark /light modes. Idiomatic Next.js APIs Dark/light mode We build on server components, React hooks, and route handlers. User dashboard User dashboard Dashboard to filter, analyze, and edit users. Replaces the first internal tool you would have to build. Account settings Account settings Lets users update their profile, verify their e-mail, component or change their password. No setup required. Multi-tenancy & teams Selected team switcher Manage B2B customers with an organization structure component that makes sense and scales to millions. Role-based access control RBAC Define an arbitrary permission graph and assign it to users. Organizations can create org-specific roles. OAuth Connections Beyond login, Stack can also manage access tokens for OAuth tokens third-party APIs, such as Outlook and Google Calendar. It handles refreshing tokens and controlling scope, making access tokens accessible via a single function call. Impersonation Webhooks Impersonate users for debugging and support, logging into their account as if you were them. Webhooks Webhooks Get notified when users use your product, built on Svix. Automatic emails Email Send customizable emails on triggers such as sign-up, templates password reset, and email verification, editable with a WYSIWYG editor. User session & JWT handling User button Stack manages refresh and access tokens, JWTs, and cookies, resulting in the best performance at no implementation cost. M2M authentication M2M authentication Use short-lived access tokens to authenticate your machines to other machines. Installation & Setup Refer to our documentation on how to set up Stack Auth in your Next.js project. Some community projects built with Stack Have your own? Happy to feature it if you create a PR or message us on Discord. Templates * Next SaaSkit by wolfgunblood Examples * Stack Example by career-tokens * Stack Demo by the Stack team * Stack E-Commerce Example by the Stack team [?] Development & Contribution This is for you if you want to contribute to the Stack project or run the Stack dashboard locally. Important: Please read the contribution guidelines carefully and join our Discord if you'd like to help. Requirements * Node v20 * pnpm v9 * Docker Setup Pre-populated .env files for the setup below are available and used by default in .env.development in each of the packages. You should copy all the .env.development files to .env.local in the respective packages for local development. In a terminal, start the dependencies (Postgres and Inbucket) as Docker containers: docker compose -f dependencies.compose.yaml up Then open a new terminal: pnpm install # Run build to build everything once pnpm run build # initialize the database and seed it with some data pnpm prisma db push pnpm prisma db seed # Run code generation (repeat this after eg. changing the Prisma schema). This is part of the build script, but faster pnpm run codegen # Start the dev server pnpm run dev # In a different terminal, run tests in watch mode pnpm run test You can now open the dashboard at http://localhost:8101, API on port 8102, demo on port 8103, docs on port 8104, Inbucket (e-mails) on port 8105, and Prisma Studio on port 8106. Your IDE may show an error on all @stackframe/XYZ imports. To fix this, simply restart the TypeScript language server; for example, in VSCode you can open the command palette (Ctrl+Shift+P) and run Developer: Reload Window or TypeScript: Restart TS server. You can also open Prisma Studio to see the database interface and edit data directly: pnpm run prisma studio Database migrations If you make changes to the Prisma schema, you need to run the following command to create a migration: pnpm run prisma migrate dev [?] Contributors Thanks to the amazing community who built Stack: [6874747073] About Open-source Clerk/Auth0 alternative stack-auth.com Topics react oauth typescript keycloak authentication login nextjs password auth auth0 session-management signin social-login firebase-auth magic-link email-password clerk Resources Readme License View license Activity Custom properties Stars 1.2k stars Watchers 8 watching Forks 118 forks Report repository Releases No releases published Packages 0 No packages published Contributors 13 * @N2D4 * @fomalhautb * @cole-robertson * @mainakkaniam * @career-tokens * @roocell * @hkirat * @chdeskur * @Chenalejandro * @kabir276 * @imran1khan * @Riteshyadavanshi * @fern-bot Languages * TypeScript 98.0% * JavaScript 1.9% * CSS 0.1% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.