Requirements
Create a project
- create-gato-app (recommended)
- gato create from a clone
create-gato-app checks your Node version, picks the highest v<x.y.z> release tag of the kit, downloads that tag as a tarball (no clone, no git history) and runs gato create on it. The new project gets gato-cli as a devDependency, so inside it you run the CLI as npx gato <command>.Flags of create-gato-app itself:gato create unchanged. The useful ones:create-gato-app talks to the GitHub API to find the latest tag. Anonymous requests are limited to 60 per hour. If you hit the limit, set GITHUB_TOKEN (or GH_TOKEN, or log in with the gh CLI), or pass --kit-version.What create does
- 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.
- Copies the core and the chosen modules, replacing placeholders with your project name. The database becomes
<slug with underscores>(my-app→my_app). - Writes
.wa/kit.jsonand runsgato generateto build the module registry. - Writes
.envfrom.env.examplewith a randomBETTER_AUTH_SECRETand, if given,ADMIN_EMAIL. The file gets mode600. - Runs
git init,npm installand a first commit (chore: initial commit from wa-kit v<version>). - With
--setup:docker compose up -d --wait,npx prisma migrate dev --name init, andnpm run admin:create -- --email <email>when an admin email is known. - Prints the next steps that are still left to do.
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.
Install dependencies
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).Check .env
create already wrote .env. If you are working in a fresh clone of the kit itself, create it:Check the ports
localhost:5432, and your connections then reach the local server, not the container. If a port is taken, change it first.Start PostgreSQL and mailpit
--wait returns once the services are healthy. Without it, repeat docker compose ps until db shows (healthy).Create the database schema
prisma/schema/. Commit the generated prisma/migrations/ folder. See Database and migrations.Create the first account
-- separator is required, otherwise npm swallows --email. The generated password is printed once. See First admin account.Start the app
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.
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:
.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 takestrue or false; missing or empty means false. Any other value (1, yes) fails validation. Restart the server after changing a flag.
MULTI_ORG and AUTH_PUBLIC_SIGNUP:
- Global
adminandsuperadminaccounts 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-upby typing it or from an invitation page. - Signing up with an
invitationIdalways works and joins the organization from the invitation, with its role. - An organization switcher appears whenever an account can access more than one organization.
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.
ADMIN_PASSWORD; if that is empty or missing, it generates a 20-character password and prints it once.admin or superadmin. superadmin is the support account for the team that builds and maintains the app. See Superadmin and service mode.- 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 asownerinstead 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],tfor yes) and stops without consent. It never downgrades a role.
Change ports
Database and mailpit
Each Docker port lives in two places that nothing keeps in sync: Compose readsDB_PORT, while the app and Prisma read only DATABASE_URL. Change both together in .env:
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):
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
Install prints EBADENGINE or rewrites package-lock.json
Install prints EBADENGINE or rewrites package-lock.json
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 [email protected] install when you need to add packages.Cannot find module @/generated/prisma/client
Cannot find module @/generated/prisma/client
--ignore-scripts or deleting src/generated/.Fix: npm run db:generate.docker compose up reports a port in use
docker compose up reports a port in use
port is already allocated (another container) or address already in use (another program).Fix: change the port or stop the other project’s containers.Prisma says datasource.url is required
Prisma says datasource.url is required
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.Prisma or admin:create cannot reach the database
Prisma or admin:create cannot reach the database
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:- Compare the ports:
grep -E '^(DB_PORT|DATABASE_URL)=' .env. WithoutDB_PORTthe port must be 5432. Shell variables win over.env, so also checkecho "$DB_PORT $DATABASE_URL". - Stop your containers (
docker compose stop) and re-run the port check. If the database port is still taken, another program holds it: changeDB_PORTandDATABASE_URL. docker compose up -d --wait.- Run the migration and
admin:createagain, because they may have gone to a different database.
The server exits with 'Nieprawidłowe zmienne środowiskowe'
The server exits with 'Nieprawidłowe zmienne środowiskowe'
- <VARIABLE>: <message>. A ✓ Ready line before the report does not mean the server is running.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.admin:create says 'Podaj --email albo ustaw ADMIN_EMAIL' or 'Unexpected argument'
admin:create says 'Podaj --email albo ustaw ADMIN_EMAIL' or 'Unexpected argument'
-- separator and npm passes the bare address to the script.Fix: npm run admin:create -- --email [email protected].The root URL returns 404
The root URL returns 404
/sign-in (or /en/sign-in); /dashboard without a session redirects to sign-in.Sign-in fails although the page loads
Sign-in fails although the page loads
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.Emails do not show up in mailpit
Emails do not show up in mailpit
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.An invitation link fails
An invitation link fails