Skip to main content
The Quickstart covers the happy path. This page covers everything around it: what you need installed, the different ways to create a project, how to set one up by hand, and what to do when something gets in the way.

Requirements

Create a project

What create does

  1. Validates the project name: the last segment of the directory, 2-50 characters, lowercase letters, digits and hyphens, starting with a letter. The target directory must be empty or not exist.
  2. Copies the core and the chosen modules, replacing placeholders with your project name. The database becomes <slug with underscores> (my-app → my_app).
  3. Writes .wa/kit.json and runs gato generate to build the module registry.
  4. Writes .env from .env.example with a random BETTER_AUTH_SECRET and, if given, ADMIN_EMAIL. The file gets mode 600.
  5. Runs git init, npm install and a first commit (chore: initial commit from wa-kit v<version>).
  6. With --setup: docker compose up -d --wait, npx prisma migrate dev --name init, and npm run admin:create -- --email <email> when an admin email is known.
  7. Prints the next steps that are still left to do.
The interactive prompts and some CLI messages are currently in Polish. The questions are, in order: modules (Moduły), languages (Języki), display name (Nazwa wyświetlana), admin email (Email admina (puste = pomiń), empty to skip) and whether to run the database setup now ([t/N], where t means yes).

Manual setup

Run these in the project root, in this order, if you created the project without --setup, or if setup stopped half way. The database must be running before the migration, and the migration must exist before you create the first account.
1

Install dependencies

Skip this if create already ran npm install.
postinstall runs prisma generate, which writes the Prisma client to src/generated/prisma (git-ignored). prepare installs the git hooks (husky).
2

Check .env

create already wrote .env. If you are working in a fresh clone of the kit itself, create it:
The defaults are fine for local work. See Environment file for what you might change.
3

Check the ports

No output means all ports are free. Do not rely on Docker to complain: on macOS a container can start even when a local PostgreSQL listens on localhost:5432, and your connections then reach the local server, not the container. If a port is taken, change it first.
4

Start PostgreSQL and mailpit

--wait returns once the services are healthy. Without it, repeat docker compose ps until db shows (healthy).
5

Create the database schema

The kit does not ship migrations: every project creates its own first migration from the schema in prisma/schema/. Commit the generated prisma/migrations/ folder. See Database and migrations.
If Prisma prints Drift detected or suggests prisma migrate reset on a fresh project, DATABASE_URL points at a database with a different history, usually a local PostgreSQL or another project’s container on the same port. Do not reset until you are sure it is your container. See “Prisma or admin:create cannot reach the database” under Troubleshooting.
6

Create the first account

The -- separator is required, otherwise npm swallows --email. The generated password is printed once. See First admin account.
7

Start the app

Open http://localhost:3000/en/sign-in and sign in.

Docker services

docker-compose.yml defines two services. Use their names in commands such as docker compose logs db. PostgreSQL data lives in volumes/postgres/ (git-ignored), so it survives docker compose down. The file ends with a wa:services region where modules add their own services; the uploads module adds MinIO there behind the s3 Compose profile. Do not edit that region by hand; see Module registry.

Environment file

.env is git-ignored. It is read by Next.js (dev, build, start), by Prisma, admin:create and Vitest through dotenv (.env.local first, then .env; shell variables win over both), and by Docker Compose for the port variables. You do not need to change anything for local work. Typical edits: The full list is in Environment variables. The Next.js server validates the environment at startup. With a bad .env, npm run dev prints a report of every problem and exits. Validation results are cached for the life of the process, so restart npm run dev after editing .env. npm run build does not validate the environment.

Runtime modes

Three flags change how the app behaves. Each takes true or false; missing or empty means false. Any other value (1, yes) fails validation. Restart the server after changing a flag. What changes in the UI for each combination of MULTI_ORG and AUTH_PUBLIC_SIGNUP: A few things hold in every mode:
  • Global admin and superadmin accounts have an Invite user button on the Users page. It creates an account in the active organization and emails a link to set a password.
  • The sign-in page never links to sign-up. Users reach /sign-up by typing it or from an invitation page.
  • Signing up with an invitationId always works and joins the organization from the invitation, with its role.
  • An organization switcher appears whenever an account can access more than one organization.
Roles, the access matrix and server-side enforcement are covered in Auth and roles and Organizations.

First admin account

