mirror of
https://github.com/supabase/agent-skills.git
synced 2026-03-27 10:09:26 +08:00
code rabbit review of PR
This commit is contained in:
@@ -12,19 +12,8 @@ metadata:
|
||||
|
||||
# Supabase
|
||||
|
||||
Supabase is an open source Firebase alternative that provides a Postgres database, authentication, instant APIs, edge functions, realtime subscriptions, and storage. It's fully compatible with Postgres and works with any language, framework, or ORM.
|
||||
Supabase is an open source Firebase alternative that provides a Postgres database, authentication, instant APIs, edge functions, realtime subscriptions, and storage. It's fully compatible with Postgres and provides several language sdks, including supabase-js and supabase-py.
|
||||
|
||||
## Supabase Documentation
|
||||
|
||||
Always reference the Supabase documentation before making Supabase-related claims. The documentation is the source of truth for all Supabase-related information.
|
||||
|
||||
You can use the `curl` commands to fetch the documentation page as markdown:
|
||||
|
||||
**Documentation:**
|
||||
|
||||
```bash
|
||||
# Fetch any doc page as markdown
|
||||
curl -H "Accept: text/markdown" https://supabase.com/docs/<path>
|
||||
```
|
||||
|
||||
## Overview of Resources
|
||||
@@ -53,3 +42,19 @@ Reference the appropriate resource file based on the user's needs:
|
||||
| Patterns | `references/realtime-patterns-*.md` | Cleanup, error handling, React integration |
|
||||
|
||||
**CLI Usage:** Always use `npx supabase` instead of `supabase` for version consistency across team members.
|
||||
|
||||
## Supabase Documentation
|
||||
|
||||
Everytime something is not clear, or you want to double-check something, reference the official Supabase documentation. It is the source of truth for all things Supabase and is regularly updated with the latest information, best practices, and examples. - [Supabase Documentation](https://supabase.com/docs). The documentation is available in html format on the website, but you can also fetch plain text versions of specific sections using the following endpoints:
|
||||
|
||||
**Documentation:**
|
||||
|
||||
```bash
|
||||
# Index of all available docs
|
||||
curl https://supabase.com/llms.txt
|
||||
|
||||
# Fetch all guides as plain text
|
||||
curl https://supabase.com/llms/guides.txt
|
||||
|
||||
# Fetch JavaScript SDK reference
|
||||
curl https://supabase.com/llms/js.txt
|
||||
|
||||
@@ -44,15 +44,14 @@ channel.subscribe((status, err) => {
|
||||
|
||||
| Error | Cause | Solution |
|
||||
|-------|-------|----------|
|
||||
| `too_many_connections` | Connection limit exceeded | Clean up unused channels, upgrade plan |
|
||||
| `too_many_channels` | Too many channels per connection | Remove unused channels (limit: 100/connection) |
|
||||
| `too_many_joins` | Channel join rate exceeded | Reduce join frequency |
|
||||
| `tenant_events` | Too many messages/second | Reduce message rate or upgrade plan |
|
||||
| `ConnectionRateLimitReached` | Connection limit exceeded | Clean up unused channels, upgrade plan |
|
||||
| `ChannelRateLimitReached` | Too many channels per connection | Remove unused channels (limit: 100/connection) |
|
||||
| `ClientJoinRateLimitReached` | Channel join rate exceeded | Reduce join frequency |
|
||||
| `TenantNotFound` | Invalid project reference | Verify project URL |
|
||||
|
||||
## Automatic Reconnection
|
||||
|
||||
Supabase handles reconnection automatically with exponential backoff. No manual re-subscribe is needed.
|
||||
Supabase handles reconnection automatically with exponential backoff (1s, 2s, 5s, 10s). No manual re-subscribe is needed for standard disconnects. For silent disconnections in backgrounded apps, use `heartbeatCallback` to detect and trigger reconnection (see below).
|
||||
|
||||
## Client-Side Logging
|
||||
|
||||
@@ -81,9 +80,9 @@ const supabase = createClient(url, key, {
|
||||
// 1. Use Web Worker to prevent browser throttling of heartbeats
|
||||
worker: true,
|
||||
// 2. Detect disconnections and reconnect
|
||||
heartbeatCallback: (client) => {
|
||||
if (client.connectionState() === 'disconnected') {
|
||||
client.connect()
|
||||
heartbeatCallback: (status) => {
|
||||
if (status === 'disconnected') {
|
||||
supabase.realtime.connect()
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -12,7 +12,7 @@ Postgres Changes streams database changes via logical replication. Note: **Broad
|
||||
## When to Use Postgres Changes
|
||||
|
||||
- Quick prototyping and development
|
||||
- Low user counts (< 100 concurrent subscribers per table)
|
||||
- Low subscriber counts per table (each change triggers RLS checks for every subscriber, so performance degrades linearly)
|
||||
- When simplicity is more important than scale
|
||||
|
||||
## Basic Setup
|
||||
|
||||
@@ -79,8 +79,10 @@ const channel = supabase.channel('room:123', {
|
||||
| Free | 20 |
|
||||
| Pro | 50 |
|
||||
| Pro (no spend cap) | 1,000 |
|
||||
| Team/Enterprise | 1,000 |
|
||||
For Pay as you go customers, stop and ask the user to edit these limits in the Supabase Dashboard under Realtime Settings.
|
||||
| Team/Enterprise | 1,000+ |
|
||||
|
||||
Limits are configurable per project. Pro (no spend cap), Team, and Enterprise users can adjust limits in the Supabase Dashboard under Realtime Settings.
|
||||
|
||||
## Related
|
||||
|
||||
- [setup-channels.md](setup-channels.md)
|
||||
|
||||
Reference in New Issue
Block a user