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.
- How is this different from X?
- ✨ Features
- 📦 Installation & Setup
- 🌱 Some community projects built with Stack
- 🏗️ Development & Contribution
- ❤️ Contributors
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
.
Refer to our documentation on how to set up Stack Auth in your Next.js project.
Have your own? Happy to feature it if you create a PR or message us on Discord.
- Stack Example by career-tokens
- Stack Demo by the Stack team
- Stack E-Commerce Example by the Stack team
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.
- Node v20
- pnpm v9
- Docker
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
If you make changes to the Prisma schema, you need to run the following command to create a migration:
pnpm run prisma migrate dev
Thanks to the amazing community who built Stack: