Skip to content

Settings reference

Runtime configuration lives in the vaultbase_settings table — keyed by string, valued by string. Edited from the admin Settings page; values are cache-invalidated on save.

KeyTypeDefaultNotes
rate_limit.enabled"1"/"0""1"Master switch
rate_limit.rulesJSON array(defaults below)See shape below

rate_limit.rules shape:

[
{ "label": "*:auth", "max": 10, "windowMs": 3000, "audience": "all" },
{ "label": "*:create", "max": 60, "windowMs": 5000, "audience": "all" },
{ "label": "/api/*", "max": 300, "windowMs": 10000, "audience": "all" }
]

label syntax: <path>[:<action>]

  • path — exact (/api/posts), prefix (/api/*), or wildcard (*)
  • actionauth, create, list, view, update, delete
  • audienceall, guest (no token), auth (any user/admin token)
KeyTypeDefault
smtp.enabled"1"/"0""0"
smtp.hoststring
smtp.portstring (int)"587"
smtp.secure"1"/"0""0"
smtp.userstring
smtp.passstring
smtp.fromstring— — e.g. "Acme" <noreply@acme.com>

Test via Settings → SMTP → Send test. The cache TTL is 30 seconds.

KeyTypeDefault
app.urlstring— — base URL of your frontend; used in {{link}}
email.verify.subjectstring"Verify your email"
email.verify.bodystring(multi-line default)
email.reset.subjectstring"Reset your password"
email.reset.bodystring(multi-line default)
email.otp.subjectstring"Your sign-in code"
email.otp.bodystring(multi-line default)

Variables in templates: {{email}}, {{token}}, {{code}} (otp only), {{link}}, {{appUrl}}, {{collection}}. Empty values fall back to the defaults.

KeyDefaultNotes
auth.otp.enabled"0" (off)Magic link / OTP flow. Requires SMTP.
auth.mfa.enabled"1" (on)TOTP enrollment. Disabling blocks new enrollment only — existing users keep working.
auth.anonymous.enabled"0" (off)POST .../anonymous
auth.impersonation.enabled"1" (on)Admin can impersonate users

Disabled features return 422 with a clear message.

For each of google, github, gitlab, facebook, microsoft, discord, twitch, spotify, linkedin, slack, bitbucket, notion, patreon:

KeyType
oauth2.<name>.enabled"1"/"0"
oauth2.<name>.client_idstring
oauth2.<name>.client_secretstring

A provider counts as “enabled” only when all three are set + enabled is "1".

GET /api/admin/settings ← admin auth
PATCH /api/admin/settings { "<key>": "<value>", ... }

PATCH is partial — keys not in the body are left untouched. Settings caches (rate-limit, SMTP) are invalidated on save.

import { getAllSettings, getSetting, setSetting } from "vaultbase/api/settings";
const all = getAllSettings();
const port = parseInt(getSetting("smtp.port", "587"));
setSetting("auth.otp.enabled", "1");

Useful inside hooks/routes via ctx.helpers (which proxies a subset).