@spacelr/sdk
v0.1.5
Published
TypeScript SDK for the Spacelr API - auth and storage
Downloads
401
Maintainers
Readme
@spacelr/sdk
Note: Spacelr is currently under active development. APIs may change between releases.
TypeScript SDK for the Spacelr API — authentication, storage, database and realtime notifications.
Installation
npm install @spacelr/sdkQuick Start
import { createClient } from '@spacelr/sdk';
const spacelr = createClient({
apiUrl: 'https://api.your-domain.com',
projectId: 'your-project-id',
clientId: 'your-client-id',
});
// Login
const { user } = await spacelr.auth.login({
username: '[email protected]',
password: 'password',
});
// Upload a file
await spacelr.storage.uploadFile({ file, path: '/images/photo.png' });
// Subscribe to database changes
spacelr.db.subscribe('my-collection', {
onChange: (event) => console.log('changed:', event),
});Modules
| Module | Description |
| --- | --- |
| auth | Login, registration, OAuth2 PKCE flow, token management, 2FA |
| storage | File upload (including multipart), download, sharing, quota |
| db | Database operations with realtime subscriptions via WebSocket |
| notifications | Web Push notification subscription management |
Requirements
- Node.js >= 18
- TypeScript >= 5 (recommended)
License
MIT
