Skip to content
GatoJS
Early release · kit v0.56.0 · Apache-2.0What’s new →

The boring half of your next business app, already written.

GatoJS is an open-source Next.js kit for multi-tenant business apps. Sign-in, invitations, organizations, roles and an admin panel land in your repository as plain code, not as a package from npm. You read it, change it and ship it.

Quick start

Requires Node.js 22.12+ (or 24) and Docker. Pre-1.0: expect breaking changes.

~/projects

npx create-gato-app@latest acme-crm

modules, languages, storage and admin chosen

secrets generated, PostgreSQL and mailpit started

migrated, admin created, first commit

cd acme-crm && npm run dev

ready on http://localhost:3000

Quick start

You need Node.js 22.12+ (or 24) and Docker. Two commands take you from nothing to a running app at localhost:3000.

Prefer to run some steps yourself?

--yes
Accept the defaults.
--skip-docker
Leave starting Docker to you.
--skip-install
Leave installing dependencies to you.

The wizard prints what is left to do.

This is an early 0.x release: breaking changes can land before 1.0.

  1. 1

    Create the project

    $ npx create-gato-app@latest acme-crm

    The wizard asks for modules, languages, file storage and the first admin. It checks your Node version, generates the secrets in .env, gives the project its own Docker Compose name, moves busy Docker service ports to free ones, starts PostgreSQL and mailpit, runs the first migration, creates the first admin and makes the first commit.

  2. 2

    Run it

    $ cd acme-crm && npm run dev

    The app runs at http://localhost:3000, or the address the dev server prints when that port is busy (set it in APP_URL too). Sign in with the admin you just created.

Inside a project

npx gato add <module>
Add a module to the project.
npx gato remove <module>
Remove a module from the project.
npx gato generate
Regenerate the module registry.
npx gato update
Pull in a newer GatoJS release, keeping your local changes.
npx gato doctor --files
List GatoJS files changed or deleted without an eject; verify fails on them.
npx gato eject <file> --reason "<why>"
Take ownership of a GatoJS file; updates merge into your version.

Core module 0.38.0

Everything before your first real feature.

Every business app starts with the same weeks of work: accounts, teams, permissions, invitations, emails, an admin panel, deployment. It’s never the part the client pays for, and it’s where a mistake costs the most. In GatoJS that part is already written and tested.

  • Sign-in and invitations

    Email and password, password reset and invitations, built on better-auth. Public sign-up stays off until you turn it on.

  • Organizations

    One flag switches between an app for a single company and a multi-tenant SaaS with an organization switcher. The data model stays the same.

  • Organization isolation

    Every record belongs to an organization. Queries go through the organization context, a runtime guard rejects a query on organization data without an organization filter, and an isolation test on a real database proves that one organization never sees another’s data.

  • Roles the server enforces

    User, admin and superadmin across the app; owner, admin and member inside an organization. The menu and the page guard use the same access check, and every server action checks permissions itself.

  • Safe support access

    Your team gets superadmin accounts that client admins can’t touch. Sign in as a user to reproduce a bug; in a client’s organization, every change to their data asks for confirmation first.

  • Two languages from day one

    English and Polish through next-intl, with each feature’s translations next to its code.

  • Email that works locally

    SMTP or Resend in production, mailpit on your machine, so invitations and resets are testable without a real inbox.

  • Production basics

    Environment checked at startup, OpenTelemetry logs, security headers, a health check endpoint, a Dockerfile and a workflow that publishes it for amd64 and arm64, a Docker Compose stack for your own server, a Helm chart for Kubernetes and a Railway config. Fonts are served from the app, not from Google Fonts.

  • Tests

    Vitest for units, Playwright end to end, integration tests on real PostgreSQL, and Stryker mutation testing. A surviving mutant in a security-critical file blocks the change.

Copied into your repo, not installed from npm.

A SaaS boilerplate gives you code once and leaves you alone with it. A framework package keeps the code in node_modules, where changing how something works means config flags, overrides or a fork. GatoJS puts the code in your repository and keeps a way to pull in fixes.

  1. Create

    $ npx create-gato-app@latest acme-crm

    A small CLI copies the core and the modules you choose into a fresh repository of yours.

  2. Add what you need

    $ npx gato add uploads

    A module only adds files. It never edits core code: the core learns about it through a generated registry.

  3. Change anything

    $ npx gato eject src/app/layout.tsx --reason "our own shell"

    It’s plain Next.js, Prisma and TypeScript, next to your own code. To change a GatoJS file, eject it with a reason and it’s yours. A fix that would help everyone goes back to GatoJS as a pull request.

  4. Pull in fixes

    $ npx gato update

    A newer GatoJS release arrives when you choose, and gato update keeps your local changes. It refuses to write through symlinks or outside the project.

