Browse documentation
Deploying on Vercel
Runtime and database
Import the private cup2222/Trident-Protocol repository into Vercel. Select Next.js, use the repository root, Node.js 24.x, npm ci, npm run build, and the default Next.js output. Do not use a static export.
Set DATABASE_URL to the connection string of your persistent PostgreSQL database (for example Neon or Supabase). Keep the provider's SSL parameters. A pooled PostgreSQL URL is supported. The server lazily creates versioned application tables in the dedicated trident schema on its first database request. The database role must be allowed to create this schema and its tables. Existing rows and unrelated schemas are not removed. Schema initialization is serialized across instances.
Existing Turso installations can continue using TURSO_DATABASE_URL and TURSO_AUTH_TOKEN, or put the libSQL URL in DATABASE_URL with the same auth token. DATABASE_URL takes precedence; lowercase database_url is also accepted. Changing database providers does not copy an existing ledger automatically: migrate and reconcile balances before moving funded traffic.
All deployments serving one production application must share the production database; use a separate database for previews. Credentials stay server-side. Vercel refuses missing remote configuration or a file: URL. Local development without a remote URL uses the existing SQLite file.
PostgreSQL accounting transactions use a transaction-scoped advisory lock shared by all app instances, so concurrent reservations cannot bypass global or community budgets. Operations use one checked-out connection and are never automatically replayed after an ambiguous commit. Unique receipt constraints prevent duplicate deposits. libSQL uses write transactions for the same accounting boundary.
After setting environment variables, redeploy. GET /api/health/database returns { "ready": true, "driver": "postgres" } (or libsql) once tables are initialized and a query succeeds. It reveals no URL, host, username or credential. Check /api/analytics, /api/communities and /api/treasury too. A connected database does not fund OpenRouter or activate community balances.
Required environment variables
| Variable | Value | Visibility |
|---|---|---|
APP_ORIGIN | Exact HTTPS origin override; production defaults to https://www.tridentprotocol.fun | Server |
DATABASE_URL | Persistent PostgreSQL or libSQL connection string | Secret |
TURSO_DATABASE_URL / TURSO_AUTH_TOKEN | Alternative for existing Turso deployments | Secret |
OPENROUTER_API_KEY | Inference key for a dedicated funded account | Secret |
OPENROUTER_MANAGEMENT_KEY | Optional separate credit-reading credential for the same account | Secret |
PUBLIC_TREASURY_ENABLED | false to hide aggregate account credits; published by default | Server flag |
COMMUNITY_COMPUTE_ENABLED | false to pause; otherwise enabled with the inference key and funded allowance | Server flag |
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID | Reown project ID for WalletConnect QR | Public |
SOLANA_RPC_URL | Reliable Solana mainnet RPC | Server; may contain a secret |
PONS_RPC_URL | Reliable Robinhood Chain mainnet RPC | Server; may contain a secret |
ROBINHOOD_RPC_URL | Same Robinhood mainnet RPC for transaction verification | Server; may contain a secret |
The server first uses a separately configured management key for account-credit checks, otherwise it uses the inference key. The deployed inference key has been verified to read /api/v1/credits. If OpenRouter rejects credit access for a different key, provide a management key for the same dedicated account. The app never returns either key. Users receive independently generated Trident bearer keys after wallet signature, terms acceptance and confirmed token eligibility.
Enabling deposits
Set SOLANA_TREASURY_ADDRESS and PONS_TREASURY_ADDRESS to receiving addresses controlled by the operator. Set COMMUNITY_FUNDING_ENABLED=true only when conversion, provider top-up and allocation are operational. The server does not receive private signing keys and does not perform treasury conversion automatically. Confirmed deposits remain pending until the allocation command is run.
Use the complete .env.example for rate limits, payment limits, quote buffer, featured token and support settings. Keep COMPUTE_ENABLED=false for community-only operation. Public mint and pool-creation routes remain retired.
WalletConnect and domains
Create a Reown project and allowlist the deployed origin. Set its public project ID before building; changing a NEXT_PUBLIC_ variable requires a rebuild. The QR flow supports compatible EVM wallets on Robinhood Chain, chain ID 4663. Solana uses installed Phantom, Solflare or a compatible injected wallet. A generic wallet's presence does not prove support for a particular chain.
Register the correct custom domain and set APP_ORIGIN to it. Authentication messages bind that origin; mutation requests from other origins are rejected. Preview deployments need their own exact origin and isolated database. Do not share production signing sessions or funding ledgers with previews.
Holder access
The public product is TRIDENT holder access. No registration or per-community allocation is required. The server initializes its built-in access policy automatically. Holders connect their wallet, accept terms and create a key at /keys. The live OpenRouter account credits back requests directly.
The default holding threshold is 10,000 TRIDENT. TRIDENT_MIN_HOLDING is an optional override. Community-named accounting tables and legacy administration commands remain for compatibility; they are not a required setup flow. Do not direct holders to register or deposit.
Production operations
Use one primary database region close to your Vercel functions. Configure database backups and test restoration. Monitor pending and review requests; investigate provider billing before releasing reservations. Do not rotate an account to a different provider account while obligations remain without reconciling the ledger and historical observations.
The treasury page refreshes when viewed. Five-minute treasury observations and hourly model observations are collected on real reads; there is no scheduled job or fabricated historical backfill. If continuous observation is needed, arrange a monitor to request the public endpoints within sensible rate limits.
Database readiness and provider readiness are separate. Mobile QR pairing and paid inference require their own credentials and funded allowances. Check the verification record for the scope of the latest completed tests.
Public catalogue and module compatibility
The homepage ships with ten dated starter-model observations, and /api/models fetches the complete public OpenRouter catalogue independently of wallet SDK initialization. Model discovery does not require OpenRouter credentials or a configured ledger. Wallets, treasury, funding, history persistence and inference still require the relevant environment variables above.
The npm override for rpc-websockets > uuid keeps UUID 11.1.0 for its CommonJS entry point. UUID 12 and newer removed CommonJS support, while the resolved websocket SDK calls require('uuid'). Do not remove this override without verifying the serverless runtime. The test suite and HTTP smoke server disable experimental CommonJS-to-ESM interoperability to reproduce the production restriction that originally crashed /api/models, /api/status and wallet routes.
Project token link
lib/project-token.ts contains the supplied TRIDENT address and exact external link. /token, the homepage and footer expose these details. The configured Alchemy RPC now verifies this token on Robinhood Chain (4663). The profile links to its Pons market and displays observed prices with source labels. Contract identity verification does not activate a holdings gate or independently verify indexed prices.
Checking configured integrations
GET /api/health/integrations checks the database, the inference key via OpenRouter's read-only /api/v1/key endpoint, credit-read permissions, and the configured Robinhood RPC's chain ID and featured ERC-20 metadata. Results are cached for one minute and never return credentials, key labels or account identifiers. These checks do not submit chain transactions or consume paid inference.
OPENROUTER_API_KEY authenticates inference and is also used for account-credit reads when accepted by OpenRouter. Its documentation specifies management access for /api/v1/credits; actual endpoint permission is verified instead of inferred from the key's variable name. If credit reads are rejected, add OPENROUTER_MANAGEMENT_KEY separately. A per-key spending cap is not an account credit balance. Holder inference requires verified holdings and available shared provider credits. No separate holder allocation is required.
With a configured PONS_RPC_URL or ROBINHOOD_RPC_URL, featured-token reads now prefer confirmed RPC data unless FEATURED_DATA_SOURCE=pons-indexed explicitly selects the indexer. A custom token address is treated as the project token unless FEATURED_TOKEN_IS_TEST=true explicitly labels it a test. Token metadata verification does not prove that a token is registered with the Pons factory; unsupported pools cannot be priced through that factory adapter.