npm run admin:create creates an account and, on an empty database, the first organization. It needs a running database with the migration applied and a valid .env.
string
The account’s email, stored in lowercase. Required unless ADMIN_EMAIL is set.
string
The password. Without it the script uses ADMIN_PASSWORD; if that is empty or missing, it generates a 20-character password and prints it once.
string
Display name. Defaults to the part of the email before @.
string
Name of the first organization. Defaults to the project’s display name.
string
default:"admin"
Global role: admin or superadmin. superadmin is the support account for the team that builds and maintains the app. See Superadmin and service mode.
boolean
Upgrade an existing account to a higher role without asking.
How it behaves:
  • New account: gets the chosen global role and a verified email, so the first sign-in needs no email.
  • Organization: on an empty database it creates an organization and makes the account its owner. If an organization already exists, it adds the account to the oldest one as owner instead of creating a second.
  • Re-running is safe: it creates nothing new and never changes the password.
  • Existing account with a lower role: the script asks before upgrading ([t/N], t for yes) and stops without consent. It never downgrades a role.
The script cannot recover a password. If you lose it, use Forgot your password? on the sign-in page and read the email in mailpit.

Change ports

Database and mailpit

Each Docker port lives in two places that nothing keeps in sync: Compose reads DB_PORT, while the app and Prisma read only DATABASE_URL. Change both together in .env:
.env
Then run docker compose up -d. Compose recreates the changed services and keeps the data in volumes/postgres/. If the port is held by another GatoJS project’s containers, you can also run docker compose stop in that project instead. E2E and integration tests do not read ports from .env; see Testing.

App port

Set the Next.js port with -p or a shell variable, not in .env (Next.js picks the port before it loads .env):
After any port change, set the same port in APP_URL (for example APP_URL=http://localhost:3001) and restart. better-auth trusts only the origin from APP_URL by default, and email links are built from it. Without -p, when 3000 is busy, next dev silently moves to the next free port. Sign-in then fails with Invalid origin in the terminal until you update APP_URL.

Troubleshooting

Cause: Node older than 22.18.0 (warnings), or npm install with npm 10 instead of the pinned npm 11 (lock file changes).Fix: install the latest Node 22 (nvm install). Revert the lock file with git checkout package-lock.json and use npm ci, or npx -y npm@11.21.1 install when you need to add packages.
Cause: the Prisma client was not generated, usually after installing with --ignore-scripts or deleting src/generated/.Fix: npm run db:generate.
Symptom: port is already allocated (another container) or address already in use (another program).Fix: change the port or stop the other project’s containers.
Cause: prisma.config.ts did not find DATABASE_URL, usually because there is no .env. The dotenv line shows injected env (0).Fix: create .env from .env.example in the project root.
Symptom: P1001: Can't reach database server, an authentication error, Drift detected, or commands that succeed but changes never reach your container.Cause: the container is not running yet, the port in DATABASE_URL differs from DB_PORT, or another PostgreSQL listens on the same port and receives the connection.Fix:
  1. Compare the ports: grep -E '^(DB_PORT|DATABASE_URL)=' .env. Without DB_PORT the port must be 5432. Shell variables win over .env, so also check echo "$DB_PORT $DATABASE_URL".
  2. Stop your containers (docker compose stop) and re-run the port check. If the database port is still taken, another program holds it: change DB_PORT and DATABASE_URL.
  3. docker compose up -d --wait.
  4. Run the migration and admin:create again, because they may have gone to a different database.
The message means “Invalid environment variables”. It is followed by one line per problem, - <VARIABLE>: <message>. A ✓ Ready line before the report does not mean the server is running.The last two only apply with NODE_ENV=production, which npm start sets. Running a production build locally therefore needs a RESEND_API_KEY (any non-empty value works while SMTP_URL is set) and your own secret.
The first message means “Pass —email or set ADMIN_EMAIL”. The second appears when you forget the -- separator and npm passes the bare address to the script.Fix: npm run admin:create -- --email you@example.com.
The app has no home page. Go to /sign-in (or /en/sign-in); /dashboard without a session redirects to sign-in.
Check the npm run dev terminal. Invalid origin: <origin> means APP_URL has a different port than the server (App port). Otherwise the credentials are wrong or the database is unreachable. A forgotten password can be reset through mailpit.
Cause: SMTP_URL points at another port than MAILPIT_SMTP_PORT, the mail service is down (the terminal shows [MAILER] Failed to send), or SMTP_URL is empty. With an empty SMTP_URL the app falls back to Resend if RESEND_API_KEY is set, and otherwise only logs SMTP_URL and RESEND_API_KEY not set, email not sent.Fix: set SMTP_URL=smtp://localhost:1025 (or your custom port) and check docker compose ps. See Email.