Nexara Connect docs0.1.0

Self-hosting (Enterprise)

Nexara ships as one container with one volume. There is no external database, queue or cache.

Requirements

Build and run with Docker

# Enterprise customers receive the release source or image from us.
docker build --build-arg GIT_SHA=<release> -t nexara .
docker run -d --name nexara --restart unless-stopped -p 8080:8080 \
  -v nexara-data:/data \
  -e MASTER_KEY=... -e OWNER_EMAIL=you@example.com -e OWNER_PASSWORD='...' \
  -e PUBLIC_URL=https://context.example.com \
  -e SIGNUPS=invite -e REQUIRE_TOTP=true -e ALLOWED_HOSTS=context.example.com \
  nexara

The image is multi-stage: the build stage installs dev dependencies and builds server/ with tsc and web/ with Vite; the runtime stage is node:22-bookworm-slim with git and tini, runs as the node user and has a HEALTHCHECK on /healthz. entrypoint.sh creates /data/ws and /data/backups and fails fast if /data is not writable.

Build and run with Coolify

Coolify is one way to run the image; any Docker host with a persistent volume works the same way.

  1. Create an application from the git repository (private repos: a deploy key), build pack Dockerfile, port 8080.
  2. Add a persistent storage mounted at /data.
  3. Set the environment variables below. At minimum MASTER_KEY, PUBLIC_URL, OWNER_EMAIL, OWNER_PASSWORD.
  4. Add the domain, keep the generated sslip.io domain as a fallback until DNS resolves, and deploy.

