kitwright
Early access · Core in development

Production‑ready Next.js kits for apps you build with AI

Auth, multi-tenant permissions, Stripe billing and audit logs — already secured and tested — plus real business logic for your niche, and the rules Claude Code, Cursor or Codex need to extend it without breaking it.

npx kitwright init my-app
"use server";

import { withAuth } from "@/lib/kitwright/auth";
import { recordAudit } from "@/lib/kitwright/audit";
import { CreateCustomerInput } from "./schema";

// session → active org → permission → Zod input → handler
export const createCustomer = withAuth(
  { permission: "customer:create", input: CreateCustomerInput },
  async ({ session, organizationId, input }) => {
    return db.transaction(async (tx) => {
      const [customer] = await tx
        .insert(customers)
        .values({ ...input, organizationId })
        .returning();

      await recordAudit(tx, {
        organizationId,
        actor: { type: "user", id: session.userId },
        action: "create",
        entity: { type: "customer", id: customer.id },
        after: customer,
      });
      return customer;
    });
  },
);

Built on the stack you already use

  • Next.js 16
  • TypeScript strict
  • PostgreSQL
  • Drizzle ORM
  • Better Auth
  • Stripe
  • Zod
  • Resend
  • Tailwind CSS
  • Vitest
  • Playwright

What's inside

The parts every client app needs, already done

Eight modules written once, tested hard and copied into every kit as plain source. Read them, change them, ship them — there's nothing hidden in a package.

auth guard

lib/kitwright/core

One wrapper for every entry point

Server actions and route handlers authenticate, check the permission and validate input before your code runs. Errors come back typed, never leaked.

actions.ts

export const assignJob = withAuth(
  { permission: "job:assign", input: AssignJobInput },
  async ({ organizationId, input }) => assign(organizationId, input),
);

auth

lib/kitwright/auth

Organizations, roles, invitations

Better Auth with email + password, magic links, optional Google, verified emails and multi-tenant organizations. Roles extend per kit.

permissions.ts

permissions.can("member", "customer:create"); // false
permissions.can("admin,technician", "job:assign"); // true

billing

lib/kitwright/billing

Stripe that stays in sync

Subscriptions, one-time payments and deposits from a typed catalog. The webhook verifies the signature and is idempotent by event id.

billing.ts

const { url } = await billing.createSubscriptionCheckout({
  organizationId, plan: "pro_monthly", customerEmail,
  successUrl, cancelUrl,
});

audit

lib/kitwright/audit

Append-only audit log

Who changed what, when, with before/after values, written in the same transaction. Postgres itself rejects UPDATE and DELETE on the log.

audit_log

UPDATE audit_log SET action = 'oops';
-- ERROR: audit_log is append-only

env

lib/kitwright/core/env

Secrets that can't reach the browser

Environment variables validated with Zod at startup. Secret-looking keys are rejected from the client set, and server values throw in the browser.

env.ts

export const env = createEnv({
  server: { STRIPE_SECRET_KEY: z.string().startsWith("sk_") },
  client: { NEXT_PUBLIC_APP_URL: z.url() },
  runtimeEnv: process.env,
});

reports

lib/kitwright/reports

Reports and safe CSV export

Revenue, usage and cancellations per day, week or month in the tenant's time zone. CSV export escapes formula injection for Excel and Sheets.

reports.ts

await revenue(db, orgId, { from, to, granularity: "month" });
// [{ period: "2026-01-01", currency: "usd", net: 115000 }, …]

email

lib/kitwright/email

Transactional email, swappable

React Email templates for verification, invitations, confirmations and reminders. Resend by default; any provider is one small file.

reminder.tsx

await mailer.send({
  to, subject, react: <ReminderEmail {...props} />,
  idempotencyKey: `reminder:${bookingId}`,
});

observability

lib/kitwright/observability

Structured logs with request IDs

One JSON line per event with the request id, sensitive keys redacted at any depth, and an optional Sentry adapter for errors.

logger.ts

logger.child({ module: "billing" })
  .error("webhook failed", { eventId }, error);

Built for your agent

Rules your coding agent actually follows

Every kit ships with the instructions, skills and commands that keep Claude Code, Cursor or Codex inside the architecture — so the tenth feature is as safe as the first.

CLAUDE.md + AGENTS.md
The non-negotiable rules: auth wrapper, tenant filters, audit log, secrets, webhooks, headers.
.claude/skills
Add a resource, add a permission, add a Stripe product, run the security audit.
.claude/commands
/new-resource, /qa, /ship-check and /setup for a guided first run.
Tests as guardrails
Permission, tenant-isolation and webhook tests fail loudly when a change breaks the rules.
claude — my-app
  1. /new-resource invoice
  2. Reading AGENTS.md — 7 architecture rules
  3. src/db/schema/invoice.tsbusinessColumns() · organizationId
  4. src/app/invoices/actions.tswithAuth · invoice:create
  5. src/permissions.ts+ invoice:read|create|update|delete
  6. recordAudit on create, update, deletesame transaction
  7. src/app/invoices/actions.test.ts6 tests · cross-org denied
  8. pnpm lint && pnpm typecheck && pnpm test
  9. All checks passed
