19copied

RLS policy template for owner-only tables

alter table your_table enable row level security;
Snippetcursorsupabasesecuritypostgres
shared by mira_dev10 this week
12copied

Keep the Supabase service role key out of the browser bundle

// lib/supabase/admin.ts
import "server-only";
Snippetcursorsupabasesecuritynextjs
shared by mira_dev8 this week
10copied

An updated_at column that is always correct

alter table posts
  add column if not exists updated_at timestamptz not null default now();
Snippetchatgptpostgresdatabase
shared by ines_data7 this week
9copied

Fail the boot when an environment variable is missing

// lib/env.ts
import { z } from "zod";
Snippetwindsurfnextjsdeploymentsecurity
shared by lena_ops7 this week
13copied

Query to find tables without RLS in Supabase

select schemaname, tablename
from pg_tables
Snippetcursorsupabasesecuritydatabase
shared by olu_backend6 this week
11copied

Verify a Supabase token in FastAPI as a dependency

# auth.py
import os
Snippetcursorfastapipythonauth
shared by olu_backend6 this week
8copied

Find the missing index behind a slow list query

-- 1. Find the slow ones (enable the pg_stat_statements extension first)
select calls, round(mean_exec_time::numeric, 1) as avg_ms, query
Snippetcursorpostgresperformancedatabase
shared by olu_backend6 this week
17copied

Stripe webhook handler that verifies the signature correctly (Next.js App Router)

import Stripe from "stripe";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
Snippetlovablestripepaymentsnextjs
shared by priya_ships5 this week
9copied

Server-side proxy for a third-party API key (Next.js route handler)

// app/api/ai/route.ts
import { NextResponse } from "next/server";
Snippetwindsurfsecurityapinextjs
shared by lena_ops4 this week
8copied

Next.js middleware that protects routes and keeps the session fresh

// middleware.ts
import { createServerClient } from "@supabase/ssr";
Snippetcopilotnextjsauthsupabase
shared by sven_fire4 this week
7copied

Rate limit a route handler with Postgres and no extra service

create table if not exists rate_hits (
  key text not null,
Snippetwindsurfapisecuritypostgres
shared by lena_ops4 this week
7copied

Playwright smoke test for magic-link login

// tests/login.spec.ts
import { test, expect } from "@playwright/test";
Snippetclaude-codetestingauthnextjs
shared by dev_ana3 this week
6copied

GitHub Actions job that runs typecheck, lint and tests on every pull request

# .github/workflows/ci.yml
name: ci
Snippetclaude-codetestingnodedeployment
shared by jonas_k3 this week
10copied

Firestore rules: owner-only documents

rules_version = '2';
service cloud.firestore {
Snippetcopilotfirebasesecurity
shared by sven_fire2 this week
5copied

Storage bucket policies so users only reach their own files

insert into storage.buckets (id, name, public)
values ('avatars', 'avatars', false)
Snippetcursorsupabasesecurity
shared by olu_backend2 this week
6copied

ruff config that blocks swallowed exceptions

# pyproject.toml
[tool.ruff.lint]
Snippetcopilotpythontesting
shared by marco_py1 this week
4copied

Cold-start warmer as a Vercel cron

// vercel.json
{ "crons": [{ "path": "/api/warm", "schedule": "*/10 * * * *" }] }
Snippetclaude-codedeploymentperformancevercel
shared by jonas_k1 this week