Coolify injects NODE_ENV=production into the build; the Dockerfile sets NODE_ENV=development in the build stage so dev dependencies are still installed. Coolify passes SOURCE_COMMIT as a build argument (turn on Include Source Commit in Build in the app's General settings if /readyz still says dev); it is not in the runtime environment. The final Dockerfile stage declares ARG GIT_SHA and ARG SOURCE_COMMIT and defaults GIT_SHA to SOURCE_COMMIT before ENV GIT_SHA=${GIT_SHA}, so the running server sees the commit and /readyz reports it as git_sha.

Environment variables

Every variable read by server/src/config.ts:

VariableDefaultMeaning
PORT8080Listen port on 0.0.0.0
DATA_DIR./data (/data in the image)Holds core.db, master.key if generated, models/, and ws/<id>/repo plus ws/<id>/index.db
PUBLIC_URLderived from the requestExternal origin. Used for OAuth metadata, the MCP resource URI and invite links. Set it in production
WORKSPACEmainId of the workspace created for the first owner
OWNER_EMAILnoneFirst boot only, and only while no human exists: creates the owner
OWNER_PASSWORDnonePassword for that owner. Change it in the app afterwards; the variable is ignored once a human exists
MASTER_KEYgenerated into $DATA_DIR/master.keyRoot secret. HKDF derives the token pepper, cookie keys and per-workspace seal keys. Losing it makes sealed secrets unreadable and invalidates every token
SIGNUPSinviteinvite: sign-up only with a workspace invite or a waitlist invite. waitlist: public sign-up only with a waitlist invite link (3 months free); everyone else joins the waitlist. open: anyone can sign up for a 90-day trial. Every public sign-up confirms the email address (link or 6-digit code) before any account or workspace exists
SIGNUP_POW_BITS16Proof-of-work difficulty (leading zero bits) the browser solves before public sign-up and forgot-password. 0 turns it off
WAITLIST_CORS_ORIGINSemptyExtra origins (comma-separated) allowed to call POST /api/v1/waitlist cross-site, for example a local dev site. https://nexara.ac and https://www.nexara.ac are always allowed
WAITLIST_THANKS_URLhttps://nexara.ac/thanks.htmlWhere a plain HTML form post to /api/v1/waitlist is redirected (303)
PLATFORM_ADMINSempty (console off)Comma list of operator emails for the platform admin console at /admin. Matching accounts get platform_role admin at boot; access needs both the list and the role, plus two-step sign-in. Removing an email revokes access at once
AI_PROVIDERempty (Ask off)Who answers "Ask the vault": anthropic, openai (any OpenAI-compatible API: OpenAI, OpenRouter, Kimi, Mistral) or fake (deterministic, for tests). Unset means the Ask screen says "AI not configured" and nothing else changes
AI_API_KEYemptyThe provider key. Never logged, never returned by the API. Required for anthropic and openai
AI_MODELprovider default (claude-sonnet-4-5 / gpt-4o-mini)Default model. The workspace owner can pick another one in Settings; the screen shows the relative cost before switching
AI_BASE_URLthe provider's own APIBase URL for an OpenAI-compatible API or a proxy, https only (http://127.0.0.1 is allowed for a local proxy). Without it, only well-known provider hosts are contacted and redirects are refused
AI_FALLBACK_PROVIDERempty (no fallback)A second provider (anthropic or openai) tried only once AI_PROVIDER's retries are exhausted (it is down or out of quota)
AI_FALLBACK_API_KEYemptyThe fallback provider's key. Same rules as AI_API_KEY: never logged, never returned by the API
AI_FALLBACK_MODELfallback provider defaultModel to use on the fallback provider
AI_FALLBACK_BASE_URLthe fallback provider's own APISame rules as AI_BASE_URL, for the fallback provider
AI_WINDOW_END2026-11-08The last day (UTC, YYYY-MM-DD, inclusive) of an up-front credit window on the AI_PROVIDER account. Until then the window caps below apply; from the next day the monthly caps apply on their own, with no change needed
AI_WINDOW_BUDGET_USD480Spending cap for the whole credit window, estimated from the model price table. Once reached, Ask and Skills answer "The AI budget for this month is used up." until the window ends
AI_DAILY_BUDGET_USD20Spending cap per UTC day during the credit window. Once reached, Ask answers that today's limit is used and starts again at midnight UTC
AI_MONTHLY_BUDGET_USD50Spending cap per calendar month after the credit window. Once reached, Ask and Skills answer "The AI budget for this month is used up." until the next month
AI_AFTER_WINDOW_DAILY_BUDGET_USD3Spending cap per UTC day after the credit window
AI_RUN_MAX_TOKENS60000The most one answer, skill run or meeting summary may use (input and output together). A run stops before the call that could pass it and says what it found so far
REQUIRE_TOTPtrueWorkspace owners must set up two-factor. They get a grace period with reminders, then the app asks for setup before anything else. false turns that off
TOTP_GRACE_DAYS14Days from an owner's first sign-in without two-factor until it is required. 0 requires it straight away. Agents keep working throughout
RECOVERY_TEST_CLOCK_SKEW_MS0Test rigs only. Milliseconds added to the clock the workspace-recovery cooling-off and the founder handover read, so an end-to-end test can walk past the 24 hours and the 7 days. Ignored unless PUBLIC_URL is a loopback address, so it can never shorten a cooling-off on a real site
ALLOWED_HOSTSthe PUBLIC_URL hostComma list of Host names accepted on every route (DNS rebinding guard; others get 421). localhost and 127.0.0.1 are always allowed
OAUTH_EXTRA_REDIRECTSemptyComma list of extra exact OAuth redirect URIs allowed at client registration
EMBEDDINGSonoff uses keyword search only. on loads Xenova/bge-small-en-v1.5 in a worker thread and falls back to keyword search if it cannot load
LIFECYCLE_MODEdryNightly 03:00 UTC job. dry lists archive candidates, apply archives them
ERASUREoffon turns on provable erasure (an Owner or Admin requests, a second one approves, both with step-up; held content is refused). Off: the erasure routes answer 404. Design: docs/design/ERASURE.md
BACKUP_RETENTION_DAYS30How long your backups are kept. Used only in the erasure receipt, which says by when old backups stop holding erased content
LOCK_WAIT_MS30000How long a write waits for the workspace writer lock before it is refused with repo_busy (503) and a Retry-After. Writes to one workspace are serialised, so under heavy writing this is the point at which Nexara tells a client to come back instead of holding its connection. The refused write never runs later
LOCK_QUEUE_MAX64How many writes may wait for one workspace at once. A write arriving when the queue is full is refused straight away with the same repo_busy 503
WEB_DISTweb/distFolder with the built web app. Without it / serves a small status page
APPS_DIRthe repo's apps/ folderFolder of first-party app manifests (<APPS_DIR>/<id>/manifest.json), shown in the Apps gallery. See Apps and triggers
APP_VERSION0.1.0Version reported by /healthz, /readyz and MCP
GIT_SHASOURCE_COMMIT, else devCommit reported by /readyz. The image sets it from the GIT_SHA build argument, else the SOURCE_COMMIT build argument (Coolify)
BACKUP_TOKENnone (token path disabled)Bearer accepted only by GET /api/v1/admin/backup and /backup/status, for automated backups. At least 24 characters, compared in constant time. See Backups and restore
BRIDGE_TICK_MINUTES5How often the bridge scheduler checks for bridges whose interval has elapsed. See Bridges
BRIDGE_FOLDER_ROOTSempty (folder bridges disabled)Comma list of absolute folders a folder bridge may read below, for example /srv/notes,/opt/data/context/projects. Symlinks are resolved before the check
RESEND_API_KEYempty (mail recorded, not sent)Resend API key for outbound email: sign-up verification, password reset, waitlist invites, workspace notices
MAIL_FROMNexara Connect <noreply@nexara.ac>Sender for outbound email; the domain must be verified in Resend
SUPPORT_EMAILsupport@nexara.acWhere "Book a free setup call" and the help links in the app point. Must be a plain address; anything else falls back to the default
MAIL_IN_DOMAINempty (mail-in disabled)Domain of the secret mail-in addresses, for example in.nexara.ac. Its MX must point at your inbound provider. See Email-in
MAIL_IN_RESEND_WEBHOOK_SECRETemptyResend webhook signing secret (whsec_...) for POST /api/v1/mail-in/resend
MAIL_IN_RESEND_API_KEYemptyResend API key able to read received emails (webhooks carry metadata only). Both Resend variables are needed to enable the Resend adapter
MAIL_IN_POSTMARK_TOKENemptyPassword Postmark sends as Basic auth on POST /api/v1/mail-in/postmark (at least 24 characters; shorter disables Postmark)
GDRIVE_SERVICE_ACCOUNTemptyGoogle service account key for gdrive bridges: the JSON itself or a path to the JSON file. Share the Drive folders with the service account's email. With GDRIVE_SUBJECT set (Workspace domain-wide delegation) it acts as that user
GDRIVE_CLIENT_ID, GDRIVE_CLIENT_SECRET, GDRIVE_REFRESH_TOKENemptyAlternative to a service account: an OAuth client from your own Google Cloud project plus a refresh token granted the drive.readonly scope. With neither set, gdrive bridges cannot be created or run
STRIPE_SECRET_KEYempty (billing off)Stripe secret key. Billing needs all four Stripe variables; without them billing endpoints answer billing_not_configured and everything else works
STRIPE_WEBHOOK_SECRETemptySigning secret of the Stripe webhook endpoint https://<host>/api/v1/billing/webhook (events: checkout.session.completed, customer.subscription.*, invoice.paid, invoice.payment_failed)
STRIPE_PRICE_TEAM_MONTHLYemptyStripe price id of Team billed monthly (per seat)
STRIPE_PRICE_TEAM_ANNUALemptyStripe price id of Team billed yearly (per seat)
NOTION_TOKENemptyNotion internal integration token (read content only), server-wide fallback for notion bridges when no token is stored for the workspace
GOOGLE_CLIENT_IDempty (Gmail and Calendar off)OAuth client id of a Google Cloud "Web application" client for Connections (Gmail, Google Calendar). Add https://<host>/api/v1/connections/callback as an authorised redirect URI. Scopes asked: gmail.readonly, gmail.compose, calendar.events, calendar.calendars.readonly. See Connect Gmail and Calendar
GOOGLE_CLIENT_SECRETemptyIts client secret. Both must be set, or the app shows "Ask your admin to enable Gmail"
SLACK_CLIENT_IDempty (Slack off)Slack app client id for Connections. Redirect URL https://<host>/api/v1/connections/callback; bot scopes channels:read, channels:history, chat:write
SLACK_CLIENT_SECRETemptyIts client secret
GITHUB_CLIENT_IDempty (GitHub off)GitHub OAuth app client id for Connections (scope repo). Callback URL https://<host>/api/v1/connections/callback
GITHUB_CLIENT_SECRETemptyIts client secret
TRUST_PROXYNODE_ENV=productionTrust X-Forwarded-* from the rightmost hop only (H3). Set false to disable on an untrusted network
TRUSTED_PROXIESloopback and private rangesComma list of IPs or CIDRs (for example 10.0.1.0/24) whose X-Forwarded-* headers are believed when TRUST_PROXY is on. A request from any other peer uses the socket address, so a client that reaches the container directly cannot set its own IP. Set this to your proxy's address if the container has a public interface
AUDIT_SIGNING_KEYHKDF from MASTER_KEYKey for signed audit anchors: an Ed25519 private key in PEM (openssl genpkey -algorithm ed25519), or any secret a key is derived from. Set it to keep the anchor key separate from MASTER_KEY
AUDIT_ANCHOR_MINUTES60How often the audit head is signed (skipped when nothing changed). Anchors are also written at startup, shutdown and on every backup
FCM_PROJECT_IDempty (Android push off)Firebase project id for push to the Nexara Mobile app on Android (FCM HTTP v1). Needed together with FCM_CLIENT_EMAIL and FCM_PRIVATE_KEY; without all three the phone falls back to polling its inbox
FCM_CLIENT_EMAILemptyClient email of the Firebase service account
FCM_PRIVATE_KEYemptyPrivate key (PEM) of the Firebase service account
APNS_KEY_IDempty (iOS push off)Key id of an Apple Push token-auth key (a .p8 key from your Apple Developer account). Needed together with APNS_TEAM_ID, APNS_PRIVATE_KEY and APNS_BUNDLE_ID; without all four the phone falls back to polling its inbox
APNS_TEAM_IDemptyYour Apple Developer team id
APNS_PRIVATE_KEYemptyThe .p8 private key itself (PEM)
APNS_BUNDLE_IDemptyNexara Mobile's iOS bundle id, used as the APNs topic
APNS_PRODUCTIONfalse (sandbox gateway)Set true once the iOS build is signed for the App Store, to send through Apple's production APNs gateway instead of the sandbox

The spending caps above are never off: an empty or invalid value uses the default. They apply to the server's own AI_PROVIDER key only. On top of them every workspace has its plan's monthly AI allowance, of which it may use at most a tenth in one day, and every member has a daily limit (40 questions and a matching amount of AI work by default, whichever comes first) that an owner can lower for a person in Settings but never raise. At 50% and 80% of the window or monthly cap, and whenever a daily limit is reached, the platform audit records it and the addresses in PLATFORM_ADMINS get an email. Owners see the server figures in Settings. A workspace's own AI key (bring your own key) never counts toward any of these limits and is never blocked by them

Recommended production values: PUBLIC_URL=https://<your host>, an explicit MASTER_KEY, and optionally a separate AUDIT_SIGNING_KEY. SIGNUPS=invite and REQUIRE_TOTP=true are the defaults.

The volume

/data/core.db              identity, grants, tokens, sessions, proposals, threads, audit (NOT rebuildable)
/data/audit-anchors.jsonl  signed audit-head anchors, append-only (NOT rebuildable; see Audit anchors)
/data/master.key           only if MASTER_KEY was not set
/data/ws/<id>/repo/        the workspace git repository (the content)
/data/ws/<id>/index.db     search index (rebuildable with npm run reindex)
/data/models/              downloaded embedding model
/data/backups/             last-backup.json (backup status); restore.sh --force moves replaced data here

Backups and restore

core.db (accounts, grants, tokens, proposals, threads, audit) is not rebuildable, and the /data volume is only visible to the container. GET /api/v1/admin/backup returns a consistent disaster-recovery archive while the server keeps running.

What is in the archive

A gzip tar named nexara-backup-<utc timestamp>-<git_sha>.tar.gz:

MemberWhat
core.dbSnapshot taken with the SQLite online backup API, consistent while writes continue
ws/<id>.bundlegit bundle create --all of each workspace repository, taken under the writer lock: full history, every branch and tag
audit-anchors.jsonlEvery signed audit anchor up to this backup. A fresh anchor is signed just before the snapshot, so the archive proves the state of the audit log at backup time
audit-anchor.pubThe anchor public key (base64url), to verify the archive off the host with verify-audit --public-key
manifest.jsonFormat version, app version, git_sha, created_at, workspaces with their HEAD, the anchor signed for this backup (audit_anchor), byte size and sha256 of every member

Not in the archive: ws/<id>/index.db and embeddings (rebuilt from git at boot), models/, environment variables, MASTER_KEY and master.key.

MASTER_KEY warning. Sealed secret blocks inside the git bundles, token hashes and the index keys are all derived from MASTER_KEY. The archive never contains it. Without the same key, sealed secrets in a backup are unrecoverable and every agent key and session is invalid. Keep MASTER_KEY separately from the backups (a password manager, not the same bucket). If you run without MASTER_KEY, copy $DATA_DIR/master.key out of the volume once and store it the same way.

Taking a backup

Two ways to authenticate, both only on /api/v1/admin/backup and /api/v1/admin/backup/status:

curl -fsS -H "Authorization: Bearer $BACKUP_TOKEN" -OJ https://app.example.com/api/v1/admin/backup
curl -fsS -H "Authorization: Bearer $BACKUP_TOKEN" https://app.example.com/api/v1/admin/backup/status
# {"ok":true,"last_backup_at":"...","bytes":123456,"sha256":"...","filename":"...","via":"backup_token","fresh_within_hours":36}

The archive is built in a temp directory under the OS temp dir and deleted after it has been streamed; the response carries X-Backup-Sha256. One backup per 5 minutes per instance: a second request gets 429 with Retry-After. Every backup is written to the audit log (backup.create, with size, sha256 and requester). status.ok is false when no backup was taken in the last 36 hours: point your monitoring at it. Run the curl above from a daily cron job off the host and keep several generations.

Restore (offline)

Restore is not an endpoint. scripts/restore.sh runs inside the image (it is copied to /app/scripts/restore.sh; node, git and tar are present), with the server stopped:

docker run --rm -v nexara-data:/data -v "$PWD":/in nexara \
  bash /app/scripts/restore.sh /in/nexara-backup-20260930T030000Z-abc1234.tar.gz /data

It verifies every member against the sha256 and size in manifest.json (and refuses unknown members), refuses a target that already has core.db unless --force (the old core.db and workspace folders are then moved to <target>/backups/pre-restore-<utc>/, never deleted), restores core.db and audit-anchors.jsonl, recreates each workspace with git clone <bundle> repo plus every branch and tag, checks HEAD matches the manifest, and leaves no index.db, so the index is rebuilt from git at boot. It prints each step. Then start the server with the same MASTER_KEY and check GET /readyz shows the expected node count.

Bridges

A bridge pulls content from somewhere else into a Project on a schedule. It is configured per workspace by the owner (web session) or an agent key with a workspace-wide admin grant, through /api/v1/admin/bridges (see the REST reference). There is no web UI yet.

Every BRIDGE_TICK_MINUTES (default 5) the server runs each enabled bridge whose interval_minutes (default 60) has elapsed since its last run. A run goes through the same code as POST /api/v1/import: one commit under the writer lock, pages matched by frontmatter id then path so re-runs are idempotent, source: bridge/<name>/... stamped in the frontmatter. One bridge failing is recorded (last_status: error, last_error, a row in its run history) and the others still run; the server never stops for it. Every run is audited as bridge.sync with its counts; create, change, delete and forced runs are audited as bridge.create, bridge.update, bridge.delete, bridge.run.

Types

Drive credentials are stored per workspace with PUT /api/v1/admin/bridges/credentials/gdrive (body {kind: "oauth", client_id, client_secret, refresh_token} or {kind: "service_account", service_account: <key JSON>, subject?}). They are sealed with AES-256-GCM under a key derived from MASTER_KEY and the workspace, are write-only (no route returns them; GET .../credentials shows only kind and when they were set) and are scrubbed from every run error, log line and audit entry. The GDRIVE_* environment variables are a server-wide fallback. The bridge config itself refuses any key except folder_id and recursive. Grant only the https://www.googleapis.com/auth/drive.readonly scope: a token that reports any other scope is refused.

curl -X POST https://app.example.com/api/v1/admin/bridges \
  -H "Authorization: Bearer $NEXARA_KEY" -H 'content-type: application/json' \
  -d '{"name":"projects","type":"folder","config":{"path":"/opt/data/context/projects"},"target_space":"hafez","mode":"dry"}'
curl -X POST https://app.example.com/api/v1/admin/bridges/<id>/run -H "Authorization: Bearer $NEXARA_KEY"
curl -X PATCH https://app.example.com/api/v1/admin/bridges/<id> -H "Authorization: Bearer $NEXARA_KEY" \
  -H 'content-type: application/json' -d '{"mode":"apply"}'

Dry mode

mode: dry runs the full plan (what would be created, updated, unchanged or skipped) and records it in the run history, but writes nothing: no commit, no index change, and the cursor does not move, so the first apply run after it imports everything the dry run reported. Create new bridges in dry, check GET /api/v1/admin/bridges/<id>, then PATCH to apply. POST .../run?mode=dry does a one-off dry run of an apply bridge.

Security notes

Webhooks

Outbound webhooks need no configuration: the server delivers due events every 15 seconds (and shortly after each new event). A note filed by email-in is a node.written event with change: "mailed" (capture-key notes use "captured"). Receivers must be reachable over https at a public address. Register them with POST /api/v1/admin/webhooks (see the REST reference) and verify Nexara-Signature as described under Security. Finished deliveries are pruned after 30 days by the nightly job.

Governance alerts

Team and above, a running trial, and legacy self-hosted workspaces can subscribe existing webhooks to governance alerts in Settings > Connections > Webhooks. Choose Slack format for a Slack incoming-webhook URL. Owners and admins can opt into personal email batches using the existing mail provider configuration. No additional environment variables or schema migration are needed; preferences use core metadata and webhook deliveries use the existing durable queue. See Governance alerts for payload privacy and timing.

Upgrade

  1. Back up (GET /api/v1/admin/backup, above).
  2. Pull the new code and rebuild the image, or redeploy in Coolify.
  3. Start it. Numbered core.db migrations in server/src/db.ts run at boot, and each workspace index is re-synced from git (hash-incremental) when the workspace opens.
  4. Check GET /readyz shows the new git_sha, then run scripts/smoke.sh <url> <email> <password>.

Rollback: redeploy the previous commit. The content repository is forward compatible (plain markdown), but restore core.db from the backup if the newer version changed its schema.

Maintenance commands

Run inside the container (docker exec nexara ...) or from a checkout with the same DATA_DIR:

CommandWhat it does
node server/dist/cli/import.js <folder> --space <name>Import a folder of markdown (npm run import -- in a checkout)
node server/dist/cli/reindex.jsRebuild every workspace index from git
node server/dist/cli/verify-audit.jsVerify the audit hash chain and its signed anchors (see Audit anchors)

Audit anchors

The audit log in core.db is hash-chained, and the server signs its head with an Ed25519 key at startup, hourly (AUDIT_ANCHOR_MINUTES), on graceful shutdown and before every backup. Anchors are appended to /data/audit-anchors.jsonl, outside core.db, and copied into each backup. Someone who rewrites the audit table and recomputes every hash cannot produce a matching signature without the key, so verification catches it.

# inside the container (uses MASTER_KEY or AUDIT_SIGNING_KEY from the environment)
node server/dist/cli/verify-audit.js
# {"ok":true,"rows":1834,"anchors":42,"latest_anchor":{"seq":1830,...},"rows_after_anchor":4}

# off the host, against an extracted backup, with only the public key
node server/dist/cli/verify-audit.js --db x/core.db --anchors x/audit-anchors.jsonl --public-key x/audit-anchor.pub

# also enforce the anchors of an older backup (catches anchors deleted from the live file)
node server/dist/cli/verify-audit.js --anchors /data/audit-anchors.jsonl --anchors old/audit-anchors.jsonl

Exit code 1 means the chain was edited, truncated below an anchored row, or rewritten and recomputed, or an anchor was forged, edited or removed, or there is no anchor at all (pass --allow-unanchored for a brand new instance). Owners can read the latest anchor and the public key at GET /api/v1/audit/anchor; authenticated /readyz shows it as audit_anchor.

Notes:

Email-in

Email-in files mail into a Project. It reuses the capture key model: each mail route is a secret address <token>@<MAIL_IN_DOMAIN> bound to one Project, one folder (default inbox/mail) and a sensitivity. The token (160 random bits) is the credential: it is shown once, stored only as a peppered HMAC, revocable, and dies on lockdown or when its creator stops being an owner (or an admin agent). Routes are managed at /api/v1/admin/mail-routes.

Mail arrives through an inbound-email provider that POSTs a webhook to /api/v1/mail-in/<provider>:

Each webhook id (Resend) or message id (Postmark) is accepted once; a replay answers {ok: true, duplicate: true} and files nothing. Each message becomes one page: subject as title, type: email, source: mail-in/<route name>, mail_from, sensitivity forced to the route level. The text body is used, or the HTML body reduced to plain text. All mail text is neutralised: < is escaped, so no HTML renders and no <!-- secret --> style marker or sealed block can be forged; frontmatter-looking lines are escaped; invisible characters are dropped. Attachments up to 32 KB of .txt, .md, .csv or .json with a matching text content type are inlined in a fenced block; everything else is listed by name and size only. The secret scanner applies; a refused message is acknowledged and recorded, not retried.

Optional allowed_senders (addresses or @domain) is a convenience filter, not access control. It matches the message's From header, which the sender writes and can forge freely; Nexara does not check SPF, DKIM or DMARC (neither Resend nor Postmark gives a verdict field that can be trusted without parsing forgeable headers). Use it to cut down noise, such as newsletters sent to a shared address. Treat the route address as the secret: anyone who knows the token can file into the route under any From. If an address leaks, revoke the route and create a new one (DELETE /api/v1/admin/mail-routes/:id). Limits: 30 messages per minute per route, 10 per sender, 10 MB per webhook; over a limit the webhook gets 429 with Retry-After and the provider retries later. The webhook reply is {ok: true} whatever was filed, so it reveals no addresses. Audit (mail.in, deny.mail_in) and the delivery log hold ids and status codes only, never bodies, subjects, senders or tokens.

Setup outline: pick a subdomain, point its MX at the provider, add the webhook in the provider pointing at /api/v1/mail-in/<provider>, set the variables above, restart, then create a route:

curl -X POST https://app.example.com/api/v1/admin/mail-routes -H "Authorization: Bearer ***" \
  -H 'content-type: application/json' -d '{"name":"notes","space":"hafez","allowed_senders":["@example.com"]}'