vybekiit 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1697 -562
- package/dist/global-skills/add-ai/SKILL.md +1 -1
- package/dist/global-skills/add-analytics/SKILL.md +1 -1
- package/dist/global-skills/add-blog/SKILL.md +1 -1
- package/dist/global-skills/add-crud/SKILL.md +1 -1
- package/dist/global-skills/add-files/SKILL.md +1 -1
- package/dist/global-skills/add-images/SKILL.md +1 -1
- package/dist/global-skills/add-language/SKILL.md +1 -1
- package/dist/global-skills/add-notifications/SKILL.md +1 -1
- package/dist/global-skills/add-realtime/SKILL.md +1 -1
- package/dist/global-skills/add-route/SKILL.md +1 -1
- package/dist/global-skills/add-search/SKILL.md +1 -1
- package/dist/global-skills/add-signin/SKILL.md +1 -1
- package/dist/global-skills/add-teams/SKILL.md +1 -1
- package/dist/global-skills/add-upload/SKILL.md +1 -1
- package/dist/global-skills/aws-serverless/SKILL.md +44 -44
- package/dist/global-skills/aws-serverless/assets/powertools-handler.py +1 -2
- package/dist/global-skills/aws-serverless/references/api-gateway.md +470 -50
- package/dist/global-skills/aws-serverless/references/architecture.md +186 -47
- package/dist/global-skills/aws-serverless/references/concurrency.md +158 -44
- package/dist/global-skills/aws-serverless/references/deployment.md +1 -1
- package/dist/global-skills/aws-serverless/references/event-sources.md +391 -72
- package/dist/global-skills/aws-serverless/references/lambda.md +428 -69
- package/dist/global-skills/aws-serverless/references/orchestration.md +384 -65
- package/dist/global-skills/aws-serverless/references/production.md +415 -78
- package/dist/global-skills/aws-serverless/references/troubleshooting.md +626 -79
- package/dist/global-skills/back-up-my-code/SKILL.md +1 -1
- package/dist/global-skills/buy-domain/SKILL.md +1 -1
- package/dist/global-skills/check-safety/SKILL.md +1 -1
- package/dist/global-skills/configure-capabilities/SKILL.md +1 -1
- package/dist/global-skills/connect-account/SKILL.md +1 -1
- package/dist/global-skills/connect-account-backend/SKILL.md +1 -1
- package/dist/global-skills/design-my-data/SKILL.md +1 -1
- package/dist/global-skills/doctor/SKILL.md +1 -1
- package/dist/global-skills/feedback/SKILL.md +63 -0
- package/dist/global-skills/go-live/SKILL.md +1 -1
- package/dist/global-skills/harden/SKILL.md +1 -1
- package/dist/global-skills/instrument-feature-flags/references/usage.md +0 -35
- package/dist/global-skills/instrument-product-analytics/SKILL.md +1 -1
- package/dist/global-skills/instrument-product-analytics/references/android.md +0 -36
- package/dist/global-skills/instrument-product-analytics/references/configuration.md +0 -1
- package/dist/global-skills/instrument-product-analytics/references/flutter.md +0 -37
- package/dist/global-skills/instrument-product-analytics/references/posthog-python.md +2 -3
- package/dist/global-skills/instrument-product-analytics/references/usage.md +0 -35
- package/dist/global-skills/manifest.json +2 -1
- package/dist/global-skills/neon/SKILL.md +20 -27
- package/dist/global-skills/neon-ai-gateway/SKILL.md +2 -68
- package/dist/global-skills/neon-functions/SKILL.md +7 -7
- package/dist/global-skills/neon-object-storage/SKILL.md +2 -2
- package/dist/global-skills/neon-postgres/SKILL.md +5 -5
- package/dist/global-skills/neon-postgres-branches/SKILL.md +1 -1
- package/dist/global-skills/onboarding/SKILL.md +1 -1
- package/dist/global-skills/plan-my-idea/SKILL.md +1 -1
- package/dist/global-skills/publish-app/SKILL.md +1 -1
- package/dist/global-skills/publish-extension/SKILL.md +1 -1
- package/dist/global-skills/reset-password/SKILL.md +1 -1
- package/dist/global-skills/save-data/SKILL.md +1 -1
- package/dist/global-skills/setup-email/SKILL.md +1 -1
- package/dist/global-skills/setup-payments/SKILL.md +1 -1
- package/dist/global-skills/setup-sms/SKILL.md +1 -1
- package/dist/global-skills/sign-in-with-email-link/SKILL.md +1 -1
- package/dist/global-skills/sign-in-with-google/SKILL.md +1 -1
- package/dist/global-skills/sign-in-with-phone/SKILL.md +1 -1
- package/dist/global-skills/stripe-best-practices/SKILL.md +6 -11
- package/dist/global-skills/stripe-best-practices/references/billing.md +0 -5
- package/dist/global-skills/stripe-best-practices/references/payments.md +2 -4
- package/dist/global-skills/stripe-best-practices/references/tax.md +8 -78
- package/dist/global-skills/track-errors/SKILL.md +1 -1
- package/dist/global-skills/update-kit/SKILL.md +1 -1
- package/dist/global-skills/wire-auth/SKILL.md +1 -1
- package/dist/global-skills/wire-database/SKILL.md +1 -1
- package/dist/global-skills/wire-email/SKILL.md +1 -1
- package/dist/global-skills/wire-payments/SKILL.md +1 -1
- package/package.json +8 -8
- package/dist/global-skills/email-best-practices/.github/workflows/sync-skills.yml +0 -30
- package/dist/global-skills/email-best-practices/README.md +0 -63
- package/dist/global-skills/email-best-practices/references/accessibility.md +0 -189
- package/dist/global-skills/email-best-practices/references/compliance.md +0 -125
- package/dist/global-skills/email-best-practices/references/deliverability.md +0 -121
- package/dist/global-skills/email-best-practices/references/email-capture.md +0 -129
- package/dist/global-skills/email-best-practices/references/email-types.md +0 -173
- package/dist/global-skills/email-best-practices/references/list-management.md +0 -157
- package/dist/global-skills/email-best-practices/references/marketing-emails.md +0 -115
- package/dist/global-skills/email-best-practices/references/sending-reliability.md +0 -155
- package/dist/global-skills/email-best-practices/references/transactional-email-catalog.md +0 -418
- package/dist/global-skills/email-best-practices/references/transactional-emails.md +0 -92
- package/dist/global-skills/email-best-practices/references/webhooks-events.md +0 -167
- package/dist/global-skills/email-best-practices/tests/README.md +0 -35
- package/dist/global-skills/email-best-practices/tests/scenarios/01-spam-deliverability.md +0 -46
- package/dist/global-skills/email-best-practices/tests/scenarios/02-multi-region-compliance.md +0 -48
- package/dist/global-skills/email-best-practices/tests/scenarios/03-retry-idempotency.md +0 -36
- package/dist/global-skills/email-best-practices/tests/scenarios/04-webhook-bounce-handling.md +0 -52
- package/dist/global-skills/email-best-practices/tests/scenarios/05-new-saas-email-plan.md +0 -51
- package/dist/global-skills/neon-postgres/references/neon-sdk.md +0 -262
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Scenario 1: Emails Going to Spam
|
|
2
|
-
|
|
3
|
-
## Prompt
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
You are an AI coding assistant. A developer asks you:
|
|
7
|
-
|
|
8
|
-
"My transactional emails (password resets, order confirmations) are going to spam in Gmail. What do I do to fix this?"
|
|
9
|
-
|
|
10
|
-
Answer with specific, actionable steps. Include exact DNS records, commands to verify, and threshold numbers where relevant.
|
|
11
|
-
|
|
12
|
-
Format your response as a numbered action plan.
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Expected Correctness Criteria
|
|
16
|
-
|
|
17
|
-
The agent MUST include these skill-specific details:
|
|
18
|
-
|
|
19
|
-
### Authentication (deliverability.md)
|
|
20
|
-
- [ ] SPF record example: `v=spf1 include:amazonses.com ~all`
|
|
21
|
-
- [ ] DKIM: provider supplies the record
|
|
22
|
-
- [ ] DMARC: `v=DMARC1; p=none; rua=mailto:dmarc@example.com`
|
|
23
|
-
- [ ] DMARC rollout: `p=none` → `p=quarantine; pct=25` → `p=reject`
|
|
24
|
-
- [ ] Verification commands: `dig TXT example.com +short`, `dig TXT resend._domainkey.example.com +short`, `dig TXT _dmarc.example.com +short`
|
|
25
|
-
|
|
26
|
-
### Thresholds (deliverability.md)
|
|
27
|
-
- [ ] Bounce targets: <1% good, 1-3% acceptable, 3-4% concerning, >4% critical
|
|
28
|
-
- [ ] Complaint targets: <0.01% excellent, 0.01-0.05% good, >0.05% critical
|
|
29
|
-
|
|
30
|
-
### IP Warming (deliverability.md)
|
|
31
|
-
- [ ] Week 1: 50-100/day
|
|
32
|
-
- [ ] Week 2: 200-500/day
|
|
33
|
-
- [ ] Week 3: 1,000-2,000/day
|
|
34
|
-
- [ ] Week 4: 5,000-10,000/day
|
|
35
|
-
|
|
36
|
-
### Infrastructure (deliverability.md)
|
|
37
|
-
- [ ] Dedicated subdomains: `t.example.com` (transactional), `m.example.com` (marketing)
|
|
38
|
-
- [ ] DNS TTL: 300s during setup, 3600s+ after stable
|
|
39
|
-
|
|
40
|
-
### Troubleshooting order (deliverability.md)
|
|
41
|
-
- [ ] Check in order: 1. Authentication, 2. List-Unsubscribe header, 3. Reputation, 4. Content, 5. Sending patterns
|
|
42
|
-
|
|
43
|
-
### Diagnostic tools (deliverability.md)
|
|
44
|
-
- [ ] Google Postmaster Tools
|
|
45
|
-
- [ ] mail-tester.com
|
|
46
|
-
- [ ] MXToolbox blacklist check
|
package/dist/global-skills/email-best-practices/tests/scenarios/02-multi-region-compliance.md
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# Scenario 2: Multi-Region Email Compliance
|
|
2
|
-
|
|
3
|
-
## Prompt
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
You are an AI coding assistant. A developer asks you:
|
|
7
|
-
|
|
8
|
-
"I'm building an email newsletter for my SaaS product. I have users in the US, EU, and Canada. What legal requirements do I need to follow? Give me a comparison table of requirements by region and the specific implementation steps."
|
|
9
|
-
|
|
10
|
-
Be specific about penalty amounts, timing requirements for unsubscribe processing, and consent record requirements.
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Expected Correctness Criteria
|
|
14
|
-
|
|
15
|
-
### Penalties (compliance.md)
|
|
16
|
-
- [ ] CAN-SPAM: $53k/email
|
|
17
|
-
- [ ] GDPR: EUR 20M or 4% revenue
|
|
18
|
-
- [ ] CASL: $1M (individual) to $10M (organization) CAD
|
|
19
|
-
|
|
20
|
-
### Consent types (compliance.md)
|
|
21
|
-
- [ ] CAN-SPAM: opt-out model (can send without opt-in)
|
|
22
|
-
- [ ] GDPR: explicit opt-in (no pre-checked boxes)
|
|
23
|
-
- [ ] CASL express: explicit opt-in
|
|
24
|
-
- [ ] CASL implied: existing relationship (2 years) or inquiry (6 months)
|
|
25
|
-
|
|
26
|
-
### Unsubscribe timing (compliance.md)
|
|
27
|
-
- [ ] CAN-SPAM: 10 business days, must work 30 days after send
|
|
28
|
-
- [ ] GDPR: immediately, as easy as opting in
|
|
29
|
-
- [ ] CASL: 10 business days, must work 60 days after send
|
|
30
|
-
|
|
31
|
-
### CASL specifics (compliance.md)
|
|
32
|
-
- [ ] Sender identification valid 60 days after send
|
|
33
|
-
- [ ] Keep consent records 3 years after expiration
|
|
34
|
-
|
|
35
|
-
### Consent records (compliance.md)
|
|
36
|
-
- [ ] Record: email, date/time, method, what consented to, source
|
|
37
|
-
|
|
38
|
-
### International sending (compliance.md)
|
|
39
|
-
- [ ] Best practice: follow GDPR (most restrictive) for all regions
|
|
40
|
-
|
|
41
|
-
### Managing preferences vs unsubscribe (compliance.md)
|
|
42
|
-
- [ ] One-click unsubscribe required; preference management is nice-to-have, doesn't replace unsubscribe
|
|
43
|
-
|
|
44
|
-
### List-Unsubscribe header (compliance.md)
|
|
45
|
-
- [ ] Required by Gmail/Yahoo since Feb 2024
|
|
46
|
-
- [ ] Headers: `List-Unsubscribe` URL + `List-Unsubscribe-Post: List-Unsubscribe=One-Click`
|
|
47
|
-
- [ ] Endpoint: POST returns 200/202, GET shows unsubscribe page
|
|
48
|
-
- [ ] Stop sending within 48 hours
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Scenario 3: Retry Logic + Idempotency
|
|
2
|
-
|
|
3
|
-
## Prompt
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
You are an AI coding assistant. A developer asks you:
|
|
7
|
-
|
|
8
|
-
"I'm using the Resend API to send transactional emails. I need to implement retry logic with idempotency to prevent duplicate sends. Show me a TypeScript implementation with idempotency keys, exponential backoff, and proper error code handling."
|
|
9
|
-
|
|
10
|
-
Include specific HTTP error codes and which ones to retry vs not retry, idempotency key generation strategies, and backoff timing.
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Expected Correctness Criteria
|
|
14
|
-
|
|
15
|
-
### Idempotency keys (sending-reliability.md)
|
|
16
|
-
- [ ] Event-based key example: `order-confirm-${orderId}` (recommended)
|
|
17
|
-
- [ ] Request-scoped example: `reset-${userId}-${resetRequestId}`
|
|
18
|
-
- [ ] UUID fallback: `crypto.randomUUID()` — generate once, reuse on retry
|
|
19
|
-
- [ ] Warns against `Date.now()` or random values generated fresh on each attempt
|
|
20
|
-
- [ ] Key expiration: 24 hours — complete retry logic within this window
|
|
21
|
-
|
|
22
|
-
### Error codes (sending-reliability.md)
|
|
23
|
-
- [ ] Retry: 5xx (server error), 429 (rate limit), network timeout, DNS failure
|
|
24
|
-
- [ ] Do NOT retry: 400 (bad request), 401 (unauthorized), 403 (forbidden), 404 (not found), 422 (validation)
|
|
25
|
-
|
|
26
|
-
### Backoff (sending-reliability.md)
|
|
27
|
-
- [ ] Exponential: 1s -> 2s -> 4s -> 8s
|
|
28
|
-
- [ ] Cap at 30 seconds
|
|
29
|
-
- [ ] Jitter to prevent thundering herd
|
|
30
|
-
- [ ] Max retries: 3
|
|
31
|
-
|
|
32
|
-
### Timeout (sending-reliability.md)
|
|
33
|
-
- [ ] AbortController pattern with 10-30 second timeout
|
|
34
|
-
|
|
35
|
-
### Queuing (sending-reliability.md)
|
|
36
|
-
- [ ] Queue pattern for critical emails: write pending -> attempt send -> mark sent/schedule retry -> mark failed + alert
|
package/dist/global-skills/email-best-practices/tests/scenarios/04-webhook-bounce-handling.md
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Scenario 4: Webhook Bounce/Complaint Handling
|
|
2
|
-
|
|
3
|
-
## Prompt
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
You are an AI coding assistant. A developer asks you:
|
|
7
|
-
|
|
8
|
-
"I need to set up Resend webhooks to handle bounces and complaints. Show me how to implement this with signature verification using svix, idempotent event processing, and proper bounce/complaint handling (when to suppress, when to retry). Include TypeScript code."
|
|
9
|
-
|
|
10
|
-
Be specific about: svix verification headers, hard vs soft bounce handling thresholds, and complaint handling requirements.
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Expected Correctness Criteria
|
|
14
|
-
|
|
15
|
-
### Webhook setup (webhooks-events.md)
|
|
16
|
-
- [ ] Endpoint must return 2xx within 5 seconds
|
|
17
|
-
- [ ] Return 200 immediately, process asynchronously
|
|
18
|
-
|
|
19
|
-
### Svix verification (webhooks-events.md)
|
|
20
|
-
- [ ] Import from 'svix'
|
|
21
|
-
- [ ] Headers: `svix-id`, `svix-timestamp`, `svix-signature`
|
|
22
|
-
- [ ] Verify before processing, return 400 on invalid signature
|
|
23
|
-
|
|
24
|
-
### Idempotent processing (webhooks-events.md)
|
|
25
|
-
- [ ] Use event ID to deduplicate
|
|
26
|
-
- [ ] Check if already processed before handling
|
|
27
|
-
- [ ] Mark as processed after handling
|
|
28
|
-
|
|
29
|
-
### Event types (webhooks-events.md)
|
|
30
|
-
- [ ] `email.sent`, `email.delivered`, `email.bounced`, `email.complained`, `email.opened`, `email.clicked`
|
|
31
|
-
|
|
32
|
-
### Bounce handling (webhooks-events.md + list-management.md)
|
|
33
|
-
- [ ] Hard bounce: suppress immediately, remove from all lists
|
|
34
|
-
- [ ] Soft bounce: track count, suppress after 3 failures
|
|
35
|
-
- [ ] Suppression entry schema includes: email, reason, created_at, source_email_id
|
|
36
|
-
|
|
37
|
-
### Complaint handling (webhooks-events.md + list-management.md)
|
|
38
|
-
- [ ] Immediate suppression — no exceptions
|
|
39
|
-
- [ ] Remove from all lists
|
|
40
|
-
- [ ] Log for analysis
|
|
41
|
-
|
|
42
|
-
### Suppression unsuppress rules (list-management.md)
|
|
43
|
-
- [ ] Hard bounce: cannot unsuppress (address invalid)
|
|
44
|
-
- [ ] Complaint: cannot unsuppress (legal requirement)
|
|
45
|
-
- [ ] Soft bounce (3x): can unsuppress after 30-90 days
|
|
46
|
-
- [ ] Manual removal: only if user requests
|
|
47
|
-
|
|
48
|
-
### Pre-send check (list-management.md)
|
|
49
|
-
- [ ] Always check suppression before sending
|
|
50
|
-
|
|
51
|
-
### Retry behavior (webhooks-events.md)
|
|
52
|
-
- [ ] Non-2xx triggers retries: ~30s -> ~1min -> ~5min (continues ~24 hours)
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Scenario 5: New SaaS Email Infrastructure Plan
|
|
2
|
-
|
|
3
|
-
## Prompt
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
You are an AI coding assistant. A developer asks you:
|
|
7
|
-
|
|
8
|
-
"I'm building a new SaaS app and need to plan my entire email infrastructure. I need to know: (1) what types of transactional emails I should plan for, (2) how to set up DNS authentication, (3) how to warm up my sending domain, (4) how to handle bounces/complaints in production, and (5) what compliance requirements I need for international users. Give me a comprehensive implementation roadmap."
|
|
9
|
-
|
|
10
|
-
Be specific about: IP warming schedules (daily volumes by week), bounce rate thresholds, complaint rate thresholds, DNS record formats, and legal requirements by region.
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Expected Correctness Criteria
|
|
14
|
-
|
|
15
|
-
### Email planning (transactional-email-catalog.md)
|
|
16
|
-
- [ ] References the transactional email catalog for SaaS planning
|
|
17
|
-
- [ ] Covers at minimum: verification, password reset, OTP/2FA, security alerts, billing
|
|
18
|
-
|
|
19
|
-
### DNS authentication (deliverability.md)
|
|
20
|
-
- [ ] SPF, DKIM, DMARC records with examples
|
|
21
|
-
- [ ] DMARC rollout strategy (none -> quarantine; pct=25 -> reject)
|
|
22
|
-
- [ ] Dedicated subdomains for transactional vs marketing
|
|
23
|
-
|
|
24
|
-
### Warming (deliverability.md)
|
|
25
|
-
- [ ] Correct weekly schedule: 50-100 / 200-500 / 1k-2k / 5k-10k
|
|
26
|
-
- [ ] Start with engaged users, send consistently
|
|
27
|
-
|
|
28
|
-
### Bounce/complaint handling (deliverability.md + list-management.md + webhooks-events.md)
|
|
29
|
-
- [ ] Bounce thresholds: <1% good, >4% critical
|
|
30
|
-
- [ ] Complaint thresholds: <0.01% excellent, >0.05% critical
|
|
31
|
-
- [ ] Hard bounce: immediate suppression
|
|
32
|
-
- [ ] Soft bounce: suppress after 3 failures
|
|
33
|
-
- [ ] Complaint: immediate suppression
|
|
34
|
-
- [ ] Pre-send suppression check
|
|
35
|
-
|
|
36
|
-
### Compliance (compliance.md)
|
|
37
|
-
- [ ] Covers CAN-SPAM, GDPR, CASL
|
|
38
|
-
- [ ] Correct penalty amounts
|
|
39
|
-
- [ ] Correct unsubscribe timing by region
|
|
40
|
-
- [ ] Recommends GDPR as global standard
|
|
41
|
-
|
|
42
|
-
### Data retention (list-management.md)
|
|
43
|
-
- [ ] Send attempts: 90 days
|
|
44
|
-
- [ ] Bounce/complaint events: 3 years
|
|
45
|
-
- [ ] Suppression list: indefinite
|
|
46
|
-
- [ ] Email content: 30 days
|
|
47
|
-
- [ ] Consent records: 3 years after expiry
|
|
48
|
-
|
|
49
|
-
### Cross-resource synthesis
|
|
50
|
-
- [ ] Agent references multiple resource files (not just one)
|
|
51
|
-
- [ ] "Start Here" routing from SKILL.md is followed
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
# `@neon/sdk` — the TypeScript client for the Neon API
|
|
2
|
-
|
|
3
|
-
`@neon/sdk` is the official TypeScript client for the [Neon API](https://neon.com/docs/reference/api-reference): **Fetch-based, zero-dependency, ESM-only**, generated from Neon's [OpenAPI spec](https://neon.com/api_spec/release/v2.json) with an ergonomic layer on top. It is the successor to [`@neondatabase/api-client`](https://www.npmjs.com/package/@neondatabase/api-client) (axios-based, generated-only). The old client is **not deprecated** and is safe to keep using, but new code should prefer `@neon/sdk`.
|
|
4
|
-
|
|
5
|
-
Use this reference when writing typed, programmatic control of Neon resources in TypeScript — provisioning projects, managing branches/databases/endpoints, transferring projects across orgs, snapshots/restore, consumption metrics, and the beta services (Object Storage, Functions, AI Gateway, scoped credentials).
|
|
6
|
-
|
|
7
|
-
## When to reach for it (vs MCP / CLI)
|
|
8
|
-
|
|
9
|
-
- **Neon MCP server and CLI** are for **local development** — a coding agent in your editor or terminal.
|
|
10
|
-
- **`@neon/sdk`** is for **programmatic integration**: CI/CD pipelines where the CLI isn't enough, non-trivial dev scripts, and full platforms that provision and manage fleets of Neon databases (the same open API behind Replit, Netlify DB, Laravel Cloud, and Vercel's Neon marketplace integration). All it needs is a Neon API key.
|
|
11
|
-
|
|
12
|
-
## Install
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm install @neon/sdk
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Requires Node.js ≥ 20.19, or any runtime with a global `fetch` (Bun, Deno, edge, browser).
|
|
19
|
-
|
|
20
|
-
## Two layers, one package
|
|
21
|
-
|
|
22
|
-
```ts
|
|
23
|
-
import { createNeonClient, raw } from "@neon/sdk";
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
- **`createNeonClient`** — the high-level ergonomic client: auth once, `{ data, error }` results, typed errors, retries, readiness polling, auto-pagination, and multi-step workflows, organized into resource namespaces (`neon.projects`, `neon.branches`, `neon.postgres`, …).
|
|
27
|
-
- **`raw`** — the full generated 1:1 surface: every endpoint as a standalone, tree-shakeable function (also at the `@neon/sdk/raw` subpath). Speaks the **same** `{ data, error }` / `throwOnError` contract as the ergonomic client.
|
|
28
|
-
|
|
29
|
-
## Quick start
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
import { createNeonClient } from "@neon/sdk";
|
|
33
|
-
|
|
34
|
-
const neon = createNeonClient({ apiKey: process.env.NEON_API_KEY! });
|
|
35
|
-
|
|
36
|
-
// Create a project and get a ready-to-use connection string in one call.
|
|
37
|
-
const { data, error } = await neon.projects.createAndConnect({ name: "my-app" });
|
|
38
|
-
if (error) throw error;
|
|
39
|
-
const { project, connectionString } = data;
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Client configuration
|
|
43
|
-
|
|
44
|
-
`createNeonClient(config)`:
|
|
45
|
-
|
|
46
|
-
| Option | Type | Default | Description |
|
|
47
|
-
| --- | --- | --- | --- |
|
|
48
|
-
| `apiKey` | `string \| (() => string \| Promise<string>)` | — (required) | Neon API key, or a function returning it. Sent as a Bearer token. |
|
|
49
|
-
| `throwOnError` | `boolean` | `false` | `true` → methods return the resource directly and **throw** on error. `false` → return `{ data, error }`. **Narrows return types** at the type level. |
|
|
50
|
-
| `waitForReadiness` | `boolean` | `false` | `true` → mutations block until their provisioning `operations` finish, so the returned resource is ready. |
|
|
51
|
-
| `wait` | `{ pollIntervalMs?; timeoutMs? }` | `1000` / `300000` | Readiness poller tuning. |
|
|
52
|
-
| `retries` | `number` | `2` | Automatic retries on always-safe statuses (`423`, `429`, `503`) with backoff. |
|
|
53
|
-
| `orgId` | `string` | — | Default org for project create/list and as the transfer source org. Overridable per call. |
|
|
54
|
-
| `baseUrl` | `string` | `https://console.neon.tech/api/v2` | Override the API base URL. |
|
|
55
|
-
| `fetch` | `typeof fetch` | global `fetch` | Custom fetch (proxies, tests, non-global runtimes). |
|
|
56
|
-
|
|
57
|
-
Every option except `apiKey` is also accepted **per call** via the trailing `options` arg (`{ throwOnError?, waitForReadiness?, signal? }`), overriding the client default.
|
|
58
|
-
|
|
59
|
-
## The result model
|
|
60
|
-
|
|
61
|
-
By default every method resolves to a discriminated `{ data, error }` envelope — no `try/catch`:
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
const { data, error } = await neon.projects.get("late-frost-12345");
|
|
65
|
-
if (error) return; // error is a typed NeonError union
|
|
66
|
-
data; // narrowed to Project
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Set `throwOnError` (on the client or per call) to get the bare resource and throw instead — the return type narrows accordingly:
|
|
70
|
-
|
|
71
|
-
```ts
|
|
72
|
-
const neon = createNeonClient({ apiKey, throwOnError: true });
|
|
73
|
-
const project = await neon.projects.get("…"); // Project (throws)
|
|
74
|
-
const res = await neon.projects.get("…", { throwOnError: false }); // { data, error }
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Errors
|
|
78
|
-
|
|
79
|
-
The `error` channel carries a typed hierarchy (all `Error` subclasses with a `kind` discriminant); the same value is thrown when `throwOnError` is set.
|
|
80
|
-
|
|
81
|
-
| Class | `kind` | Notable fields |
|
|
82
|
-
| --- | --- | --- |
|
|
83
|
-
| `NeonError` | (base) | `message`, `kind` |
|
|
84
|
-
| `NeonApiError` | `"api"` | `status`, `code`, `requestId`, `response`, `body` |
|
|
85
|
-
| `NeonNotFoundError` | `"not_found"` | 404 — extends `NeonApiError` |
|
|
86
|
-
| `NeonAuthError` | `"auth"` | 401/403 |
|
|
87
|
-
| `NeonRateLimitError` | `"rate_limit"` | 429 (after retries) |
|
|
88
|
-
| `NeonOperationError` | `"operation"` | `operationId`, `status` — an awaited operation failed |
|
|
89
|
-
| `NeonTimeoutError` | `"timeout"` | readiness/wait deadline exceeded |
|
|
90
|
-
| `NeonNetworkError` | `"network"` | transport failure (no response) |
|
|
91
|
-
| `NeonError` | `"client"` | SDK-side errors (e.g. ambiguous connection-string selection) |
|
|
92
|
-
|
|
93
|
-
```ts
|
|
94
|
-
const { error } = await neon.branches.get(pid, "nope");
|
|
95
|
-
if (error?.kind === "not_found") { /* … */ }
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## Pagination
|
|
99
|
-
|
|
100
|
-
Cursor-paginated `list()` methods return a lazy `Paginated<T>`:
|
|
101
|
-
|
|
102
|
-
```ts
|
|
103
|
-
const { data: all } = await neon.projects.list().all(); // every page → { data, error }
|
|
104
|
-
const { data: page } = await neon.projects.list().page(); // one page
|
|
105
|
-
for await (const project of neon.projects.list()) { … } // stream; throws on a page error
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## Readiness & workflows
|
|
109
|
-
|
|
110
|
-
Neon mutations are asynchronous — they return `operations`. `waitForReadiness` blocks until they settle; the **workflow** methods (`createAndConnect`, `createWithCompute`) default it on and hand back a connection string in one call. The underlying primitive is `neon.operations.waitFor(operations)`.
|
|
111
|
-
|
|
112
|
-
## API surface (ergonomic client)
|
|
113
|
-
|
|
114
|
-
Legend: **[P]** returns `Paginated<T>` · **[W]** workflow (multi-step) · **→void** resolves to `void`.
|
|
115
|
-
|
|
116
|
-
### `neon.projects`
|
|
117
|
-
|
|
118
|
-
| Method | Returns | Notes |
|
|
119
|
-
| --- | --- | --- |
|
|
120
|
-
| `list(query?)` | **[P]** `ProjectListItem` | `{ search?, org_id?, limit? }` |
|
|
121
|
-
| `get(id)` | `Project` | |
|
|
122
|
-
| `create(input?)` | `Project` | `{ name?, region_id?, pg_version?, org_id?, autoscaling_limit_min_cu?, autoscaling_limit_max_cu?, settings? }` |
|
|
123
|
-
| `createAndConnect(input?, { pooled? })` | **[W]** `{ project, connectionString }` | one call + readiness; `pooled` default `true` |
|
|
124
|
-
| `update(id, input)` | `Project` | `{ name?, settings? }` |
|
|
125
|
-
| `delete(id)` | `Project` | |
|
|
126
|
-
| `transfer({ fromOrgId?, toOrgId, projectIds })` | **→void** | `fromOrgId` defaults to client `orgId` |
|
|
127
|
-
| `transferFromUser({ toOrgId, projectIds })` | **→void** | personal account → org |
|
|
128
|
-
| `recover(id)` | `Project` | beta — recover a soft-deleted project |
|
|
129
|
-
| `permissions.list / grant / revoke` | `ProjectPermission`(`[]`) | share a project by email |
|
|
130
|
-
|
|
131
|
-
```ts
|
|
132
|
-
// Provision a project and get a pooled connection string in one call
|
|
133
|
-
const { data } = await neon.projects.createAndConnect(
|
|
134
|
-
{ name: "tenant-42", region_id: "aws-us-east-1" },
|
|
135
|
-
{ pooled: true },
|
|
136
|
-
); // data: { project, connectionString }
|
|
137
|
-
|
|
138
|
-
// Upgrade path: move projects from a sponsored (free) org to the paid org
|
|
139
|
-
await neon.projects.transfer({
|
|
140
|
-
fromOrgId: sponsoredOrgId, // defaults to the client's `orgId`
|
|
141
|
-
toOrgId: paidOrgId,
|
|
142
|
-
projectIds: ["late-frost-12345"],
|
|
143
|
-
});
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### `neon.branches`
|
|
147
|
-
|
|
148
|
-
| Method | Returns | Notes |
|
|
149
|
-
| --- | --- | --- |
|
|
150
|
-
| `list(projectId, query?)` | **[P]** `Branch` | `{ search?, sort_by?, sort_order?, include_deleted? }` |
|
|
151
|
-
| `get(projectId, branchId)` | `Branch` | |
|
|
152
|
-
| `create(projectId, input?)` | `Branch` | `{ name?, parent_id?, parent_lsn?, parent_timestamp?, protected? }` |
|
|
153
|
-
| `update(projectId, branchId, input)` | `Branch` | `{ name?, protected?, expires_at? }` |
|
|
154
|
-
| `delete(projectId, branchId)` | **→void** | |
|
|
155
|
-
| `createWithCompute(projectId, input, { pooled? })` | **[W]** `{ branch, endpoint, connectionString }` | `input`: `{ name?, parentId?, compute?: { minCu?, maxCu?, suspendTimeoutSeconds? } }` |
|
|
156
|
-
| `getDefault(projectId)` / `setDefault(projectId, branchId)` | `Branch` | resolve/set the default branch |
|
|
157
|
-
| `recover(projectId, branchId)` | `Branch` | beta — recover within the 7-day window |
|
|
158
|
-
| `finalizeRestore(projectId, branchId, { name? }?)` | **→void** | commit a restore previewed with `snapshots.restore` |
|
|
159
|
-
|
|
160
|
-
```ts
|
|
161
|
-
// Branch off the default branch with its own compute — returns a ready connection string
|
|
162
|
-
const { data: prod } = await neon.branches.getDefault(projectId);
|
|
163
|
-
const { data } = await neon.branches.createWithCompute(projectId, {
|
|
164
|
-
name: "preview/pr-123",
|
|
165
|
-
parentId: prod?.id,
|
|
166
|
-
compute: { minCu: 0.25, maxCu: 2 },
|
|
167
|
-
}); // data: { branch, endpoint, connectionString }
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### `neon.postgres`
|
|
171
|
-
|
|
172
|
-
The Postgres data plane of a branch. `neon.postgres.connectionString(params, options?)` resolves a URI, **auto-selecting** the default branch and the sole role/database when omitted:
|
|
173
|
-
|
|
174
|
-
```ts
|
|
175
|
-
const { data: uri } = await neon.postgres.connectionString({
|
|
176
|
-
projectId, // branchId?, endpointId?, databaseName?, roleName?, pooled? all optional; pooled default true
|
|
177
|
-
});
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Nested namespaces:
|
|
181
|
-
|
|
182
|
-
- **`neon.postgres.endpoints`** — `list / get / create / update / delete`, plus `start` / `suspend` / `restart` and `listByBranch(projectId, branchId)`.
|
|
183
|
-
- **`neon.postgres.roles`** — `list / get / create / delete`, plus `password(...)` (reveals) and `resetPassword(...)` (rotates; result carries the new password).
|
|
184
|
-
- **`neon.postgres.databases`** — `list / get / create / update / delete`.
|
|
185
|
-
- **`neon.postgres.dataApi`** — `get / create / update / delete` the branch's Data API.
|
|
186
|
-
|
|
187
|
-
### Beta services
|
|
188
|
-
|
|
189
|
-
- **`neon.storage`** — branch object storage. `get(projectId, branchId)` → `BranchStorage`; nested `buckets` (`list / create / delete`) and `objects` (`list / get / delete / deleteByPrefix / presign`). Use `presign(..., { operation: "upload" | "download" })` for direct S3-style transfers.
|
|
190
|
-
- **`neon.functions`** — branch Neon Functions. `list` **[P]** `/ get / update / delete`, and `deploy(projectId, branchId, slug, { zip?, runtime?, environment? })` (multipart; poll `get` until `current_deployment.status === "completed"`).
|
|
191
|
-
- **`neon.credentials`** — branch scoped credentials. `list / create / revoke`; secrets (`api_token`, `s3_secret_access_key`) are returned **once** on `create`. Scopes: `storage:read`, `storage:write`, `ai_gateway:invoke`, `functions:invoke`.
|
|
192
|
-
- **`neon.aiGateway`** — `get(projectId, branchId)` → `BranchAiGateway` (404 when the gateway is not enabled on the branch). See the `neon-ai-gateway` skill for calling the gateway itself.
|
|
193
|
-
|
|
194
|
-
### `neon.snapshots`
|
|
195
|
-
|
|
196
|
-
| Method | Returns | Notes |
|
|
197
|
-
| --- | --- | --- |
|
|
198
|
-
| `list(projectId)` | `Snapshot[]` | |
|
|
199
|
-
| `create(projectId, branchId, input?)` | `Snapshot` | `{ name?, timestamp?, lsn?, expiresAt? }` (point-in-time) |
|
|
200
|
-
| `update(projectId, snapshotId, input)` | `Snapshot` | `{ name?, expiresAt? }` — `expiresAt: null` clears the TTL |
|
|
201
|
-
| `delete(projectId, snapshotId)` | **→void** | |
|
|
202
|
-
| `restore(projectId, snapshotId, input?)` | `Branch` | see below |
|
|
203
|
-
| `getSchedule` / `setSchedule(projectId, branchId, …)` | `BackupSchedule` / **→void** | |
|
|
204
|
-
|
|
205
|
-
`restore` input: `{ name?, targetBranchId?, finalize?, preview?, keepOnAbort? }`.
|
|
206
|
-
- Restoring **as a new branch** (no `targetBranchId`) finalizes by default → ready to use.
|
|
207
|
-
- Restoring **onto an existing branch** doesn't finalize by default, so you can preview first.
|
|
208
|
-
- **Transaction-style** `preview`: restores un-finalized, runs your callback, then **finalizes (commit)** on `true` or **deletes the preview branch (abort)** on `false` (unless `keepOnAbort`):
|
|
209
|
-
|
|
210
|
-
```ts
|
|
211
|
-
await neon.snapshots.restore(projectId, snapshotId, {
|
|
212
|
-
targetBranchId,
|
|
213
|
-
preview: async (branch) => (await checks(branch)) === "ok", // true → commit · false → abort
|
|
214
|
-
});
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### `neon.operations` / `neon.consumption` / `neon.apiKeys` / `neon.regions` / `neon.user` / `neon.auth`
|
|
218
|
-
|
|
219
|
-
- **`operations`** — `list` **[P]** `/ get`, and `waitFor(operations, { pollIntervalMs?, timeoutMs?, signal? })` (the readiness primitive).
|
|
220
|
-
- **`consumption`** — cursor-paginated billing metrics: `perProject`, `perProjectV2`, `perBranchV2` (each takes `{ from, to, granularity, project_ids?, org_id? }`; `perBranchV2` requires `project_ids`). Consumption requires a Scale plan or above.
|
|
221
|
-
- **`apiKeys`** — `list / create(keyName) / revoke`; the created `key` token is shown **once**.
|
|
222
|
-
- **`regions.list()`**, **`user.me()` / `user.organizations()`**.
|
|
223
|
-
- **`auth`** — branch-scoped Neon Auth: `get / create / disable / updateConfig`, plus `oauthProviders`, `trustedDomains`, and `users` sub-resources.
|
|
224
|
-
|
|
225
|
-
## Drop down to the raw client
|
|
226
|
-
|
|
227
|
-
The ergonomic namespaces don't wrap every endpoint. For anything else, `raw` exposes every endpoint 1:1 — pass `neon.client` so the call reuses the client's auth:
|
|
228
|
-
|
|
229
|
-
```ts
|
|
230
|
-
import { raw } from "@neon/sdk";
|
|
231
|
-
// or, for guaranteed tree-shaking: import { getProjectBranchSchema } from "@neon/sdk/raw";
|
|
232
|
-
|
|
233
|
-
const { data, error } = await raw.getProjectBranchSchema({
|
|
234
|
-
client: neon.client,
|
|
235
|
-
path: { project_id, branch_id },
|
|
236
|
-
query: { db_name: "neondb" }, // db_name is required
|
|
237
|
-
});
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
The raw layer speaks the same result contract: `{ data, error }` by default, or pass `throwOnError: true` for the bare resource. All request/response/error **types** are re-exported flat from `@neon/sdk` for `import type { Project, Branch, … }`.
|
|
241
|
-
|
|
242
|
-
Wait on operations from a raw mutation with the readiness primitive:
|
|
243
|
-
|
|
244
|
-
```ts
|
|
245
|
-
const { data } = await raw.createProjectBranch({
|
|
246
|
-
client: neon.client,
|
|
247
|
-
path: { project_id: projectId },
|
|
248
|
-
body: { branch: { name: "wip" } },
|
|
249
|
-
});
|
|
250
|
-
const { error } = await neon.operations.waitFor(data!.operations, { timeoutMs: 120_000 });
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## Migrating from `@neondatabase/api-client`
|
|
254
|
-
|
|
255
|
-
There's no rush — `@neondatabase/api-client` is not being deprecated. When you do move: swap axios-style `try/catch` for the `{ data, error }` envelope (or set `throwOnError: true` to keep throwing), and replace hand-rolled operation polling with `waitForReadiness` / the workflow methods (`createAndConnect`, `createWithCompute`).
|
|
256
|
-
|
|
257
|
-
## Further reading
|
|
258
|
-
|
|
259
|
-
- npm: https://www.npmjs.com/package/@neon/sdk
|
|
260
|
-
- Neon TypeScript SDK docs: https://neon.com/docs/reference/typescript-sdk.md
|
|
261
|
-
- Neon API reference: https://neon.com/docs/reference/api-reference
|
|
262
|
-
- Building a platform on Neon: the `neon-for-agent-platforms` skill (`npx skills add neondatabase/neon-for-agent-platforms`) ships runnable `@neon/sdk` scripts for provisioning, branching, snapshots, project transfer, and consumption metrics.
|