GhostAI is a high-performance, parallel-streaming chat environment that leverages the Midnight blockchain for Zero-Knowledge Proofs of Existence. This document outlines the technical requirements, local configuration, and deployment procedures.
Before initializing the GhostAI stack, ensure the following dependencies are installed and configured:
- Node.js: v18.17.0 or higher (v20+ recommended for Next.js Turbopack).
- Docker Desktop: Required to run the local Midnight node, ZK proof server, and Compact compiler container.
- Midnight Lace Wallet: Install the browser extension to interact with the DApp locally. Ensure it is configured to point to the local devnet.
- Git: For repository cloning and version control.
Clone the repository and install the Next.js dependencies:
git clone https://github.com/your-org/ghost-ai.git
cd ghost-ai/ghost-ai-ui
npm installGhostAI utilizes a dynamic multiplexing system for API requests to bypass rate limits during multi-model parallel comparisons. Create a .env.local file in the ghost-ai-ui directory:
touch .env.localPopulate it with the provided OpenRouter API keys. Ensure these keys are never committed to source control.
# OpenRouter Proxy Keys - DO NOT COMMIT
OPENROUTER_API_KEY_1=sk-or-v1-xxxxxx
OPENROUTER_API_KEY_2=sk-or-v1-xxxxxx
OPENROUTER_API_KEY_3=sk-or-v1-xxxxxx
# Application State
NEXT_PUBLIC_ENVIRONMENT=developmentWarning
Key Safety: The .env.local file must remain in your .gitignore. If these keys are exposed, the parallel streaming engine will face immediate 429 Rate Limit floods.
GhostAI requires both the blockchain infrastructure and the frontend client to be running simultaneously.
Navigate to the Midnight local environment directory to spin up the local blockchain ledger and proof server.
cd midnight-local-dev
docker compose up -dVerify that the containers (midnight-node, proof-server) are healthy via Docker Desktop.
Navigate to the smart contract store and compile the Compact circuit.
cd ../hash-store
npm install
npm run compileThis generates the ZK circuit artifacts required by midnightBridge.ts to seal conversation hashes.
Return to the Next.js frontend and start the development server using Turbopack for optimized HMR.
cd ../ghost-ai-ui
npm run devNavigate to http://localhost:3000 to access the GhostAI Landing Environment.
To deploy GhostAI for live hackathon judging, the architecture splits between a static/edge frontend and a robust backend proxy.
- Connect your GitHub repository to Vercel.
- Set the Root Directory to
ghost-ai-ui. - In the Environment Variables panel, map your OpenRouter API keys exactly as they appear in
.env.local:OPENROUTER_API_KEY_1OPENROUTER_API_KEY_2OPENROUTER_API_KEY_3
- Deploy the application. Vercel will automatically route the Next.js API endpoints (
/api/chat/route.ts) to Edge Functions, ensuring minimal latency for the streaming responses.
If Vercel's 10-second serverless timeout becomes a bottleneck for heavy 120B parameter models during Comparison Mode, deploy a standalone proxy:
- Extract
/api/chatto a standalone Node.js/Express server. - Deploy the Express server to Render or Railway.
- Configure the Render/Railway environmental variables with the OpenRouter key multiplexing matrix.
- Update
GhostAiDashboardinpage.tsxto point the stream fetches to your new Render URL instead of the local Next.js route.

