Quick Start
Get your first project up and running in 5 minutes.
1. Create a Project
Log in to the Console and create a new project.
- Click + Create Project
- Enter a project name
- Copy your Project ID from the settings page
2. Generate an API Key
In your project settings, generate an API key:
- Go to Settings → API Keys
- Click Generate New Key
- Copy the full key (you won't see it again)
3. Install the SDK
npm install @baas/js-sdk axios4. Initialize the Client
import BaasClient from '@baas/js-sdk';
const client = new BaasClient({
apiBase: 'http://localhost:3001',
projectId: 'YOUR_PROJECT_ID'
});5. Create Your First Document
async function main() {
// Create a document
const ref = await client.collection('tasks').add({
title: 'My first task',
completed: false,
createdAt: new Date().toISOString()
});
console.log('Created document:', ref.id);
// Query all tasks
const tasks = await client.collection('tasks').list();
console.log('All tasks:', tasks);
}
main();6. Add Real-time Subscriptions
// Subscribe to changes
const unsubscribe = client.collection('tasks').onSnapshot((data) => {
console.log('Tasks updated:', data);
});
// Later: stop listening
unsubscribe();