Every file has an owner.

Pick an owner to see which files it covers and what gato update does to them.

acme-crm/
  • src/
  • app/layout.tsxejected · “our own shell”
  • shared/lib/modules/gato-config.ts
  • gato.config.ts
  • theme.cssseed
  • … your own code
  • AGENTS.md
  • CLAUDE.md
  • AGENTS.project.md
  • README.mdseed

Configure without forking.

Turn a module off, reorder or hide menu items and change which roles can open a module in one project file,src/gato.config.ts. After you first create the file, run gato generate once so the module registry picks it up; later edits need no extra step. A typo in a module key or menu item fails the build instead of being ignored.

Project configuration

src/gato.config.ts
import { defineGatoConfig } from "@/shared/lib/modules/gato-config";

export default defineGatoConfig({
  modules: {
    "api-keys": { enabled: false },
    dashboard: { nav: { "dashboard.home": { order: 5 } } },
    users: { access: { roles: ["owner"] } },
  },
});
A framework package compared with GatoJS
A framework packageGatoJS
Changing how something worksConfig options, overrides, or a forksrc/gato.config.ts and extension points; eject and edit for the rest
Reading the sourceSomewhere in node_modulesIn your editor, next to your code
What breaks your appAn upgrade you didn’t writeA change you made and can see in git
Getting upstream fixesnpm updateYou pull them in deliberately with gato update

Extension points

Change how it behaves without editing its files.

Your modules plug into GatoJS through named keys, so gato update keeps replacing GatoJS files without touching your changes. Ejecting a file stays the last resort.

  • Events

    subscribers.ts

    React after a core operation: a member removed, an invitation accepted, an API key revoked. Subscribers run once the operation succeeded, and a failing one is logged without undoing it.

    Events guide in the documentation
  • Command hooks

    command-hooks.ts

    Core commands run through defineCommand and runCommand. A before hook can stop one with a message for the user or change its input, but never the organization it runs in.

    Command hooks guide in the documentation
  • UI slots

    slots.ts

    Add your own sections to the dashboard, the account page and the app header, or columns and row actions to the users table. A contribution that fails hides itself, not the page.

    UI slots guide in the documentation
  • Component overrides

    components.ts

    Replace a core component or wrap it to change its props. If your version throws, the core component renders instead.

    Component overrides guide in the documentation
  • Permissions

    can(context, key)

    Check a named permission instead of comparing roles in code, and change which roles hold it in the project config.

    Permissions guide in the documentation
  • Organization setup

    setup.ts

    Create starting data in every new organization. A script catches up the organizations that already exist.

    Organization setup guide in the documentation

Every key is in one catalog.

gato generate writes EXTENSION_POINTS.md into your project: every module, menu item, slot, component, event, command and permission you can hook into, each labelled stable or experimental. A stable key changes only in a release that names the old and the new key. A wrong key fails the type check and the build.

src/gato.config.ts also reorders or removes slot contributions, picks between two overrides of one component, changes who holds a permission and sets your logo.

AI agents get the gato-extend skill: before an agent edits a GatoJS file, it looks up the extension point that fits. When none does, it ejects the file with a reason and drafts an issue asking for a new point.

src/features/invoices/command-hooks.ts
import { defineCommandHooks } from "@/shared/lib/commands/define-command";
import { prisma } from "@/shared/lib/prisma";
import { DomainError } from "@/shared/utils/error-handling";

export const commandHooks = defineCommandHooks({
  "uploads.delete": {
    id: "invoices.keep-issued-pdf",
    before: async (input, context) => {
      const issued = await prisma.invoice.count({
        where: {
          organizationId: context.organizationId,
          pdfUploadId: input.id as string,
          issuedAt: { not: null },
        },
      });
      if (issued > 0) {
        throw new DomainError("This file belongs to an issued invoice");
      }
    },
  },
});

Modules for the second week.

