Skip to main content
A GatoJS project is a regular Next.js 16 app. Everything the kit gave you sits in your repository as source you can read and change, organized so that each feature lives in one folder and the core learns about features through a generated registry.

Top-level layout

src/app: routes

Routes stay in src/app/ because the App Router requires it. Pages are thin: they call a guard, fetch data through a feature’s query and render the feature’s components. Route groups in parentheses do not appear in the URL, so src/app/[locale]/(app)/users/page.tsx serves /users.

src/features/<x>: a feature folder

A feature is one folder with everything about one piece of functionality except its routes. The core has five: auth, organizations, users, account and dashboard (see Core features). Modules and your own features add more.
Rules that keep features predictable:
  • The folder name is the feature’s identity. It is the translation namespace, and key in module.ts must match it, because menu labels are looked up as <key>.<labelKey>.
  • Business logic stays in services/. Not in components, page.tsx, layouts or route handlers. Prisma is used only in commands, queries and services.
  • Every external input is validated with Zod, with schemas in contracts/.
  • Server actions check their own permissions, validate input, and return OperationResult<T>. See Code patterns.
  • module.ts is data only. The browser bundle imports it through the sidebar, so it must not import server code.
  • Tests sit next to the code in __tests__/ folders.
The generator reads only module.ts, env.ts, auth.ts, auth-client.ts, audit-sink.ts and i18n/<locale>.json. Everything else is ordinary code imported by pages. When you add or remove one of those files, run npx gato generate. See Module registry.

src/shared: cross-cutting code

prisma/: database

The schema is split into several files in prisma/schema/: User and Organization contain a wa:relations region where modules add back-relations. The kit ships no migrations: your project creates its own in prisma/migrations/ and commits them. See Database and migrations.

.wa/: kit state

  • .wa/kit.json records which kit version the project came from, the project name and slug, its locales, every installed kit module with its manifest and file hashes, and your own features under projectModules. The CLI writes it; you edit only locales and projectModules. Reference: kit.json.
  • .wa/bin/wa.mjs is the same CLI as gato, committed as a single bundled file. Run it with npm run wa -- <command>. It lets the project build and regenerate files without installing anything else.

Generated files

These files are written by gato generate and committed. Do not edit them by hand; CI regenerates them and fails on any diff. src/generated/prisma/ is different: Prisma generates it on npm install (or npm run db:generate) and it is git-ignored.

packages/: workspace packages

The project is an npm workspace with two small internal packages:
  • @gatojs/env holds the core environment schema and helpers (httpUrl(), blankAsUndefined() and others) that src/env.ts and feature env.ts files build on.
  • @gatojs/observability wraps OpenTelemetry logging and tracing for src/shared/lib/logger.ts.

Scripts and tooling

Configuration files at the root cover Next.js, Prisma (prisma.config.ts), Vitest, Playwright, Stryker (mutation-gate.json lists security-critical files), ESLint, Prettier, husky, commitlint, Docker and Railway.

Tests

See Testing.

AI agent files

AGENTS.md and CLAUDE.md describe the architecture and hard rules for coding agents. .claude/ holds hooks (one blocks code comments, one locks test files during implementation), the test-writer and test-reviewer agents, and project skills for code review, new modules and dependency upgrades. These files are currently written in Polish. See AI agents.