Kroxt BaaS is powered by MongoDB. Every document uploaded or fetched from your database is bound to its collection. Crucially, you must create a schema on the collection in the dashboard before you can write or receive documents. Payloads that do not match the defined schema are rejected by the validation middleware.
Inside the Kroxt Console, the Database workspace contains these active tools:
Visualize document counts, indexes, and total storage sizing. The sandbox editor lets you insert, query, update, or remove MongoDB records directly without code.
A visual builder to map keys to strict type definitions (String, Number, Date, Boolean, Array, Object) ensuring schema compliance for all database operations.
// Get reference to the todos collection
const todos = baas.collection("todos");
// Trigger a count query to verify connectivity
const count = await todos.count();
console.log("Total todos:", count);Don't want to use the Kroxt managed database? You can host all of your project's tenant data in your own MongoDB instance instead.
Pass a mongodbUri when initializing the client. The SDK registers the connection with the backend (which connects to your database server-side) and your project switches to external hosting automatically.
import { Kroxt } from "@kroxt/baas-sdk";
export const baas = new Kroxt({
projectId: "6a8204b4875df386fb99058c",
apiKey: "pk_dev_fb8ed3985fb842c560d7bc6fd62f8cd8d3e6f7db65e5a20a",
// Host your project data in your own MongoDB database:
mongodbUri: "mongodb://user:pass@host:27017/yourdb",
});You only need to set it once. After that, the URI is stored (encrypted) on the project server-side, so later SDK inits can omit it and your data still lives in your database.
Open your project's Settings → Database Hosting, paste your connection string, and click Connect. You can revert to the Kroxt managed database anytime with the Revert button.
kroxt_project_<projectId> so multiple projects can share one database safely.