NukeBase

NukeBase Documentation

NukeBase documentation — the real-time database with server-side triggers, callables, security rules, built-in authentication, and a WebSocket client SDK.

Server-Side API

Server Setup Provision a NukeBase project, set up local development, and configure server/app.js with the core API exports. Starting the Database Start the NukeBase server with startDB() and addDomain — host, port, authPath, and the environment variables the server reads. Serving Static Files Serve frontend files and assets with app.serveStatic, including auth callbacks, path-traversal protection, and caching behavior. CRUD Operations Create, read, update and delete data in NukeBase with set, get, update and remove — auto-creation, durable writes, and the server-side data export. Query Operations Search NukeBase collections with query() — the safe expression engine, operators, childPath for nested data, and numeric childPath array handling. Security Rules Control database access with NukeBase read, write and validate rules — path patterns, wildcards, cascading evaluation, and array validation. Auth Context The admin auth context object available in NukeBase security rules, callables, connection triggers, and POST handlers. Database Triggers Run server code in response to database changes with addDbTrigger — event types, path wildcards, and the context object. Callable Functions Define server-side functions clients invoke over WebSocket with addCallable — the data, admin and sessionId arguments, and sync or async return values. Connection Triggers Run server code when a client connects or disconnects using addConnectionTrigger with open and close handlers, the admin auth context, and the session ID. Custom POST Endpoints Define POST routes in NukeBase with postWithBody and raw post handlers — body parsing, file uploads, and authentication. External Databases Connect your server to another NukeBase instance with serversdk.js for microservices and server-to-server sync. Storage & Backups How NukeBase stores data on disk — the $split tree, atomic writes, crash safety, and automatic daily backups. Complete Server Example A minimal but complete NukeBase server setup with domain config, static files, triggers, callables, and connection tracking.

Client-Side API