BuzzCloud Nimbus

A backend for your site,
in one script tag.

A database that updates live, sign-in for your visitors, and file storage — all on BuzzCloud. Create a project, paste two lines into your page, and start saving data.

Create a projectRead the docs

Database

Collections of JSON documents with queries, and listeners that update the moment data changes.

Sign-in

Email and password accounts for your visitors, or one-tap Sign in with BuzzCloud.

Storage

Upload images and files from the browser and get a link you can use anywhere.

Quickstart

Open Nimbus in your dashboard, create a project and copy its key. Then add this to any page:

<script src="https://buzzcloud.win/nimbus/sdk.js"></script>
<script>
  const app = Nimbus.init({ key: 'nk_your_project_key' });
  const db = app.db();

  db.collection('messages').add({ text: 'Hello!', at: Nimbus.serverTimestamp() });
</script>
The project key is public — it’s meant to be in your page. What people can read and write is controlled by your project’s security rules.

Database

Data lives in collections of documents. A document is a JSON object up to 256 KB with an ID. Subcollections hang off documents: rooms/lobby/messages.

// add with a generated ID
const ref = await db.collection('posts').add({ title: 'Hi', likes: 0 });

// write with your own ID (replaces, or merges with { merge: true })
await db.doc('profiles/ada').set({ name: 'Ada' });
await db.doc('profiles/ada').set({ bio: 'Engineer' }, { merge: true });

// change some fields
await db.doc('posts/' + ref.id).update({ likes: Nimbus.increment(1), 'meta.edited': true });

// read
const snap = await db.doc('profiles/ada').get();
if (snap.exists) console.log(snap.data());

// query
const top = await db.collection('posts').where('likes', '>=', 10).orderBy('likes', 'desc').limit(20).get();
top.forEach(d => console.log(d.id, d.data()));

// delete
await db.doc('posts/' + ref.id).delete();

Query operators

== != < <= > >= in not-in array-contains. Order by any field, or by __created, __updated or __id. Up to 500 results per query; use .offset(n) to page.

Special values

ValueDoes
Nimbus.serverTimestamp()The server’s time in milliseconds
Nimbus.increment(n)Adds n to a number (atomic)
Nimbus.arrayUnion(...v)Adds items to an array if missing
Nimbus.arrayRemove(...v)Removes items from an array
Nimbus.deleteField()Removes a field in update / merge

Batches

const b = db.batch();
b.set(db.doc('scores/ada'), { points: 10 });
b.delete(db.doc('scores/bob'));
await b.commit(); // all or nothing, up to 100 writes

Live updates

Listen to a document or a query. Your callback runs right away and again whenever anything changes — from any visitor.

const stop = db.collection('messages').orderBy('at').limit(100).onSnapshot(snap => {
  list.innerHTML = snap.docs.map(d => `<li>${d.data().text}</li>`).join('');
}, err => console.error(err));

// later
stop();

Sign-in

Each project has its own users. Turn sign-in methods on or off in the console.

const auth = app.auth();

auth.onAuthChange(user => {
  console.log(user ? 'Signed in as ' + (user.name || user.email) : 'Signed out');
});

await auth.signUp('[email protected]', 'a long password', 'Ada');
await auth.signIn('[email protected]', 'a long password');
await auth.signInWithBuzzCloud();   // opens a small window
await auth.signOut();

auth.currentUser;                   // { uid, email, name, provider } or null

Also: auth.updateProfile({ name }), auth.changePassword(current, next), auth.deleteAccount().

Storage

const storage = app.storage();

const file = input.files[0];
const up = await storage.upload('avatars/' + auth.currentUser.uid + '.png', file);
img.src = up.url;                   // a permanent link

const files = await storage.list('avatars/');
await storage.delete('avatars/old.png');
Images, audio, video, PDFs and plain text open in the browser. Other file types download. Files are limited to 25 MB each.

Security rules

Rules decide who can read and write. Edit them in the console — start from a preset and adjust. A rule is true, false, or an expression.

{
  "database": {
    "messages":              { "read": true, "create": "auth != null", "update": "auth.uid == owner", "delete": "auth.uid == owner" },
    "rooms/{room}/messages": { "read": "auth != null", "write": "auth != null" },
    "*":                     { "read": false, "write": false }
  },
  "storage": { "read": true, "write": "auth != null" }
}
In rulesMeans
authThe signed-in visitor (auth.uid, auth.email, auth.name), or null
ownerThe uid of whoever created the document or file
docThe document as stored now (null when creating)
dataThe document as it would be after the write
id, {room}The document ID, and any {names} from the collection pattern
path, size, contentTypeStorage only: the file being written
nowCurrent time in milliseconds

Operators: == != < <= > >= in ! && || and parentheses; .length works on strings and arrays. write covers create, update and delete. If no rule matches, the answer is no. Queries quietly leave out documents a visitor isn’t allowed to read.

Example: "create": "auth != null && data.text.length <= 500"

Limits

Per project
Documents50,000
Document size256 KB
Storage500 MB, files up to 25 MB
Visitor accounts20,000
Live listeners100 per browser tab
Projects10 per BuzzCloud account

Nimbus follows the BuzzCloud Terms and Acceptable Use Policy.