Files
wpide-server/README.md
T

55 lines
1.6 KiB
Markdown

# wpide-server
Closed orchestrator server for the WordPress IDE plugin. The plugin (open
GPL client) routes its agentic chat through this server when "server
mode" is on, otherwise falls back to its own local orchestrator. See
`plans/server-app-for-wp-harmonic-eclipse.md` in the parent repo for the
full architecture.
## Local dev (this PC, Windows, no Docker)
Requirements: Node 20+. Optional: Caddy 2 for TLS.
```bat
cd wpide-server
start-dev.bat
```
The script copies `.env.example` to `.env` on first run, installs deps,
and starts Fastify on `http://127.0.0.1:3017`. (Port 3017 was chosen to
avoid colliding with common Node app defaults like 3000.)
Smoke test:
```bash
curl http://127.0.0.1:3017/v1/health
curl -X POST http://127.0.0.1:3017/v1/runs \
-H "content-type: application/json" \
-d '{"goal":"hello"}'
```
Expected: health returns version/uptime JSON; `/v1/runs` with a greeting
returns the full PHP-compatible response shape with `mode: "greeting"`.
A real prompt requires `OPENAI_API_KEY` in `.env` — without it the
response is still the standard shape but `success: false` with a clear
error message.
## Future prod (other PC, Coolify)
Coolify reads `Dockerfile`. The build is a standard multi-stage Node 20
alpine image. See the plan file for the Gitea + Coolify wiring.
## Layout
```
src/
server.ts Fastify boot
config.ts Zod-validated env loader
routes/health.ts GET /v1/health
db/pool.ts SQLite (dev) / Postgres (prod) abstraction
lib/logger.ts pino + pino-pretty
```
Subsequent milestones add `routes/runs.ts`, `routes/license.ts`,
`orchestrator/*`, `providers/*`, `agents/*`, `site-callback/*`.