Dashboard

Manage your stores

Database API

Manage custom content models and records.

Access a Collection

Access a specific content collection by its slug.

Get Collection Reference
const posts = swat.db.collection('blog-posts');

List Records

List with Filters
const results = await swat.db.collection('blog-posts').list({
    limit: 10,
    offset: 0,
    filter: {
        status: 'published'
    }
});

CRUD Operations

Create, Read, Update, and Delete records in your collections.

Create

Create Record
const newPost = await swat.db.collection('blog-posts').create({
    title: 'Hello World',
    slug: 'hello-world',
    content: 'This is my first post with SwatBloc.'
});

Get by ID

Get Record
const post = await swat.db.collection('blog-posts').get('rec_12345');

Update

Update Record
const updated = await swat.db.collection('blog-posts').update('rec_12345', {
    title: 'Hello SwatBloc (Updated)'
});

Delete

Delete Record
await swat.db.collection('blog-posts').delete('rec_12345');

Schema Management

Programmatically create content models.

Create Content Model
const model = await swat.db.createModel('Authors', 'authors', [
    { name: 'full_name', type: 'text', required: true },
    { name: 'bio', type: 'long_text' },
    { name: 'avatar_url', type: 'url' }
]);