Skip to content

Commit 81230d1

Browse files
committed
feat(examples): add vps-web-portal React application
1 parent 7317ce2 commit 81230d1

25 files changed

Lines changed: 6160 additions & 0 deletions

examples/vps-web-portal/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

examples/vps-web-portal/README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# VPS Web Portal (Tandem Engine Examples)
2+
3+
This project contains a highly-polished, multi-page showcase that connects directly to the `tandem-engine` running as a headless server on a Linux VPS. It provides a secure UI wrapper and a Node/Express backend that handles reverse-proxying and authentication, safeguarding the engine's open ports from the public internet.
4+
5+
## Prerequisites
6+
7+
- A Linux VPS (Ubuntu/Debian recommended)
8+
- Node.js (v18+)
9+
- PM2 (optional, for running the project in the background)
10+
- The [Tandem Engine CLI](https://github.com/your-org/tandem)
11+
12+
## 1. Setup the Tandem Engine
13+
14+
First, install the tandem engine directly on your VPS. Provide it access to local AI providers or proxies as well as MCP components.
15+
16+
Generate a secure Server Token. Do NOT lose this.
17+
18+
```bash
19+
tandem-engine token generate
20+
```
21+
22+
_(Copy the generated UUID. We'll need it later)._
23+
24+
Start the headless engine running in the background. It will bind to `localhost:39731` by default.
25+
26+
```bash
27+
nohup tandem-engine serve --headless &
28+
```
29+
30+
_(Alternatively, run it using a robust service manager like SystemD)._
31+
32+
## 2. Setup the Web Portal
33+
34+
Clone this repository or copy the `vps-web-portal` directory to your VPS.
35+
36+
Navigate to the project directory and install the required dependencies:
37+
38+
```bash
39+
cd vps-web-portal
40+
npm install
41+
```
42+
43+
### Environment Configuration
44+
45+
Create a `.env` file in the root of the portal directory:
46+
47+
```env
48+
# The port the Node/Express proxy will listen on (Publicly accessible)
49+
PORT=80
50+
51+
# The Secret Key used to login to the secure Web Portal URL
52+
VITE_PORTAL_KEY=my_secret_password_123
53+
54+
# The Token generated by 'tandem-engine token generate' in Step 1
55+
VITE_ENGINE_TOKEN=your-generated-tandem-token-here
56+
57+
# (Optional) Engine local address
58+
VITE_TANDEM_ENGINE_URL=http://127.0.0.1:39731
59+
```
60+
61+
## 3. Build & Run
62+
63+
Build the Vite React frontend for production:
64+
65+
```bash
66+
npm run build
67+
```
68+
69+
Start the Node.js Express server to host the application. We recommend using PM2 to keep the server alive forever:
70+
71+
```bash
72+
npm install -g pm2
73+
pm2 start npm --name "tandem-portal" -- run start:server
74+
```
75+
76+
_(Alternatively, you can just run `npm run start:server` directly for testing)._
77+
78+
## Usage
79+
80+
Visit your server's public IP or Domain name in your browser (e.g., `http://your-server-ip:80`).
81+
You will be greeted by the Login portal. Enter the `VITE_PORTAL_KEY` you configured earlier to unlock the dashboards.
82+
83+
### Included Dashboards
84+
85+
1. **Deep Research:** Unleash an agent to scour the public web and answer heavy research questions.
86+
2. **Parallel Swarm:** Submit an idea and watch 3 distinct personas debate its merits simultaneously using the Parallel APIs.
87+
3. **Interactive RPG:** An AI Text Adventure game demonstrating the `Questions API` over Streaming SSE.
88+
4. **Second Brain:** Grant an agent local system context using Local MCP (Model Context Protocol).
89+
5. **Connectors:** Setup Slack, Discord, or Telegram bots so your team can @ the engine directly.
90+
91+
## Security Note
92+
93+
**Never** expose port `39731` to `0.0.0.0` or disable the firewall on a public VPS. Only the Reverse Proxy (this portal) should converse with the background Tandem engine locally, proxying authenticated REST and SSE requests.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
import { defineConfig, globalIgnores } from 'eslint/config'
7+
8+
export default defineConfig([
9+
globalIgnores(['dist']),
10+
{
11+
files: ['**/*.{ts,tsx}'],
12+
extends: [
13+
js.configs.recommended,
14+
tseslint.configs.recommended,
15+
reactHooks.configs.flat.recommended,
16+
reactRefresh.configs.vite,
17+
],
18+
languageOptions: {
19+
ecmaVersion: 2020,
20+
globals: globals.browser,
21+
},
22+
},
23+
])

examples/vps-web-portal/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>vps-web-portal</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)