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
.cursor/rules/supabase.mdcWhat 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/loginand/auth/registerpublic and protects the other routes. - Implement the server client with
getAllandsetAll, then expose the user throughAstro.locals.
How to install supabase
Manually: put the files in place
.cursor/rules/supabase.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/supabase.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/supabase.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/supabase.mdManually: put the files in place
.clinerules/supabase.mdStep 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.