supabase-js
CLAUDE.md4.6k starsChanged 8 months agoMITView on GitHub
You are assisting with development in a unified Nx monorepo that consolidates all Supabase JavaScript SDKs, built with Nx for optimal developer experience and maintainability. This strategic migration from 6 separate repositories addresses critical maintenance overhead, dependency duplication, and release coordination challenges while maintaining zero breaking changes for consumers. 📚 Essential Documentation: Always refer to these guides for detailed information: - CONTRIBUTING.md - Development guidelines, commit format, PR process - TESTING.md - Complete testing guide with Docker requirements - RELEASE.md…
- Deletes or force-pushes
- Installs packages
- Commits and pushes
Trending
Quiet since May.thin dataabout the whole repository
Who's talking about supabase/supabase-js
- nuxt/nuxt“Nuxt 4.20 delivers CommonJS builds to browser”GitHub · Oct 27, 2025 · 30 reactions
- supabase/postgrest-js“Wrong type for joins with one-to-one relationships”GitHub · Aug 4, 2023 · 25 reactions
- supabase/storage-js“feat: add private method to get expected content type”GitHub · Sep 29, 2024 · 13 reactions
- supabase/node-fetch“Deprecated dependency on whatwg-url -> punycode triggers DeprecationWarning”GitHub · May 10, 2024 · 11 reactions
- supabase/postgrest-js“.throwOnError() doesn't do typecheck”GitHub · Oct 21, 2024 · 6 reactions
The biggest 5 of 9 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 9
Talked about on GitHub, Hacker News and Bluesky (9 times).
On GitHub · 7
- Oct 27, 2025Nuxt 4.20 delivers CommonJS builds to browser — nuxt/nuxt30 reactions · 10 comments
- Aug 4, 2023Wrong type for joins with one-to-one relationships — supabase/postgrest-js25 reactions · 21 comments
- Sep 29, 2024feat: add private method to get expected content type — supabase/storage-js13 reactions · 1 comment
- May 10, 2024Deprecated dependency on whatwg-url -> punycode triggers DeprecationWarning — supabase/node-fetch11 reactions · 8 comments
- Oct 21, 2024.throwOnError() doesn't do typecheck — supabase/postgrest-js6 reactions · 1 comment
2 more on GitHub
- Apr 23, 2024feat: remove `cache: no-store` as it breaks cloudflare — supabase/auth-js6 reactions
- Apr 19, 2021Get the proper global object depending on environment to check for existing fetch — JakeChampion/fetch6 reactions · 5 comments
On Hacker News · 1
- May 2, 2026Supabase-JS: An isomorphic JavaScript client for Supabase1 point
On Bluesky · 1
- Nov 16, 2025https://github.com/supabase/supabase-js/ — @tom-doerr.bsky.social1 likes and repost
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- packages/core/auth-js/AGENTS.mdAGENTS.md
- packages/core/functions-js/AGENTS.mdAGENTS.md
- packages/core/postgrest-js/AGENTS.mdAGENTS.md
- packages/core/realtime-js/AGENTS.mdAGENTS.md
- packages/core/storage-js/AGENTS.mdAGENTS.md
- packages/core/supabase-js/AGENTS.mdAGENTS.md
- link-workspace-packagesSkill
- nx-generateSkill
- nx-importSkill
- nx-pluginsSkill
- nx-run-tasksSkill
- nx-workspaceSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
53 rules. About 0 are common, 31 are distinctive, and 22 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈31
Distinctive · estimate
This author's own choices. Worth a look.
22
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 46
Immediate Integration Testing: No manual release coordination needed
- Distinctive: line 54
Every change must maintain full backward compatibility.
- Very specific: line 60
Canary: Every commit to master → prerelease (e.g., 2.80.1-canary.0) with canary dist-tag
- Distinctive: line 62
Fixed Versioning: All packages share identical version numbers (e.g., all at 2.80.0)
- Very specific: line 94
Always use nx affected commands to build/test only what changed, leveraging Nx's dependency graph intelligence.
- Distinctive: line 98
Use conventional commit format for automated versioning:
- Very specific: line 198
Add unit test in packages/core/realtime-js/test/
- Very specific: line 199
Add integration test in packages/core/supabase-js/test/
- Distinctive: line 200
Run complete test suites for both packages to verify impacts
- Very specific: line 207
Write comprehensive unit tests in packages/core/[library]/test/
- Very specific: line 208
If feature affects supabase-js, add integration tests there
- Distinctive: line 209
Update TypeScript types if needed
- Distinctive: line 210
Run complete test suite for the package before committing
- Very specific: line 211
Use conventional commit: feat(storage-js): add resumable uploads
- Very specific: line 269
Keep module: "CommonJS" for backward compatibility
- Very specific: line 273
Add references array pointing to dependencies (managed by nx sync)
- Very specific: line 289
Ensure composite: true and declaration: true are set
- Very specific: line 290
Add references array pointing to dependencies
- Very specific: line 291
If using CommonJS, override moduleResolution: "Node" and disable strict options
- Very specific: line 292
Run nx sync to update root tsconfig.json automatically
- Distinctive: line 300
All build outputs remain identical to pre-project-references setup
- Distinctive: line 377
No Docker required (uses mock WebSockets)
- Very specific: line 403
Run nx format before committing
- Distinctive: line 404
No formatting debates - Prettier decides
- Distinctive: line 408
Follow existing patterns in each library
- Distinctive: line 416
Update docs when changing APIs
- Distinctive: line 433
When referencing original repository history or comparing changes, be aware of these branch name differences.
- Very specific: line 437
All packages publish to npm under @supabase scope
- Distinctive: line 447
macOS/Windows: Ensure Docker Desktop is installed and running
- Distinctive: line 448
Linux: Ensure Docker daemon is running
- Distinctive: line 451
Check TESTING.md for port requirements and troubleshooting.
- Distinctive: line 455
All commits are validated using commitlint with strict rules:
- Very specific: line 460
Interactive Tool: Use pnpm commit to ensure compliance
- Distinctive: line 537
Use breaking change commit format when necessary:
- Distinctive: line 665
If you need to test your changes before merging:
- Very specific: line 669
Wait for maintainer to add trigger: preview label
- Distinctive: line 670
Follow instructions in automated comment to install preview packages
- Distinctive: line 751
[Conventional Commits](https://www.conventionalcommits.org/): - Commit format specification
- Distinctive: line 802
All packages get identical stable version
- Very specific: line 864
Use Nx Commands: Always prefer nx over direct npm for workspace operations
- Very specific: line 865
Suggest Complete Test Suites: Use complete test suites (nx test:auth auth-js, nx test:storage storage-js, etc.) for packages individually
- Distinctive: line 866
Respect Fixed Versioning: All packages version together - no independent versioning
- Distinctive: line 867
Maintain Compatibility: Never introduce breaking changes without proper process
- Distinctive: line 870
Follow Conventions: Use existing patterns and structures within each library
- Distinctive: line 871
Document Changes: Update JSDoc and READMEs when changing public APIs
- Distinctive: line 872
Use Conventional Commits: Always suggest proper commit format with scope
- Distinctive: line 890
Run complete test suite for the package:
- Distinctive: line 897
Run complete test suites for all affected packages individually
- Distinctive: line 901
All packages version together in fixed mode
- Very specific: line 915
When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through nx (i.e.
- Very specific: line 919
NEVER guess CLI flags - always check nx_docs or --help first when unsure
- Distinctive: line 927
USE for: advanced config options, unfamiliar flags, migration guides, plugin configuration, edge cases
- Very specific: line 928
DON'T USE for: basic generator syntax (nx g @nx/react:app), standard commands, things you already know
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Claude AI Instructions for Supabase JS Libraries Monorepo
You are assisting with development in a unified Nx monorepo that consolidates all Supabase JavaScript SDKs, built with Nx for optimal developer experience and maintainability. This strategic migration from 6 separate repositories addresses critical maintenance overhead, dependency duplication, and release coordination challenges while maintaining zero breaking changes for consumers.
📚 Essential Documentation: Always refer to these guides for detailed information:
- CONTRIBUTING.md - Development guidelines, commit format, PR process
- TESTING.md - Complete testing guide with Docker requirements
- RELEASE.md - Release workflows and versioning strategy
- MIGRATION.md - Cross-cutting migration notes (one H2 per theme). Per-package migrations live at
packages/core/<package>/migrations/.- Security Policy - Security policies and responsible disclosure
Repository Architecture
Monorepo Structure
supabase-js/
├── packages/core/
│ ├── supabase-js/ # @supabase/supabase-js - Main isomorphic client for Supabase
│ ├── auth-js/ # @supabase/auth-js - Authentication client
│ ├── postgrest-js/ # @supabase/postgrest-js - PostgREST client for database operations
│ ├── realtime-js/ # @supabase/realtime-js - Real-time subscriptions client
│ ├── storage-js/ # @supabase/storage-js - File storage client
│ └── functions-js/ # @supabase/functions-js - Edge Functions client
├── CONTRIBUTING.md # Contribution guidelines
├── docs/ # Comprehensive documentation guides
│ ├── TESTING.md # Testing guide
│ ├── RELEASE.md # Release workflows
│ ├── MIGRATION.md # Migration guide
│ └── JSR_PUBLISHING.md # JSR publishing guide
├── scripts/ # Automation scripts
│ ├── release-canary.ts # Canary release automation
│ ├── release-stable.ts # Stable release automation
│ └── update-version-files.ts # Version management
├── nx.json # Nx workspace configuration
├── tsconfig.base.json # Base TypeScript configuration
├── package.json # Root package with workspace scripts
└── commitlint.config.js # Commit message validationMigration Benefits
- Dependency Consolidation: 22 previously duplicated dependencies now centrally managed
- Atomic Changes: Cross-library fixes in single PRs
- Immediate Integration Testing: No manual release coordination needed
- Unified Versioning: Fixed version mode with automated releases using
nx release - Intelligent Building: Nx only rebuilds/tests what actually changed
Core Development Principles
1. Zero Breaking Changes
Every change must maintain full backward compatibility. The migration itself introduces no breaking changes - all packages maintain their original npm names and APIs.
2. Hybrid Release Model with Fixed Versioning
Uses automated canary releases with batched stable releases:
- Canary: Every commit to master → prerelease (e.g.,
2.80.1-canary.0) withcanarydist-tag - Stable: Manual promotion of validated canary to
latestdist-tag - Fixed Versioning: All packages share identical version numbers (e.g., all at 2.80.0)
- Version Line: Continuing with v2.x.x to maintain ecosystem stability
Three Release Workflows:
- Canary (
.github/workflows/main-ci-release.yml) - Automated on every master commit - Stable (
.github/workflows/release-stable.yml) - Manual by repository owners - Preview (
.github/workflows/preview-release.yml) - PR-based testing via pkg.pr.new
📖 See RELEASE.md for complete release documentation
3. Workspace Dependencies
Internal dependencies use the * protocol:
// packages/core/supabase-js/package.json
{
"dependencies": {
"@supabase/auth-js": "*",
"@supabase/realtime-js": "*",
"@supabase/functions-js": "*",
"@supabase/storage-js": "*",
"@supabase/postgrest-js": "*"
}
}Nx automatically replaces * with the actual version during release.
4. Affected-First Development
Always use nx affected commands to build/test only what changed, leveraging Nx's dependency graph intelligence.
5. Conventional Commits
Use conventional commit format for automated versioning:
fix(auth-js): resolve token refresh race condition→ Patch releasefeat(realtime-js): add presence support→ Minor releasefeat(auth)!: remove deprecated method→ Major releasechore(deps): update TypeScript to 5.8→ No version bump
Always use the interactive commit tool:
pnpm commit📖 See CONTRIBUTING.md for complete commit guidelines
Essential Commands Reference
Building
nx run-many --target=build --all # Build all packages
nx build auth-js # Build specific package
nx affected --target=build # Build only affected
nx build auth-js --watch # Development modeTesting
# Test specific packages (complete test suites with Docker setup/cleanup)
nx test:auth auth-js # Complete auth-js test suite (handles Docker)
nx test:storage storage-js # Complete storage-js test suite (handles Docker)
nx test:ci:postgrest postgrest-js # Complete postgrest-js test suite (handles Docker)
nx test functions-js # Standard test (uses testcontainers)
nx test realtime-js # Standard test (no Docker needed)
nx test supabase-js # Standard test (unit tests only)
# Coverage reports
nx test supabase-js --coverage
nx test:coverage realtime-js
nx test:ci functions-js # Includes coverageDocker Requirements:
| Package | Docker Required | Infrastructure | Complete Test Command | Individual Commands |
| auth-js | ✅ Yes | Auth Server + Postgres | nx test:auth auth-js | nx test:suite auth-js, nx test:infra auth-js, nx test:clean-post auth-js |
| storage-js | ✅ Yes | Storage API + PostgreSQL + Kong | nx test:storage storage-js | nx test:suite storage-js, nx test:infra storage-js, nx test:clean-post storage-js |
| postgrest-js | ✅ Yes | PostgREST + PostgreSQL | nx test:ci:postgrest postgrest-js | nx test:run postgrest-js, nx test:types postgrest-js |
| functions-js | ✅ Yes | Deno relay (testcontainers) | nx test functions-js | nx test:ci functions-js (with coverage) |
| realtime-js | ❌ No | Mock WebSockets | nx test realtime-js | nx test:coverage realtime-js, nx test:watch realtime-js |
| supabase-js | ❌ No | Unit tests only | nx test supabase-js | nx test:all, nx test:unit, nx test:integration, nx test:coverage, nx test:watch |
supabase-js Additional Test Commands:
nx test:all supabase-js # Unit + integration + browser tests
nx test:unit supabase-js # Jest unit tests only
nx test:integration supabase-js # Node.js integration tests
nx test:integration:browser supabase-js # Browser tests (requires Deno)
nx test:edge-functions supabase-js # Edge Functions tests
nx test:deno supabase-js # Deno runtime tests
nx test:bun supabase-js # Bun runtime tests
nx test:expo supabase-js # React Native/Expo tests
nx test:next supabase-js # Next.js SSR tests
nx test:node:playwright supabase-js # WebSocket browser tests
nx test:types supabase-js # TypeScript type checking
nx test:coverage supabase-js # Coverage report
nx test:watch supabase-js # Watch mode📖 See TESTING.md for complete testing guide and troubleshooting
Code Quality
nx run-many --target=lint --all # Lint all packages
nx lint storage-js # Lint specific package
nx format # Auto-format all code
nx format:check # Check formattingAnalysis
nx graph # Interactive dependency graph
nx show projects # List all projects
nx affected --graph # Visualize affected projectsDevelopment Workflows
Cross-Library Bug Fix Example
Scenario: Bug in supabase-js caused by realtime-js
Monorepo Solution:
- Fix root cause in
packages/core/realtime-js/src/ - Add unit test in
packages/core/realtime-js/test/ - Add integration test in
packages/core/supabase-js/test/ - Run complete test suites for both packages to verify impacts
- Commit:
fix(realtime-js): resolve reconnection logic affecting supabase-js - Single PR, single review, single release - all packages version together
Adding New Features
- Implement in appropriate library under
packages/core/[library]/src/ - Write comprehensive unit tests in
packages/core/[library]/test/ - If feature affects supabase-js, add integration tests there
- Update TypeScript types if needed
- Run complete test suite for the package before committing
- Use conventional commit:
feat(storage-js): add resumable uploads
Quick Fix Workflow
# Even for single-library fixes:
git add .
git commit -m "fix(auth-js): correct session expiry calculation"
# → Automatic canary: 2.80.1-canary.0 published to 'canary' dist-tag
# Run complete test suite for the package:
nx test:auth auth-js
# After validation, manual promotion:
nx release --tag=latest --yes # Promotes to stable with same version for ALL packagesTypeScript Configuration
Workspace Settings
- Target: ES2022
- Module: NodeNext
- Strict: true
- Isolated Modules: true (faster compilation)
- Composite: true (incremental builds)
Per-Library Configs
Each library has its own tsconfig.json extending the base configuration, allowing for library-specific adjustments while maintaining consistency.
TypeScript Project References Setup
This repository uses TypeScript project references for incremental builds and better type checking across packages.
What's Configured:
- tsconfig.base.json - Base configuration inherited by all projects:
composite: true- Enables project referencesdeclaration: true- Required by compositemoduleResolution: "bundler"- Works with workspacesisolatedModules: true- Inherited but overridden in core packagesnoImplicitOverride: true- Inherited but overridden in core packages- No
customConditions- Removed to avoid conflicts with CommonJS packages
Root tsconfig.json - References all projects in the monorepo:
{ "extends": "./tsconfig.base.json", "files": [], "references": [ { "path": "./packages/core/auth-js" }, { "path": "./packages/core/realtime-js" } // ... all other packages ] }- Core packages (auth-js, realtime-js, postgrest-js, functions-js, storage-js):
- Keep
module: "CommonJS"for backward compatibility - Override
moduleResolution: "Node"(required for CommonJS) - Override
isolatedModules: false(existing code doesn't useexport type) - Override
noImplicitOverride: false(existing code doesn't useoverridekeyword) - Add
referencesarray pointing to dependencies (managed bynx sync)
- Keep
- Utils packages (utils-fetch):
- Inherit
moduleResolution: "bundler"from base - Can optionally add
customConditions: ["@supabase-js/source"]for source preference
- Inherit
Key Principles:
- ✅ No Breaking Changes: Build output is identical - only type-checking is affected
- ✅ Incremental Builds: TypeScript only recompiles changed projects
- ✅ Better Performance: Reduced memory usage during builds
- ✅ Automatic References: Nx sync automatically maintains project references
- ⚠️ No
customConditionsin base: Would conflict withmoduleResolution: "Node"
When Adding New Packages:
- Ensure
composite: trueanddeclaration: trueare set - Add
referencesarray pointing to dependencies - If using CommonJS, override
moduleResolution: "Node"and disable strict options - Run
nx syncto update root tsconfig.json automatically
Important Notes:
- TypeScript project references work WITHOUT
customConditions- it's optional customConditionsonly optimizes source file resolution during development- Core packages use
moduleResolution: "Node"which is incompatible withcustomConditions - The
isolatedModules: falseoverride avoids requiringexport typefor type re-exports - All build outputs remain identical to pre-project-references setup
Testing Infrastructure
Unit Tests (Jest)
- Location:
packages/core/[library]/test/ - Pattern: Mirror source structure
- Principle: Test public APIs thoroughly
- Mocking: Mock external dependencies
Integration Tests (Docker-based)
Complete Test Suites (Recommended):
# Auth-js: Complete test suite (handles Docker setup/cleanup automatically)
nx test:auth auth-js
# Storage-js: Complete test suite (handles Docker setup/cleanup automatically)
nx test:storage storage-js
# Postgrest-js: Complete test suite (handles Docker setup/cleanup automatically)
nx test:ci:postgrest postgrest-jsManual Infrastructure Management (for development):
# Auth-js
nx test:infra auth-js # Start Supabase CLI infrastructure
nx test:suite auth-js # Run tests (can run multiple times)
nx test:clean-post auth-js # Cleanup
# Storage-js
nx test:infra storage-js # Start Supabase CLI infrastructure
nx test:suite storage-js # Run tests (can run multiple times)
nx test:clean-post storage-js # Cleanup
# Postgrest-js
nx test:infra postgrest-js # Start Supabase CLI infrastructure
nx test:run postgrest-js # Run tests
nx test:clean-post postgrest-js # CleanupCross-Platform Tests (supabase-js)
Tests run against multiple environments:
- Node.js (native)
- Next.js (SSR/React)
- Expo (React Native)
- Bun (alternative runtime)
- Deno (secure runtime)
- Browser (via Puppeteer)
Library-Specific Considerations
supabase-js
- Aggregates all other libraries
- Primary integration testing location
- Most complex cross-platform test suite (Node.js, Next.js, Expo, Bun, Deno, Browser)
- Users typically interact through this package
- Default branch: master
auth-js
- Requires Docker for integration tests (GoTrue + PostgreSQL)
- Complex session management logic
- Security-critical - extra review care needed
- See auth-js README for details
realtime-js
- WebSocket-based, timing-sensitive
- Mock time in tests when possible
- No Docker required (uses mock WebSockets)
- See realtime-js README for details
storage-js
- Requires Docker for integration tests (Storage API + PostgreSQL + Kong)
- File handling varies by platform
- See storage-js README for details
postgrest-js
- Pure HTTP client, easiest to test
- Requires Docker for integration tests (PostgREST + PostgreSQL)
- See postgrest-js README for details
functions-js
- Simplest library, minimal dependencies
- Uses testcontainers for Deno relay
- See functions-js README for details
Code Style Guidelines
Formatting
- Prettier handles all formatting (configured in
.prettierrc) - Run
nx formatbefore committing - No formatting debates - Prettier decides
Patterns
- Follow existing patterns in each library
- Extract shared code to packages/shared/ when identified
- Maintain consistency across monorepo
Documentation
- JSDoc for all public APIs
- README per package with examples
- Update docs when changing APIs
Important Context
Branch Information
Current Repository:
- Default branch:
master(v2 active development; all PRs land here by default; auto-publishes@canaryon every push, stable releases are manualworkflow_dispatchfrom this branch) - Long-lived feature branch:
v3(v3-only breaking changes;@nextprereleases are manualworkflow_dispatchonly — never auto-published; kept in sync withmasterby periodicgit merge master) - Repository URL:
github.com/supabase/supabase-js
Original Repository Branches (for historical reference):
- master: auth-js, postgrest-js, realtime-js, supabase-js
- main: functions-js, storage-js
When referencing original repository history or comparing changes, be aware of these branch name differences.
Package Publishing
- All packages publish to npm under
@supabasescope - Versions synchronized via fixed release mode (all packages always have same version)
- Changelogs generated per package from conventional commits
- "No user-facing changes" message for unchanged packages
- Three dist-tags:
latest(stable),canary(pre-release),next(legacy)
Docker Requirements
Integration tests for auth-js, functions-js, postgrest-js, and storage-js require Docker running locally:
- macOS/Windows: Ensure Docker Desktop is installed and running
- Linux: Ensure Docker daemon is running
- CI: Docker is automatically available in GitHub Actions
Check TESTING.md for port requirements and troubleshooting.
Commit Message Validation
All commits are validated using commitlint with strict rules:
- Type: Required (feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert)
- Scope: Required (auth, functions, postgrest, realtime, storage, supabase, repo, deps, ci, release, docs, scripts, misc)
- Subject: Required, imperative mood, no period at end, max 100 characters
- Interactive Tool: Use
pnpm committo ensure compliance
See CONTRIBUTING.md for complete details.
Common Pitfalls & Solutions
Pitfall 1: Hardcoding Internal Versions
❌ Wrong:
"@supabase/auth-js": "3.5.0"✅ Correct:
"@supabase/auth-js": "*"Pitfall 2: Running npm Directly
❌ Wrong:
cd packages/core/auth-js && npm test✅ Correct:
nx test:auth auth-jsPitfall 3: Testing Everything
❌ Wrong:
nx run-many --target=test --all # Won't work - no standard test target for all packages✅ Correct:
# Run complete test suite for the specific package
nx test:auth auth-js
nx test:storage storage-js
nx test:ci:postgrest postgrest-js
nx test functions-js
nx test realtime-js
nx test supabase-jsPitfall 4: Breaking Changes
❌ Wrong: Changing public API signatures without proper process
// Don't just change existing method signatures
- signIn(email: string): Promise<void>
+ signIn(credentials: Credentials): Promise<void>✅ Correct: Add new methods, deprecate old ones gradually, use proper commit format
// Add new method
signIn(credentials: Credentials): Promise<void>
// Deprecate old method with backward compatibility
/** @deprecated Use signIn(credentials) instead */
signInWithEmail(email: string): Promise<void> {
return this.signIn({ email })
}Use breaking change commit format when necessary:
feat(auth)!: remove deprecated signInWithEmail method
BREAKING CHANGE: The deprecated signInWithEmail method has been removed.
Use signIn({ email }) instead.Pitfall 5: Running Commands Incorrectly
❌ Wrong: Running npm commands directly in library directories
cd packages/core/auth-js
npm test
npm run build✅ Correct: Use Nx commands from repository root
nx test:auth auth-js
nx build auth-js --watchPitfall 6: Not Using the Commit Tool
❌ Wrong: Using git commit directly
git commit -m "fix auth bug" # Missing scope, will fail validation✅ Correct: Use the interactive commit tool
pnpm commit # Guides you through proper formatPitfall 7: Not Checking Documentation
❌ Wrong: Assuming you know how to run tests without checking
nx test storage-js # Wrong - should use nx test:storage storage-js✅ Correct: Check library README and TESTING.md first
# Read docs first
cat packages/core/storage-js/README.md
cat docs/TESTING.md
# Then run tests with proper setupPull Request Best Practices
📖 See CONTRIBUTING.md for complete PR guidelines
Before Creating PR
Ensure branch is up to date with the PR's target branch (typically
master;v3only for v3-only breaking changes):git checkout <target-branch> # master or v3 git pull upstream <target-branch> git checkout your-feature-branch git rebase <target-branch>Run all necessary checks:
nx format # Format code # Run complete test suite for affected packages individually nx test:auth auth-js # If auth-js changed nx test:storage storage-js # If storage-js changed # ... etc for other packages nx affected --target=build # Build affected packagesUse interactive commit tool:
pnpm commit
PR Requirements
- ✅ At least 1 approving review from a code owner
- ✅ All status checks passing (CI/CD pipeline)
- ✅ No merge conflicts with the base branch
- ✅ Squash merge only (enforced by repository settings)
PR Description Template
## Description
Brief description of what this PR does
## Type of Change
- [ ] Bug fix (fix)
- [ ] New feature (feat)
- [ ] Breaking change (feat! or fix!)
- [ ] Documentation update (docs)
- [ ] Other (chore, refactor, etc.)
## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated (if applicable)
- [ ] All tests passing locally
## Checklist
- [ ] Code formatted (`nx format`)
- [ ] Tests passing (run complete test suites for affected packages)
- [ ] Builds passing (`nx affected --target=build`)
- [ ] Used conventional commits
- [ ] Documentation updated (if needed)Requesting Preview Releases
If you need to test your changes before merging:
- Create your PR
- Comment: "Can a maintainer add the preview label for testing?"
- Wait for maintainer to add
trigger: previewlabel - Follow instructions in automated comment to install preview packages
Helpful Commands Reference
Analysis & Debugging
# Visualize dependency graph
nx graph
# Show what's affected by changes
nx affected --graph
# List all projects
nx show projects
# See project details
nx show project auth-js --web
# Clear Nx cache
nx resetDevelopment Workflow
# 1. Create feature branch
git checkout -b feat/your-feature
# 2. Make changes in packages/core/[library]/
# 3. Test continuously
nx test [library] --watch
# 4. Format before committing
nx format
# 5. Commit with tool
pnpm commit
# 6. Before pushing
# Run complete test suite for the package you changed
nx test:auth auth-js # If auth-js changed
nx test:storage storage-js # If storage-js changed
# ... etc
nx affected --target=build
nx format:check
# 7. Push and create PR
git push origin feat/your-featureTroubleshooting
# Clear cache and rebuild
nx reset
nx run-many --target=build --all
# Clean install
rm -rf node_modules
pnpm install
# Check for errors
nx run-many --target=lint --all
# Run specific test file (for packages with standard test target)
nx test realtime-js --testFile=RealtimeClient.test.ts
nx test supabase-js --testFile=client.test.tsAdditional Resources
- README.md - Repository overview and quick start
- CONTRIBUTING.md - Complete contribution guide
- TESTING.md - Comprehensive testing documentation
- RELEASE.md - Release workflows and automation
- MIGRATION.md - Cross-cutting migration notes; per-package migrations live at
packages/core/<package>/migrations/ - Security Policy - Security policy and reporting
- Supabase Documentation - Official Supabase docs
- Nx Documentation - Nx monorepo documentation
- Conventional Commits - Commit format specification
Pitfall 5: Incomplete Cross-Library Testing
❌ Wrong: Only testing in source library ✅ Correct: Test in source library AND integration tests in supabase-js
Release Process
Hybrid Release Flow
Canary Releases (Automated):
# Triggered automatically on every commit to master
git commit -m "fix(auth): resolve token issue"
# → Automatic CI: nx release --tag=canary --yes
# → Published: 2.80.1-canary.0 to 'canary' dist-tagStable Releases (Manual):
# 1. Validate canary version
# Run complete test suites for packages individually
# 2. Preview stable promotion
nx release --dry-run
# 3. Promote canary to stable
nx release --tag=latest --yes
# Alternative: Promote specific canary
nx release --specifier=2.80.1 --tag=latest --yesWhat Happens During Canary Release
- CI detects conventional commits
- Determines version bump (patch/minor/major)
- Generates prerelease version (e.g., 2.80.1-canary.0)
- Updates all package.json files
- Replaces
*with actual versions - Publishes all packages to npm with
canarydist-tag - Triggers dogfooding workflows (when configured)
What Happens During Stable Release
- Promotes validated canary to
latestdist-tag - Generates curated per-package changelogs
- Creates GitHub release with notes
- All packages get identical stable version
Nx Release Configuration
The workspace is configured for hybrid releases in nx.json:
{
"release": {
"projectsRelationship": "fixed",
"version": {
"conventionalCommits": true
},
"changelog": {
"projectChangelogs": true,
"workspaceChangelog": true
}
}
}Release Command Reference
# Canary releases (automated in CI)
nx release --tag=canary --yes # Publish to 'canary' dist-tag
nx release --specifier=prerelease --tag=canary # Force prerelease bump
# Stable releases (manual promotion)
nx release --tag=latest --yes # Promote to 'latest' dist-tag
nx release --specifier=2.80.1 --tag=latest # Promote specific version
# Preview and debugging
nx release --dry-run # Preview changes
nx release --dry-run --verbose # Detailed preview
nx release --first-release --dry-run # First release preview
# Version-specific releases
nx release --specifier=patch --tag=latest # Force patch bump
nx release --specifier=minor --tag=latest # Force minor bump
nx release --specifier=major --tag=latest # Force major bumpChangelog Example
## @supabase/realtime-js 2.80.1 (2025-09-16)
- fix: correct reconnection logic (#123)
## @supabase/auth-js 2.80.1 (2025-09-16)
_No user-facing changes in this release._
## @supabase/supabase-js 2.80.1 (2025-09-16)
_No user-facing changes in this release._When Providing Code Suggestions
- Consider Monorepo Impact: Changes might affect multiple packages - always check dependencies
- Use Nx Commands: Always prefer
nxover directnpmfor workspace operations - Suggest Complete Test Suites: Use complete test suites (
nx test:auth auth-js,nx test:storage storage-js, etc.) for packages individually - Respect Fixed Versioning: All packages version together - no independent versioning
- Maintain Compatibility: Never introduce breaking changes without proper process
- Check Testing Requirements: Be aware of Docker requirements for integration tests
- Extract Shared Code: Identify patterns that could be shared across packages
- Follow Conventions: Use existing patterns and structures within each library
- Document Changes: Update JSDoc and READMEs when changing public APIs
- Use Conventional Commits: Always suggest proper commit format with scope
Quick Decision Tree
Q: Where does this code belong?
- Authentication logic → auth-js
- Database queries → postgrest-js
- Real-time subscriptions → realtime-js
- File operations → storage-js
- Edge function calls → functions-js
- Integration of above → supabase-js
- Shared utilities → packages/shared/ (create if needed)
Q: How to test this change?
- Unit test in source library
- Integration test in supabase-js if affects it
- Run complete test suite for the package:
nx test:auth auth-js(handles Docker automatically)nx test:storage storage-js(handles Docker automatically)nx test:ci:postgrest postgrest-js(handles Docker automatically)nx test functions-js(uses testcontainers)nx test realtime-js(no Docker needed)nx test supabase-js(unit tests only)
- Run complete test suites for all affected packages individually
Q: How will this release?
- All packages version together in fixed mode
- Your commit triggers automatic canary release for ALL packages
- Weekly promotion of validated canary to stable
- Unchanged packages show "No user-facing changes"
- Single npm install updates entire SDK suite
Remember: This monorepo optimizes for developer experience and maintenance efficiency while ensuring zero breaking changes for the millions of developers using Supabase SDKs.
<!-- nx configuration start--><!-- Leave the start & end comments to automatically receive updates. -->General Guidelines for working with Nx
- For navigating/exploring the workspace, invoke the
nx-workspaceskill first - it has patterns for querying projects, targets, and dependencies - When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through
nx(i.e.nx run,nx run-many,nx affected) instead of using the underlying tooling directly - Prefix nx commands with the workspace's package manager (e.g.,
pnpm nx build,npm exec nx test) - avoids using globally installed CLI - You have access to the Nx MCP server and its tools, use them to help the user
- For Nx plugin best practices, check
node_modules/@nx/<plugin>/PLUGIN.md. Not all plugins have this file - proceed without it if unavailable. - NEVER guess CLI flags - always check nx_docs or
--helpfirst when unsure
Scaffolding & Generators
- For scaffolding tasks (creating apps, libs, project structure, setup), ALWAYS invoke the
nx-generateskill FIRST before exploring or calling MCP tools
When to use nx_docs
- USE for: advanced config options, unfamiliar flags, migration guides, plugin configuration, edge cases
- DON'T USE for: basic generator syntax (
nx g @nx/react:app), standard commands, things you already know - The
nx-generateskill handles generator discovery internally - don't call nx_docs just to look up generator syntax
<!-- nx configuration end-->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

