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.

This is the template I use to start new full-stack projects.
- The inclusion of specific AI rules files transforms the repository from a static boilerplate into a machine-readable set of instructions for agents like Cursor.
- Next.js Server Actions and Drizzle ORM flatten the traditional API architecture, dramatically reducing the token context required for an LLM to understand and mutate data.
- A clever session storage pattern preserves user purchase intent across authentication boundaries, solving a major SaaS conversion drop-off point out of the box.
- The template enforces a strict 'Hard Gate' by syncing Stripe webhooks directly to a local PostgreSQL database, establishing the application's own tables as the ultimate source of truth.
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.
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.
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.
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.