@vibecodeapp/backend-sdk 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/llms.txt +190 -0
  2. package/package.json +3 -2
package/llms.txt ADDED
@@ -0,0 +1,190 @@
1
+ # @vibecodeapp/backend-sdk
2
+
3
+ > Backend SDK for Vibecode services - Storage and Email APIs
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @vibecodeapp/backend-sdk
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { createVibecodeSDK } from '@vibecodeapp/backend-sdk';
15
+
16
+ const vibecode = createVibecodeSDK();
17
+ ```
18
+
19
+ ## API Reference
20
+
21
+ ### Storage
22
+
23
+ The storage module handles file operations with Vibecode storage buckets.
24
+
25
+ #### `storage.upload(file: File | Blob): Promise<StorageFile>`
26
+
27
+ Upload a file to storage. Maximum file size is 500MB.
28
+
29
+ ```typescript
30
+ const file = new File(['content'], 'example.txt', { type: 'text/plain' });
31
+ const result = await vibecode.storage.upload(file);
32
+ // Returns: { id, url, contentType, sizeBytes, originalFilename, ... }
33
+ ```
34
+
35
+ #### `storage.delete(id: string): Promise<void>`
36
+
37
+ Delete a file by its ID.
38
+
39
+ ```typescript
40
+ await vibecode.storage.delete('file-id-here');
41
+ ```
42
+
43
+ #### `storage.list(options?: ListFilesOptions): Promise<ListFilesResponse>`
44
+
45
+ List files with optional filtering and pagination.
46
+
47
+ ```typescript
48
+ const { files, totalCount } = await vibecode.storage.list({
49
+ limit: 10, // 1-100, default: 50
50
+ offset: 0, // default: 0
51
+ prefix: 'img/', // filter by path prefix
52
+ });
53
+ ```
54
+
55
+ ### Email
56
+
57
+ The email module sends transactional emails via Vibecode's SMTP service.
58
+
59
+ #### `email.sendOTP(options: SendOTPOptions): Promise<void>`
60
+
61
+ Send a one-time password verification email.
62
+
63
+ ```typescript
64
+ await vibecode.email.sendOTP({
65
+ to: 'user@example.com', // required, max 254 chars
66
+ code: 'ABC123', // required, 6-12 alphanumeric chars
67
+ fromName: 'MyApp', // optional, max 50 chars, default: "Notifications"
68
+ lang: 'en', // optional, default: 'en'
69
+ });
70
+ ```
71
+
72
+ #### `email.sendWelcome(options: SendWelcomeOptions): Promise<void>`
73
+
74
+ Send a welcome email to new users.
75
+
76
+ ```typescript
77
+ await vibecode.email.sendWelcome({
78
+ to: 'user@example.com', // required, max 254 chars
79
+ name: 'John', // required, max 50 chars
80
+ appName: 'MyApp', // required, max 50 chars
81
+ fromName: 'Welcome Team', // optional, max 50 chars
82
+ lang: 'en', // optional, default: 'en'
83
+ });
84
+ ```
85
+
86
+ Supported languages: `en`, `es`, `fr`, `de`, `pt`, `zh`, `ja`
87
+
88
+ ## Types
89
+
90
+ ```typescript
91
+ interface StorageFile {
92
+ id: string;
93
+ projectId: string;
94
+ environment: string;
95
+ originalFilename: string;
96
+ storagePath: string;
97
+ contentType: string;
98
+ sizeBytes: number;
99
+ url: string;
100
+ created: string;
101
+ updated: string;
102
+ }
103
+
104
+ interface ListFilesOptions {
105
+ limit?: number; // 1-100, default: 50
106
+ offset?: number; // default: 0
107
+ prefix?: string; // filter by path/filename prefix
108
+ }
109
+
110
+ interface ListFilesResponse {
111
+ files: StorageFile[];
112
+ totalCount: number;
113
+ limit: number;
114
+ offset: number;
115
+ }
116
+
117
+ interface SendOTPOptions {
118
+ to: string;
119
+ code: string;
120
+ fromName?: string;
121
+ lang?: EmailLanguage;
122
+ }
123
+
124
+ interface SendWelcomeOptions {
125
+ to: string;
126
+ name: string;
127
+ appName: string;
128
+ fromName?: string;
129
+ lang?: EmailLanguage;
130
+ }
131
+
132
+ type EmailLanguage = 'en' | 'es' | 'fr' | 'de' | 'pt' | 'zh' | 'ja';
133
+ ```
134
+
135
+ ## Error Handling
136
+
137
+ The SDK exports specific error classes:
138
+
139
+ ```typescript
140
+ import {
141
+ VibecodeError, // Base error class
142
+ StorageError, // Storage operation failures
143
+ EmailError, // Email operation failures
144
+ RateLimitError, // Daily email limit exceeded (100/day)
145
+ } from '@vibecodeapp/backend-sdk';
146
+ ```
147
+
148
+ All errors extend `VibecodeError` and include a `statusCode` property.
149
+
150
+ ```typescript
151
+ try {
152
+ await vibecode.storage.upload(file);
153
+ } catch (error) {
154
+ if (error instanceof StorageError) {
155
+ console.error(`Storage error (${error.statusCode}): ${error.message}`);
156
+ }
157
+ }
158
+
159
+ try {
160
+ await vibecode.email.sendOTP({ to: 'user@example.com', code: '123456' });
161
+ } catch (error) {
162
+ if (error instanceof RateLimitError) {
163
+ // Handle rate limit - 100 emails/day limit reached
164
+ } else if (error instanceof EmailError) {
165
+ // Handle other email errors
166
+ }
167
+ }
168
+ ```
169
+
170
+ ## Direct Module Access
171
+
172
+ You can also import modules directly:
173
+
174
+ ```typescript
175
+ import { Storage, Email } from '@vibecodeapp/backend-sdk';
176
+
177
+ const storage = new Storage();
178
+ const email = new Email();
179
+ ```
180
+
181
+ ## Backend Services
182
+
183
+ - Storage API: https://storage.vibecodeapp.com
184
+ - Email API: https://smtp.vibecodeapp.com
185
+
186
+ ## Notes
187
+
188
+ - Storage uploads are limited to 500MB per file
189
+ - Email sending is rate-limited to 100 emails per day
190
+ - The `to` field in emails supports both `email@example.com` and `Name <email@example.com>` formats
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@vibecodeapp/backend-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Backend SDK for Vibecode",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "files": [
8
- "dist"
8
+ "dist",
9
+ "llms.txt"
9
10
  ],
10
11
  "repository": {
11
12
  "type": "git",