Skip to main content
rule CX Codex

supabase · przeprogramowani — Claude Code rule: what it does, how to install

This rule guides Supabase Auth setup in Astro apps with SSR. It covers middleware, auth endpoints, protected routes, and server-side cookies.

AGPL-3.0 ★ 267 updated 2026-02-20

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/supabase.mdc
Open on GitHub

What supabase does

The rule tells Claude Code how to add Supabase authentication to an Astro application that uses server-side rendering. It covers a server client in src/db/supabase.client.ts, middleware in src/middleware/index.ts, and API endpoints for sign-in, sign-up, and sign-out.

Session checks use the Supabase JWT flow and supabase.auth.getUser(). The authenticated user is placed in Astro.locals, while selected public paths can bypass the guard and other routes can redirect to /auth/login. Cookie handling is limited to getAll and setAll, with server-focused cookie options.

Install @supabase/ssr and @supabase/supabase-js first, then add SUPABASE_URL and SUPABASE_PUBLIC_KEY to .env. Without those packages and environment values, the described integration cannot be assembled.

What it helps with

  • add Supabase sign-up and sign-in to Astro
  • keep SSR auth sessions in middleware
  • guard private Astro routes
  • create login, registration, and logout endpoints
  • expose the signed-in user through Astro.locals

Example prompts for the agent

  • Add Supabase Auth to this Astro app with SSR support.
  • Create middleware that leaves /auth/login and /auth/register public and protects the other routes.
  • Implement the server client with getAll and setAll, then expose the user through Astro.locals.

How to install supabase

Manually: put the files in place

.cursor/rules/supabase.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about supabase

How do I install supabase in Claude Code?

Create the rule file at .claude/rules/supabase.md.

What does the supabase rule do?

It guides Claude Code through Supabase Auth setup for Astro SSR, including the server client, middleware, auth endpoints, and route protection.

What does this rule require for an Astro project?

Install @supabase/ssr and @supabase/supabase-js, then provide SUPABASE_URL and SUPABASE_PUBLIC_KEY in .env.

Similar IDE rules

All IDE rules for Frontend and UI →

supabase by other authors comes first.

supabase sanjeed5 Enforces SQL style conventions, schema design standards, and database security practices for Supabase projects in Cursor. CX Codex +1 ★ 3,589repo stars supabase rerun-build This Claude Code rule sets how the agent accesses a Supabase database. It requires using @src/app/supabase/supabase-helpers.ts instead of querying tables directly. CX Codex +1 ★ 1,120repo stars nextjs-supabase-auth sickn33 The nextjs-supabase-auth skill wires Supabase Auth into the Next.js App Router with clients, middleware, OAuth callbacks, and Server Actions. Use it when you need protected routes and session handling. CX Codex +1 6,600installs nextjs-typescript-tailwindcss-supabase Mindrally nextjs-typescript-tailwindcss-supabase — a skill that steers your agent toward Next.js 14, TypeScript, TailwindCSS and Supabase: server components, error handling, readable code. CX Codex +1 1,400installs supabase-server supabase Tells the agent how to write Edge Functions, Hono apps and webhook handlers on @supabase/server: auth modes, clients, inbound request checks. CX Codex +1 11,200installs supabase-audit-auth-config yoanbernabeu supabase-audit-auth-config audits Supabase GoTrue authentication settings via the public API. It uncovers disabled email confirmations, short passwords, and open CORS origins before production. CX Codex +1 599installs supabase-audit-auth-users yoanbernabeu supabase-audit-auth-users is a Claude Code skill that checks Supabase Auth endpoints for user enumeration through error messages and response timing. CX Codex +1 526installs supabase-skills fcakyon Equips the coding agent with instructions for working with Postgres, Supabase Auth, Edge Functions, JavaScript SDK, and CLI tools. CX Codex ★ 1,216repo stars

From the same set24

The whole set →
shadcn-view-implement The shadcn-view-implement command guides Claude Code through building a shadcn/ui view from an implementation plan. It pauses after a small batch of work so you can review the result. CX Codex +1 ★ 267repo stars shadcn-ui-plan shadcn-ui-plan turns a product requirements doc, API plan and planning session notes into a UI architecture saved to .ai/ui-plan.md. CX Codex +1 ★ 267repo stars mermaid-diagram-ui mermaid-diagram-ui guides the agent to analyze requirements and generate Mermaid UI architecture diagrams for Astro and React auth modules. CX Codex +1 ★ 267repo stars mermaid-diagram-auth The mermaid-diagram-auth rule guides Claude Code through project auth requirements and asks it to create a Mermaid sequence diagram. Use it to map sign-up, login, sessions, and token handling. CX Codex +1 ★ 267repo stars shadcn-view-plan shadcn-view-plan — a Claude Code command that produces a structured implementation plan for a single frontend view and writes it to .ai/{view}-view-implementation-plan.md. CX Codex +1 ★ 267repo stars mermaid-diagram-journey mermaid-diagram-journey guides Claude Code to build a Mermaid state diagram for login and onboarding flows straight from project requirements. CX Codex +1 ★ 267repo stars 10x-research 10x-research spawns parallel sub-agents to investigate your codebase comprehensively. Finds architectural patterns, component connections, and generates a markdown research report with code references. CX Codex +1 ★ 267repo stars 10x-plan 10x-plan guides Claude Code through an iterative codebase investigation to create technical implementation plans. CX Codex +1 ★ 267repo stars

Project sponsors

Companies that keep this analytics open