CLAUDE.md TypeScript Supabase Backend

Supabase — CLAUDE.md

SupabaseのオープンソースFirebase代替。モノレポ構成、Edge Functions、Auth、Storage、Realtimeのガイド。

CLAUDE.md · 56 lines
# Supabase — CLAUDE.md

## Monorepo Structure

This is a Turborepo monorepo. Key packages:

- `apps/www` — Marketing site (Next.js)
- `apps/studio` — Supabase Studio dashboard (Next.js)
- `packages/ui` — Shared UI components
- `packages/shared-data` — Shared TypeScript types/data

## Setup

```bash
npm install
npm run dev  # starts all apps
```

## Edge Functions

- Written in TypeScript/Deno.
- Located in `supabase/functions/`.
- Use `Deno.serve()` as entry point.
- Import from `npm:` or `jsr:` specifiers for dependencies.

## Code Style

- TypeScript strict mode.
- ESLint + Prettier enforced.
- Use named exports, avoid default exports for utilities.
- Keep components small and composable.

## Database

- Migrations in `supabase/migrations/`.
- Always use RLS (Row Level Security) policies.
- Prefer `uuid_generate_v4()` for primary keys.
- Index foreign keys.

## Auth Patterns

- Server-side: use `createServerClient` from `@supabase/ssr`.
- Client-side: use `createBrowserClient`.
- Never expose service_role key on the client.

## Storage

- Bucket names are lowercase, hyphenated.
- Set RLS policies on all buckets.
- Use signed URLs for private assets.

## Testing

- Integration tests use a local Supabase instance.
- Run `supabase start` before tests.
- Seed data in `supabase/seed.sql`.
Share on X

こちらもおすすめ

Backend カテゴリの他のルール

もっとルールを探す

CLAUDE.md、.cursorrules、AGENTS.md、Image Prompts の全 223 ルールをチェック。