#278·AI-Trader

Local dev setup fails out of the box: `email-validator` missing from requirements, and no Vite proxy for the frontend's relative `/api` calls

Author: sylschengul-lgtmCreated Aug 7, 2026Updated Aug 7, 2026

Following the self-hosting instructions in the README (SQLite mode), the stack does not start as shipped. Two independent issues, both small fixes. Happy to open a PR for either.

Environment

OS Windows 11 (Git Bash)
Python 3.13.14
Node / npm 24.18.0 / 11.16.0
Vite 5.4.21
Commit main, cloned 2026-07-25

1. Backend: email-validator is missing from service/requirements.txt

Installing exactly what is pinned and then starting the server fails immediately.

Reproduce

bash
cp .env.example .env          # DATABASE_URL left empty -> SQLite
python -m venv .venv
./.venv/Scripts/python.exe -m pip install -r service/requirements.txt
./.venv/Scripts/python.exe service/server/main.py

Result

File ".../pydantic/networks.py", line 967, in import_email_validator
    raise ImportError("email-validator is not installed, run `pip install 'pydantic[email]'`") from e
ImportError: email-validator is not installed, run `pip install 'pydantic[email]'`

Cause — the request models use pydantic's EmailStr, which requires the optional email-validator package. service/requirements.txt pins pydantic>=2.5.3 without the email extra, so the dependency is never installed.

Suggested fix — in service/requirements.txt, either add the extra:

diff
-pydantic>=2.5.3
+pydantic[email]>=2.5.3

or list it explicitly:

diff
 pydantic>=2.5.3
+email-validator>=2.0.0

Note on diagnosis — this failure is easy to miss because main.py configures logging to service/server/logs/server.log only. Nothing appears on stdout unless API_STDERR_LOG=true is set, so the server looks like it exits silently. It might be worth logging startup failures to stderr unconditionally.


2. Frontend: no Vite proxy, but the API base is a relative path

service/frontend/src/appShared.tsx:90:

typescript
export const API_BASE = '/api'

service/frontend/vite.config.mts sets only server.port = 3000 and defines no proxy. With the dev server on :3000 and the backend on :8000, every request goes to http://localhost:3000/api/..., which the Vite dev server does not serve.

Result — the app builds and renders, but all API calls fail. There is no console error that points at the cause, so it presents as a UI that simply shows no data.

That .env.example ships CLAWTRADER_CORS_ORIGINS=http://localhost:3000,... suggests :3000 -> :8000 is the intended local topology, which makes the missing proxy look like an oversight rather than a design choice.

Suggested fix — in service/frontend/vite.config.mts:

diff
   server: {
-    port: 3000
+    port: 3000,
+    proxy: {
+      '/api': { target: 'http://localhost:8000', changeOrigin: true }
+    }
   }

Verification — with both fixes applied the full stack works. Backend registers 122 routes, /docs and /openapi.json return 200, /api/claw/agents/me correctly returns 401 unauthenticated, selfRegister -> token -> /me round-trips against the local SQLite file, and the frontend's calls (/api/trending, /api/challenges, /api/profit/history, /api/claw/agents/count) all return 200 through the proxy with no console errors.


Minor, possibly worth a separate issue

service/README.md states:

This directory contains the proprietary server implementation for AI-Trader.

  • main.py - Full FastAPI backend implementation

All 39 modules are present in service/server/ and the server runs fine from this repo, so that wording is misleading for anyone evaluating whether self-hosting is viable — it reads as though the open-source copy is a stub.

Generated with Claude Code