Pax Historia-style sim where the LLM is the world engine.
- React 19 + Vite 6 + Tailwind v4 + shadcn/ui frontend
- Express single-port backend (/api + /sse + built client + SPA fallback)
- SQLite (better-sqlite3) persistence, one row per game
- MapLibre choropleth map (OpenFreeMap dark + ISO_A3 regions)
- Defensive turn loop: strip fences, balanced-{} extract, parse, clamp 0-100,
retry-once nudge, generic 'unclear' fallback; never crashes on bad output
- 5 seed presets (wwii-1939, coldwar-1955, modern-2025, no-wwii-1940, aegis-2400)
- LLM client over native fetch w/ injectable transport (mesh-bot pattern);
LLM_STUB=1 deterministic transport for tests/e2e
- Unit (vitest, 19) + deterministic Playwright e2e
- Multi-stage node:22-slim Docker + Traefik (history.dev.kkhost.pl:4321)
Co-Authored-By: OpenCode <opencode@users.noreply.github.com>
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const here = fileURLToPath(new URL('.', import.meta.url));
|
|
|
|
// Dev ports default to the spec values; overridable via env so the e2e run can
|
|
// dodge a port that another project is already using (the client uses relative
|
|
// URLs, so it follows whatever port Vite binds).
|
|
const vitePort = Number(process.env.VITE_PORT ?? 5173);
|
|
const apiPort = Number(process.env.HISTORY_API_PORT ?? 4321);
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
'@shared': path.resolve(here, 'shared'),
|
|
'@': path.resolve(here, 'src'),
|
|
},
|
|
},
|
|
server: {
|
|
port: vitePort,
|
|
// The Express backend (tsx) listens on :4321. In dev, proxy the API and the
|
|
// SSE stream to it so the client never needs to know the backend origin.
|
|
proxy: {
|
|
'/api': { target: `http://localhost:${apiPort}`, changeOrigin: true },
|
|
'/sse': { target: `http://localhost:${apiPort}`, changeOrigin: true },
|
|
},
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
emptyOutDir: true,
|
|
},
|
|
});
|