Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

docs: fix deploy workflow to use npm-only approach

diegosouzapw811fb7f9b2e2
diff --git a/.agents/workflows/deploy-vps.md b/.agents/workflows/deploy-vps.md
index e6f8bc466c..f475a4bc8f 100644
--- a/.agents/workflows/deploy-vps.md
+++ b/.agents/workflows/deploy-vps.md
@@ -4,52 +4,73 @@ description: Deploy the latest OmniRoute code to the Akamai VPS (69.164.221.35)
# Deploy to VPS Workflow
-Deploy OmniRoute to the production VPS using Node.js + PM2 (no Docker).
+Deploy OmniRoute to the production VPS using `npm install -g` + PM2.
**VPS:** `69.164.221.35` (Akamai, Ubuntu 24.04, 1GB RAM + 2.5GB swap)
-**App path:** `/opt/omniroute-app`
+**Local VPS:** `192.168.0.15` (same setup)
**Process manager:** PM2 (`omniroute`)
**Port:** `20128`
+> [!IMPORTANT]
+> PM2 runs from the global npm package at `/usr/lib/node_modules/omniroute`.
+> **DO NOT** use git clone or local copies. The `npm install -g` command handles
+> building, publishing, and installing the standalone app in one step.
+
## Steps
-### 1. Push to GitHub
+### 1. Publish to npm
-Ensure all changes are committed and pushed:
+Ensure the version in `package.json` is bumped and the package is published:
```bash
-git push origin main
+npm publish
```
-### 2. SSH into VPS, pull latest code, rebuild, and restart
+### 2. Install on VPS and restart PM2
// turbo-all
```bash
- cd /opt/omniroute-app &&
- git fetch origin &&
- git reset --hard origin/main &&
- export NODE_OPTIONS='--max-old-space-size=1536' &&
- npm install --no-audit --no-fund &&
- npm run build &&
- pm2 restart omniroute &&
- pm2 save &&
- echo '✅ Deploy complete!'
-"
+ssh [email protected] "npm install -g omniroute@latest && pm2 restart omniroute && pm2 save && echo '✅ Deploy complete!'"
+```
+
+For the local VPS:
+
+```bash
+ssh [email protected] "npm install -g omniroute@latest && pm2 restart omniroute && pm2 save && echo '✅ Deploy complete!'"
```
### 3. Verify the deployment
```bash
-ssh [email protected] "pm2 list && curl -s -o /dev/null -w 'HTTP %{http_code}' http://localhost:20128/"
+ssh [email protected] "pm2 list && cat \$(npm root -g)/omniroute/package.json | grep version | head -1 && curl -s -o /dev/null -w 'HTTP %{http_code}' http://localhost:20128/"
```
-Expected: PM2 shows `online`, HTTP returns `307` (redirect to login).
+Expected: PM2 shows `online`, version matches published, HTTP returns `307` (redirect to login).
+
+## How it works
+
+1. `npm publish` builds Next.js standalone + bundles everything into the npm package
+2. `npm install -g omniroute@latest` downloads and installs to `/usr/lib/node_modules/omniroute/`
+3. PM2 is registered to run `npm start` from that directory (cwd: `/usr/lib/node_modules/omniroute`)
+4. `pm2 restart omniroute` picks up the new code immediately
+
+## PM2 Setup (one-time)
+
+If PM2 needs to be reconfigured from scratch:
+
+```bash
+ssh root@<VPS> "
+ cd /usr/lib/node_modules/omniroute &&
+ pm2 start npm --name omniroute -- start -- --port 20128 &&
+ pm2 save &&
+ pm2 startup
+"
+```
## Notes
-- The VPS has only 1GB RAM. `NODE_OPTIONS='--max-old-space-size=1536'` uses swap for the build.
+- The `.env` file is at `/usr/lib/node_modules/omniroute/.env`. Back it up before major npm updates.
- PM2 is configured with `pm2 startup` to auto-restart on reboot.
-- The `.env` file is at `/opt/omniroute-app/.env` (copied from the old Docker setup at `/opt/omniroute/.env`).
- Nginx proxies `omniroute.online` → `localhost:20128`.
+- The VPS has only 1GB RAM — builds happen locally via `npm publish`, not on the VPS.
diff --git a/package-lock.json b/package-lock.json
index c12779e1cb..6c5febd4ea 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "omniroute",
- "version": "2.0.8",
+ "version": "2.0.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "omniroute",
- "version": "2.0.8",
+ "version": "2.0.9",
"hasInstallScript": true,
"license": "MIT",
"workspaces": [