@vibecodeapp/backend-sdk
v1.0.1
Published
Backend SDK for Vibecode
Downloads
5,112
Readme
@vibecodeapp/backend-sdk
A unified backend SDK for Vibecode services.
Installation
bun add @vibecodeapp/backend-sdkUsage
import { createVibecodeSDK } from '@vibecodeapp/backend-sdk';
const vibecode = createVibecodeSDK();Features
Storage
Upload, list, and delete files from Vibecode storage buckets.
// Upload a file (max 500MB)
const file = await vibecode.storage.upload(myFile);
// List files with pagination
const { files, totalCount } = await vibecode.storage.list({
limit: 10,
offset: 0,
prefix: 'images/',
});
// Delete a file
await vibecode.storage.delete(file.id);Send transactional emails (OTP verification and welcome emails).
// Send OTP email
await vibecode.email.sendOTP({
to: '[email protected]',
code: 'ABC123',
fromName: 'MyApp',
lang: 'en',
});
// Send welcome email
await vibecode.email.sendWelcome({
to: '[email protected]',
name: 'John',
appName: 'MyApp',
lang: 'en',
});Supported languages: en, es, fr, de, pt, zh, ja
Error Handling
The SDK exports specific error classes for handling failures:
import {
VibecodeError,
StorageError,
EmailError,
RateLimitError,
} from '@vibecodeapp/backend-sdk';
try {
await vibecode.email.sendOTP({ to: '[email protected]', code: '123456' });
} catch (error) {
if (error instanceof RateLimitError) {
// Daily email limit exceeded
} else if (error instanceof EmailError) {
// Other email error
}
}Development
Running Tests
Important: Tests must be run from the office IP address. The backend services are IP-restricted and will reject requests from other locations.
bun testLicense
MIT