Add them when a project needs them, remove them when it doesn’t. Each module brings its own screens, translations and tests, and database models where it needs them.

  • Audit log

    v0.3.1

    Who changed what, and when, in each organization: a ready audit log page plus one call to record events from your own code.

    $ npx gato add audit-logs
  • API keys

    v0.5.0

    Organization API keys with scopes, stored as hashes. Your endpoints declare the scopes they need and get the organization from the key.

    $ npx gato add api-keys
  • File uploads

    v0.7.1

    Organization files on local disk or S3-compatible storage (AWS S3, Cloudflare R2, Scaleway, Backblaze B2, MinIO, RustFS), with public and private files.

    $ npx gato add uploads
  • Encryption

    v0.2.0

    Per-organization encryption of sensitive fields (AES-256-GCM, one data key per organization under a master key).

    $ npx gato add encryption
  • Legal pages

    v0.1.0

    Terms of service and privacy policy pages you own, and a cookie consent banner that appears only when you declare optional cookies.

    $ npx gato add legal

Planned

  • Background jobs

    A job queue and scheduled tasks, including retention and cleanup.

  • MCP

    Expose your app to AI assistants over MCP with OAuth, built on better-auth 1.7.

Built for AI coding agents

Agents write the code. A different agent writes the tests.

The kit is built to be worked on with AI coding agents, and to stay correct when they do. The process that built it ships with every project.

  1. 1. You

    Describe the task

    A short spec of what the feature does and which rules it touches.

  2. 2. Test writer

    Writes the tests first

    Expected values come from the spec, never from the code under test.

  3. 3. Implementer

    Writes the code

    A hook locks the test files, so the only way to green is working code.

  4. 4. Test reviewer

    Tries to break the tests

    Mutation testing flips conditions in the new code. A surviving mutant in a critical file blocks the task.

  5. 5. Gate

    npm run verify

    Lint, types, tests and a production build. Nothing ships until it passes.

  • AGENTS.md and CLAUDE.md explain the architecture and the hard rules, such as filtering every query by organization.
  • AGENTS.project.md holds your project’s own instructions. Agents read it first, and GatoJS updates never touch it.
  • A Claude Code hook blocks an agent’s Edit or Write on a GatoJS file that isn’t ejected, and npm run verify catches any other change. The gato-extend skill finds the extension point that fits, and ejects with a reason only when none does.
  • Project skills cover code review, new modules, extending GatoJS and dependency upgrades.
  • Architecture tests keep the instructions honest: every command and path they cite has to exist.

Runs on your own server.

Every project comes with a Docker Compose stack for one machine: the app next to its PostgreSQL database and its files. Fill in one environment file and start it with one command.

$ cp .env.selfhost.example .env.selfhost
$ docker compose -f docker-compose.selfhost.yml --env-file .env.selfhost up -d --build --wait
docker-compose.selfhost.yml
Your proxy: Caddy or nginx, TLS
app
The Next.js server with a health check. Files stay in a local volume by default.
  • migrate

    Applies your committed migrations on every start, before the app comes up.

  • db

    PostgreSQL 16 in its own volume, with no published port.

  • toolsoptional profile

    One-off commands, such as creating the first admin.

  • miniooptional profile

    A self-hosted S3 store and its bucket, for the uploads module. Or point uploads at RustFS, R2 or AWS S3.

Mail
Your own SMTP relay or Resend, chosen with MAIL_PROVIDER. Without a mail provider, a production start stops instead of dropping invitations silently.
File storage
A local volume, MinIO in the stack, or any S3-compatible store, with presets for AWS S3, Cloudflare R2, Scaleway, Backblaze B2, MinIO and RustFS. S3_SESSION_TOKEN takes temporary credentials.
Runbook
Install, first admin, TLS behind Caddy or nginx, backup and restore, upgrade. The install, backup and restore steps were run end to end before release.
Published images
A GitHub Actions workflow in every project builds the image natively on amd64 and arm64 and pushes one multi-arch image to ghcr.io/<owner>/<repo>, with SBOM and provenance. Pin a version with APP_IMAGE, pull it and start the stack without --build, which would build the checkout under the pinned name. To roll back, set the previous tag; migrations only go forward, so a rollback across a migration also restores the backup taken before the upgrade.
Kubernetes
A Helm chart in deploy/helm/gatojs runs the same image on a cluster: the app, a Service, an optional Ingress, a volume for uploads and a Job that applies migrations before every install and upgrade. PostgreSQL stays outside the chart.
Nothing calls out
At runtime the app connects only to what you configured: the database, mail, storage and OpenTelemetry. Fonts ship in the repository and telemetry is off in the image. The GatoJS egress check tests it on pull requests that touch the image, the Compose stack, mail, uploads or the lockfile: it runs the stack on a Docker network with no way out, signs in, sends an invitation, uploads and downloads a file, captures every packet and names each container that tried to leave and the host it asked for. A clean run covers the paths it exercised. You can run the same check on your own host.

