The AI-Native Blueprint: Inside mckays-app-template

How an opinionated Next.js stack uses embedded rules, Server Actions, and strict conventions to turn Cursor and Claude into autonomous product engineers.

7 min read · mckaywrigley/mckays-app-template

A classic printing press operated by a human, while a mechanical spider assembles the intricate gears. This represents the combination of human orchestration and autonomous AI scaffolding.
The modern codebase is no longer just for humans; it is a collaborative workspace shared with synthetic agents.

This is the template I use to start new full-stack projects.

Mckay Wrigley, Creator · Mckay Wrigley (@mckaywrigley) on GitHub
Key Takeaways

The Machine-Readable Repository

The most interesting thing about `mckays-app-template` is not its choice of database or styling framework. It is that the repository is explicitly designed to be read and operated by AI agents. By including `.cursor/rules` and `CLAUDE.md`, McKay Wrigley has built a highly-optimized, low-context environment where LLMs can generate production-grade SaaS features with minimal hallucination.

Editorial portrait of McKay Wrigley

These embedded rules establish guardrails. They dictate UI patterns using shadcn, data fetching via Server Actions, and styling with Tailwind 4.0. This prevents the AI from inventing its own architecture on every prompt.

Flattening the Stack for the Context Window

Traditional React applications split logic across UI components, API routes, and backend controllers. This fragmentation eats up an LLM's token context and confuses the agent. The template relies heavily on Next.js 15 Server Actions and Drizzle ORM to solve this.

A split scene comparing a tangled labyrinth of pipes to a single direct pneumatic tube, illustrating the simplicity of Server Actions over traditional API routes.
Server Actions collapse the distance between client intent and database mutation, making the architecture radically easier for an AI to parse.

Server Actions collapse the logic into a single file. This makes it trivially easy for an AI to write and audit a full database mutation without losing track of the state.

The "Pending Checkout" Memory Trick

A common UX friction point is losing a user's intent after forcing them to sign up. The template solves this with an elegant `sessionStorage` solution in the pricing components.

The CheckoutRedirect pattern ensures unauthenticated users are seamlessly routed to Stripe immediately after creating an account.

When an unauthenticated user clicks 'Buy', the app saves their intent. It forces them through Clerk login and immediately redirects them to Stripe checkout via a Root Layout check. It prevents the classic drop-off of users getting lost in a dashboard after signing up.

The Hard Gate: Trusting the Database

Many templates allow users to browse a dashboard before paying. This template implements a strict subscription check utilizing a Stripe webhook handler. It syncs Stripe state directly into the local PostgreSQL customers table.

This architectural decision ensures the application relies on its own database as the ultimate source of truth. It avoids constantly pinging third-party APIs.

The Return of the Opinionated Monolith

For years, the trend was decoupled microservices. Now, for the solo indie hacker, the high-velocity monolith is back. Removing choices by forcing Supabase, Clerk, and Stripe is a feature. It lets the builder and their AI focus entirely on business logic.