Illustrative session with the /new-resource command that ships in Kitwright Core.

Free · MIT

Free security audit for AI-built Next.js apps

An agent skill plus a zero-dependency scanner for the problems AI-generated apps usually ship with. Works on any Next.js project — Supabase included — not just our kits. MIT licensed.

npx skills add kitwright-ai/skills --skill security-audit

Checks

  • hardcoded-secret
  • env-file-committed
  • public-env-secret
  • client-secret-env
  • route-without-auth
  • action-without-auth
  • query-without-tenant-filter
  • webhook-without-signature
  • public-route-without-rate-limit
  • missing-security-headers
  • supabase-rls-disabled
  • supabase-permissive-policy
terminal

$ node .claude/skills/security-audit/scripts/audit.mjs .

Security audit — insecure-app · 15 files · Next.js · Supabase

HIGH 17MEDIUM 7LOW 0

  • HIGHStripe live secret key in sourcelib/stripe.ts:3
  • HIGHNEXT_PUBLIC_STRIPE_SECRET_KEY exposed to the browser.env.production:1
  • HIGHRoute handler GET, DELETE /api/invoices has no authenticationapp/api/invoices/route.ts:4
  • HIGHQuery on invoices is not filtered by organization or userapp/api/invoices/[id]/route.ts:9
  • HIGHWebhook /api/webhooks/stripe does not verify the signatureapp/api/webhooks/stripe/route.ts:2
  • HIGHTable invoices does not have row level security enabledsupabase/migrations/0001_init.sql:6
  • MEDIUMPublic endpoint /api/auth/login has no rate limitingapp/api/auth/login/route.ts:2

→ security-audit-report.md · each finding with why it matters and how to fix it

More free skills

npx skills add kitwright-ai/skills
  • stripe-audit

    Unsigned or non-idempotent webhooks, access never revoked, prices sent by the client.

  • env-hardening

    Secrets in NEXT_PUBLIC_, server vars in client code, and a Zod-validated env.ts.

  • ship-check

    Production readiness before launch or client handover, with a clear verdict.

  • agent-rules

    An AGENTS.md and CLAUDE.md written from your real stack, commands and structure.

Kits

Start with Core. Add the niche you build for.

Core is the secure base every kit shares. Niche kits add the business logic that takes weeks to get right — booking by zone, dispatch, class passes.

Free · MIT

Free agent skills

Five skills with zero-dependency scanners, installed in any project with one command.

  • security-audit + stripe-audit
  • env-hardening + ship-check
  • agent-rules
In development

Kitwright Core

A multi-tenant Next.js base app with every module wired in, an example resource and the agent rules.

  • Sign-up, orgs, invitations, roles
  • Stripe subscriptions + admin
  • npx kitwright init + one-click deploy
Presale planned

Field Service

For home-service and trades businesses of 3–30 people: plumbing, HVAC, cleaning, repairs.

  • Booking by service zone + deposits
  • Dispatch board
  • Technician PWA
Planned

Studio

For yoga, pilates and dance studios built on the same scheduling engine.

  • Recurring classes + capacity
  • Class passes and memberships
  • Auto-promoting waitlists

One-time purchase. You get the full source in a private GitHub repo — module code copied in, no npm packages to depend on. Commercial license: unlimited projects for you and your clients.

Why a kit

Prompting from scratch vs. starting from a kit

AreaFrom a promptFrom a Kitwright kit
Auth checksIn some routes, missing in othersOne wrapper, enforced on every action and route
Tenant isolationWhatever the model rememberedorganizationId on every query, tested across orgs
Stripe webhooksTrusts the payload, double-processes retriesSignature verified, idempotent by event id
Audit trailNoneAppend-only log, before/after, same transaction
SecretsSometimes behind NEXT_PUBLIC_Validated at startup, blocked from the client
TestsHappy path, if anyPermissions, payments and isolation first
Next featureRe-explain the architecture every timeAGENTS.md, skills and commands already in the repo

FAQ

Questions developers ask

What exactly do I get?

A private GitHub repository with the complete source of the kit: the Next.js app, the security modules copied into src/lib/kitwright, tests, docs and the agent rules. No runtime packages from us — you own every line.

Which coding agents does it work with?

Claude Code, Cursor, Codex and any agent that reads AGENTS.md. Claude Code also gets ready-made skills and slash commands.

Can I use a kit for client projects?

Yes. The commercial license covers unlimited projects of your own and for your clients. The only thing you can't do is resell the kit itself as a kit or template.

Where can I deploy it?

Vercel or anywhere that runs Docker (output: standalone). Any PostgreSQL database works — managed or your own server.

Do I need to know all of this stack?

You need to be comfortable running a Next.js app. The kit's README gets you running in about ten minutes, and the agent rules explain the architecture to your agent so you don't have to.

When can I buy it?

Kitwright Core is in development and the Field Service presale opens once public booking works end to end. Subscribe below and you'll hear first, with launch pricing.

Launch updates

Get launch updates

One email when Kitwright Core ships, plus launch pricing and the Field Service presale. Nothing else.

Double opt-in. We only use your email for these updates. Privacy policy