What’s next

Planned work, in no particular order and without dates.

  • Background jobs and MCPTwo new modules: a job queue with scheduled tasks, and access for AI assistants over MCP.
  • Key managementEncryption keys in a cloud KMS, and key rotation.
  • Terms acceptance at sign-upAn opt-in checkbox for the legal module, once the sign-up form has an extension point.

Questions

What is GatoJS?

GatoJS is an open-source Next.js kit for multi-tenant business applications, built by Web Amigos. Sign-in, invitations, organizations, roles and organization isolation are already written, and the code is copied into your repository instead of being installed from npm.

Is GatoJS free?

Yes. GatoJS is open source under the Apache-2.0 license, and the code is on GitHub.

How is GatoJS different from a Next.js boilerplate?

Like a boilerplate, the code lands in your repository and you can change any file. Unlike a one-off boilerplate, you can add and remove modules with gato add and gato remove, and pull in upstream fixes with gato update. Project settings live in src/gato.config.ts, and a GatoJS file you need to change is ejected with gato eject and a reason, so updates merge into your version instead of overwriting it.

Does GatoJS support multi-tenant SaaS?

Yes. One flag switches between an app for a single company and a multi-tenant SaaS with an organization switcher. Queries go through the organization context, a runtime guard rejects queries on organization data without an organization filter, and isolation tests run on a real PostgreSQL.

Is GatoJS production-ready?

It is a work in progress: an early 0.x release (kit v0.56.0), and breaking changes can land before 1.0. It is also the kit Web Amigos starts its own client projects from.

How do I start a GatoJS project?

You need Node.js 22.12+ (or 24) and Docker. Run npx create-gato-app@latest acme-crm: the wizard asks for modules, languages, file storage and the first admin, then generates the secrets, starts PostgreSQL and mailpit, runs the first migration and makes the first commit. Start the app with cd acme-crm && npm run dev.

Can I self-host a GatoJS app?

Yes. Every project has docker-compose.selfhost.yml with PostgreSQL, a migration step, the app and an optional MinIO for files, plus .env.selfhost.example and a runbook for TLS, backup and restore. Every project publishes a multi-arch image (amd64 and arm64) to the GitHub Container Registry and ships a Helm chart for Kubernetes. At runtime the app calls only the services you configured; an egress check runs the stack on a sealed Docker network, on pull requests that touch the image, the stack, mail, uploads or the lockfile, and reports any container that tries to call out. Mail goes through your own SMTP relay or Resend, files go to a local volume or any S3-compatible store, and fonts are served from the app instead of Google Fonts.

How do I customize GatoJS without losing updates?

Turn modules off, reorder or hide menu items and change access roles in src/gato.config.ts, which is checked when the app builds. After creating the file, run gato generate once so the module registry uses it; later edits need no extra step. To change behaviour, your modules use extension points: subscribers to domain events, before hooks on commands, UI slots, component overrides, permissions and organization setup, all listed in the generated EXTENSION_POINTS.md. Seed files such as src/theme.css and README.md are yours from the start. To change a GatoJS file itself, run gato eject <file> --reason "<why>": gato update then merges upstream changes into your version, and gato doctor --files lists GatoJS files changed without an eject.

What is the GatoJS tech stack?

Next.js 16, React 19, TypeScript, Tailwind CSS 4, shadcn/ui, Prisma 7, PostgreSQL, better-auth, next-intl, Vitest, Playwright, Stryker, OpenTelemetry and Docker.

Can I build a GatoJS app with AI coding agents?

Yes, the workflow ships with every project. A test writer agent writes tests first from the spec, a hook locks those tests while an implementer agent writes the code, a test reviewer runs mutation testing, and npm run verify gates the change. AGENTS.md and CLAUDE.md hold the hard rules.

Built on tools you already know

  • Next.js 16
  • React 19
  • TypeScript
  • Tailwind CSS 4
  • shadcn/ui
  • Prisma 7
  • PostgreSQL
  • better-auth
  • next-intl
  • Vitest
  • Playwright
  • Stryker
  • OpenTelemetry
  • Docker

GatoJS is open source.

The code is public under Apache-2.0. It’s a work in progress before 1.0, so breaking changes can still land.