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.
- The folder name is the feature’s identity. It is the translation namespace, and
keyinmodule.tsmust 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.tsis 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.
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.jsonrecords 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 underprojectModules. The CLI writes it; you edit onlylocalesandprojectModules. Reference: kit.json..wa/bin/wa.mjsis the same CLI asgato, committed as a single bundled file. Run it withnpm run wa -- <command>. It lets the project build and regenerate files without installing anything else.
Generated files
These files are written bygato 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/envholds the core environment schema and helpers (httpUrl(),blankAsUndefined()and others) thatsrc/env.tsand featureenv.tsfiles build on.@gatojs/observabilitywraps OpenTelemetry logging and tracing forsrc/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.