Starting the Database
Start the NukeBase server with configuration options by calling startDB() once at the end of your configuration:
Starting the database
// Basic setup - pass the domain object to startDB
const nukebase = addDomain({
authPath: ["users"],
host: "127.0.0.1", // optional
port: 3000 // optional
});
startDB(nukebase);
addDomain Configuration Options:
- authPath: Array - path to user authentication data (e.g.,
["users"]) - host: String (optional) - the IP address to bind to
- Use "127.0.0.1" to accept connections only from the local machine (default)
- Use a specific IP address like "126.23.45.1" to bind to that server address
- Use "0.0.0.0" to accept connections from any IP
- port: Number (optional) - the port to listen on (default: 3000)
Environment variables read by the server:
DOMAIN— public origin used to build magic-link URLs and console output (e.g.https://your-app.nukebase.com).SOCKET— if set, the server listens on this Unix domain socket instead ofhost/port(useful behind nginx/Caddy).TRUST_PROXY— controls whetherx-real-ip/x-forwarded-forheaders are honored when computing the client IP for rate limiting. Trusted by default. Set to"false"or"0"to ignore proxy headers (recommended when not behind a reverse proxy, so clients cannot rotate headers to bypass the login limiter).DB_ALLOW_MISSING_SPLITS— set to"1"to downgrade a missing/corrupt$splitsubdirectory from a fatal startup error to a logged warning. Default is fail-fast so a bad disk state can't silently produce data loss on the next flush.
Important: Call startDB() only once at the end of your server configuration. This function
initializes and starts the database server with all configured domains and settings. Multiple calls to
startDB() can cause resource conflicts and unexpected behavior. Once you've defined all your domains,
middleware, triggers, and functions, finish with a single call to startDB() to launch your server.