Came here by accident or mistake? Go back to https://ai.lachlanm05.com
Neural Gateway routes AI requests from the internet to a user’s local hardware through a secure WebSocket tunnel. It is composed of:
- Gateway (
server/gateway): Express + WebSocket relay that receives HTTP requests and forwards them to a connected hardware client. - Dashboard (
server/dashboard): Express UI for user auth, client management, and basic usage stats. - Electron client (
client/electron-app): Connects local hardware to the gateway and proxies requests to a local Ollama instance.
Disclaimer: This project is not affiliated with, endorsed by, or supported by any AI platform. It is a general-purpose, free, open-source tool that users may choose to configure with services they already use.
- Internet client sends HTTP requests to the Gateway.
- Gateway forwards the request over a WebSocket tunnel to the Electron client.
- Electron client proxies the request to a local Ollama instance and returns the response.
- Dashboard provides user and client management, and usage stats.
- Node.js (recommended: v18+)
- npm
- Postgres (for the Dashboard/Gateway data store)
- Optional: Ollama running locally on the client machine (default
http://127.0.0.1:11434)
client/electron-app # Electron desktop client
server/gateway # HTTP + WebSocket gateway
server/dashboard # Dashboard UI + auth
server/init_db.js # Postgres schema bootstrap
cd server
npm installcd client/electron-app
npm installThe server uses pg and expects standard Postgres environment variables (or DATABASE_URL). For example:
export PGHOST=localhost
export PGPORT=5432
export PGUSER=neural_gateway
export PGPASSWORD=your_password
export PGDATABASE=neural_gatewayInitialize tables:
node server/init_db.jsPORT_GATEWAY(default8787)CORS_ALLOWED_ORIGINS(comma-separated list; if unset, the Gateway allows any origin)
PORT(default3333)SESSION_SECRET(required for secure sessions)NODE_ENV(productionenables secure cookies)
The dashboard uses Nodemailer to send verification emails. Configure a transporter in server/dashboard/mailer.js before running registration flows.
node server/gateway/server.jsnode server/dashboard/server.jscd client/electron-app
npm run startLocal development note: The Electron app defaults to hosted endpoints. For local development, update the URLs near the top of
client/electron-app/main.js:
DASHBOARD_URLGATEWAY_WSLOCAL_OLLAMA
Gateway requests are routed through:
POST /users/:username/:clientid/*
Include the client API key as a bearer token:
Authorization: Bearer <api_key>
The Gateway will forward the request body to the connected client and return its response.
- Gateway access is protected by API keys and per-client IP tracking.
- Sessions are cookie-based with
SESSION_SECRET(setNODE_ENV=productionfor secure cookies). CORS_ALLOWED_ORIGINSshould be set in production to avoid unwanted browser access.