Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/supabase-architecture-variants

@0d57af8
Run it yourself

Use when choosing how to integrate Supabase into a specific stack — setting up Next.js SSR auth flows, wiring an SPA or React Native client, configuring mobile deep links, or designing multi-tenant data isolation. Covers where the client runs (browser vs server) and which key it uses (anon respects RLS, service_role bypasses it). Trigger with phrases like "supabase next.js", "supabase SSR", "supabase react native", "supabase SPA", "supabase serverless", "supabase multi-tenant", "supabase server component", "supabase architecture", "supabase service_role server".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/supabase-architecture-variants

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesvariant-a-monolith-(simple).md

≈432 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Variant A: Monolith (Simple)

A single deployment can simplify a small application's operations; a DAU threshold alone does not prove its capacity. Separate browser client reuse from server request identity. A cookie-authenticated server route needs a request-scoped client, not a shared mutable user session or a service-role client with an untrusted user ID.

Code Pattern: Authenticated Read

This framework-independent handler receives a request-scoped user client supplied by the application's cookie adapter. The existing projects table needs an owner_id column and RLS that enforces the same ownership boundary. A query filter alone is not authorization. The caller handles the returned response; no generic supabaseClient.create() API exists.

import type { SupabaseClient } from '@supabase/supabase-js';

export async function listOwnProjects(client: SupabaseClient) {
  const {
    data: { user },
    error: authError,
  } = await client.auth.getUser();
  if (authError || !user) return new Response('Unauthorized', { status: 401 });
  const { data, error } = await client
    .from('projects')
    .select('id, name')
    .eq('owner_id', user.id)
    .limit(50);
  if (error) return new Response('Query failed', { status: 503 });
  return Response.json({ projects: data });
}

Keep migrations, routes, and tests in the same application if appropriate. Cache only public or correctly user/tenant-scoped results, with bounded lifetimes. Treat admin operations as separately authorized server-only workflows.

SSR client setup Row Level Security

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides legitimate architectural guidance for integrating Supabase into various application stacks, including Next.js, SPAs, and mobile applications. It follows security best practices regarding API key management and database security.

  • Socket2mo

    1 alert: gptSecurity

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
What it can do
Reads files Edits files Runs commands
version
1.55.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
compatibility
Designed for Claude Code
All 6 allowed tools
ReadWriteEditBash(supabase:*)Bash(npx:*)Grep
Other metadata
tags
[
  "saas",
  "supabase",
  "architecture",
  "nextjs",
  "ssr",
  "spa",
  "mobile",
  "multi-tenant",
  "serverless"
]

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/supabase-architecture-variants