Documentation · Self-hosting
Run the Sepolia workspace
Use Node.js 22.12 or newer to install the locked dependencies, validate the release and start the dedicated workspace.
npm ci
npm run check:release
npm run dev:sepoliaOpen localhost:4318 . Its health response reports sepolia-workspace.
Serve the built release
Use scripts/serve-https-origin.mjs behind HTTPS with NELOSIA_NETWORK=sepolia and NELOSIA_ORIGIN set to your bare app origin. Provide PREVIEW_SIGNING_KEY as a server-only environment variable. The origin hosts the public Sepolia API and the workspace.
Mainnet source configuration
1. Obtain and install the source
The Nelosia source bundle is supplied separately with the project deliverables. Extract that bundle and open its project directory before running these commands.
Use Node.js 22.12 or newer and npm. Run these commands in the Nelosia project directory. Installation needs no wallet secrets. Provider access requirements and verified deployment settings depend on the features you enable.
node --version
npm ci2. Configure a server-only review key
Generate at least 32 random bytes, encoded as a canonical base64 string. This command creates a new .env without overwriting an existing file and prints no key.
node --input-type=module -e "import {randomBytes} from 'node:crypto'; import {writeFileSync} from 'node:fs'; writeFileSync('.env', 'PREVIEW_SIGNING_KEY='+randomBytes(48).toString('base64')+String.fromCharCode(10), {flag:'wx'});"Keep .env out of Git, deployment archives and the client bundle. Never call this variable VITE_PREVIEW_SIGNING_KEY. If a file already exists, preserve the current key; rotating it invalidates existing authenticated reviews and their receipt tokens.
| Variable | Requirement | Purpose |
|---|---|---|
PREVIEW_SIGNING_KEY | required for reviews | Server runtime secret. Base64 encoding of 32–128 random bytes. |
PORT | local optional | Local Worker preview port; default 4317. |
APP_ORIGIN | production app split | The owned HTTPS app-subdomain origin. Local /app remains available without it. |
APP_MODE | app deployment | Set app for a separate app-only Worker whose root loads the noindex workspace. |
SITE_ORIGIN | production website | Owned HTTPS marketing origin for app backlinks and public metadata. |
BALANCE_GUARD_ADDRESS | protected position actions | Verified deployed Nelosia balance-guard contract address; never invent a placeholder deployment. |
BALANCE_GUARD_CLASS_HASH | protected position actions | Expected verified guard class; checked against the configured deployment. |
LENDING_GUARD_ADDRESS | all lending actions | Real reviewed deployed lending-state guard; never use a placeholder address. |
LENDING_GUARD_CLASS_HASH | all lending actions | Expected class hash for the reviewed lending guard, checked on chain at its deployment address. |
NEAR_INTENTS_API_KEY | bridge provider optional | Server-only provider credential when required; public access can be rate-limited. |
BRIDGE_ENABLED | bridge optional | Set false to disable bridge routing on a deployment. |
3. Validate and build
The build renders 18 public routes and bundles local fonts, static assets and the Starknet SDK into one webworker-target fetch module. Run the source checks before building the deployable artifact.
npm test
npm run build4. Start the local Worker
npm run devOpen http://127.0.0.1:4317 . The app is /app and health is /api/health. Rebuild after source edits; the preview reloads the generated Worker artifact.
curl http://127.0.0.1:4317/api/health{
"ok": true,
"product": "Nelosia",
"version": "3.0.0",
"mode": "defi-terminal"
}5. Deploy the same Worker
The entry point is dist/server/index.js, exporting a fetch handler. Bind PREVIEW_SIGNING_KEY only in the hosting runtime. Preserve the registered .openai/hosting.json identity and the owner's intended audience. Source archives must exclude .env and dependency caches.
The public Sepolia app uses a separate HTTPS origin. This Mainnet source configuration requires its own app origin and configuration. Export local journals before changing origins; they do not automatically share storage.
Verified contract configuration
Protected wallet outcomes need the balance guard. All lending actions additionally require the lending-state guard, with verified pool/oracle class pinning and current post-state health/debt/collateral checks. Both guards passed a native Linux build and local integration tests. Verified mainnet deployments remain outstanding. Configure reviewed addresses and class hashes after deployment. Missing or mismatched settings block signing preparation.
Provider and recovery limits
The product uses fixed PublicNode, Vesu, AVNU, Endur, prod-api.ekubo.org and NEAR Intents origins. Ethereum, Base, Arbitrum, OP Mainnet, Polygon and Avalanche use six fixed PublicNode RPC origins for source checks and destination proofs. Endur’s public request indexer is an address-discovery hint for current queue-NFT holders; ownership and eligibility are checked on chain. Arbitrary RPC endpoints and redirects are unavailable. Network changes, source amounts, quote expiry and fee capacity are rechecked before signing readiness.
Starknet activity and EVM bridge journals are browser-local, not cross-device backup. Export before changing origins. Storage or concurrency errors pause new signing requests; returned hashes remain available in a readable in-memory snapshot when persistence fails. Observe pending or unknown attempts before another signature. Imported EVM records do not authorize a new transfer.