This commit is contained in:
26
README.md
26
README.md
@@ -11,11 +11,12 @@ languages, each with its own address.
|
||||
|
||||
```
|
||||
mathew/
|
||||
├── dev.sh # start/stop both dev servers together
|
||||
├── dev.sh # start/stop all three services together (lean via docker compose)
|
||||
├── docker-compose.yml # nginx + frontend + backend (prebuilt images)
|
||||
├── nginx.conf # reverse proxy: / → frontend, /api/ → backend
|
||||
├── backend/ # Express 5 + Mongoose API (port 5000)
|
||||
└── frontend/ # Nuxt 4 / Vue 3 wiki UI (port 3000)
|
||||
├── frontend/ # Nuxt 4 / Vue 3 wiki UI (port 3000)
|
||||
└── lean/ # Lean editor server (lean4web) — its own Docker image (port 8080)
|
||||
```
|
||||
|
||||
## Quick start
|
||||
@@ -36,19 +37,23 @@ npm install
|
||||
npm run dev # → http://localhost:3000
|
||||
```
|
||||
|
||||
Or run both together from the repo root:
|
||||
Or run everything together from the repo root:
|
||||
|
||||
```bash
|
||||
./dev.sh # both dev servers in the foreground (Ctrl+C stops both)
|
||||
./dev.sh # all three services in the foreground (Ctrl+C stops all)
|
||||
./dev.sh start|stop|restart|status
|
||||
./dev.sh logs [all|backend|frontend]
|
||||
./dev.sh logs [all|backend|frontend|lean]
|
||||
```
|
||||
|
||||
The third service is the **Lean editor server** (`lean/`), run through docker compose
|
||||
alongside the two npm dev servers — the image's first build fetches Mathlib, so give it
|
||||
time; without docker, `dev.sh` warns and starts backend + frontend anyway.
|
||||
|
||||
### Scripts
|
||||
|
||||
| Where | Command | What it does |
|
||||
| --- | --- | --- |
|
||||
| root | `./dev.sh [dev]` | Both dev servers, foreground, tagged output, one Ctrl+C stops both |
|
||||
| root | `./dev.sh [dev]` | All three services, foreground, tagged output, one Ctrl+C stops them all |
|
||||
| `backend/` | `npm run dev` | API with `node --watch` (no build step) |
|
||||
| `backend/` | `npm start` | API without watch |
|
||||
| `backend/` | `npm run seed` | A handful of sample articles |
|
||||
@@ -66,6 +71,7 @@ There is **no test suite, linter, or typecheck script** configured.
|
||||
| `backend/.env` | `JWT_SECRET` | *(insecure dev key)* | Signs session tokens — set this in production |
|
||||
| `backend/.env` | `AUTH_TOKEN_TTL` | `7d` | How long a session lasts |
|
||||
| `frontend` env | `NUXT_PUBLIC_API_BASE` | `http://localhost:5000` | Where the UI calls the API |
|
||||
| `frontend` env | `NUXT_PUBLIC_LEAN_URL` | `http://localhost:8080` | The Lean server (`lean/`) the editor talks to |
|
||||
|
||||
## How it works
|
||||
|
||||
@@ -117,6 +123,7 @@ first paint so there is no flash. Colours are CSS custom properties swapped by
|
||||
| `/` | Search, recently viewed, a way into the shelf |
|
||||
| `/articles` | The shelf, filed by topic — one folder per topic, opening onto a batch-at-a-time grid of cards; language and topic filters are applied by the API |
|
||||
| `/graph` | The wiki's link map: one node per article, one edge per linked pair |
|
||||
| `/lean` | The Lean 4 editor — Monaco with a live Goals/Messages infoview, talking to its own Lean server (`lean/`) |
|
||||
| `/wiki/<lang>/<slug>` | One language version of an article, drawn as a page of the book with its table of contents |
|
||||
| `/wiki/<slug>` | The short form, naming no language — turned onto the version the slug speaks |
|
||||
| `/wiki/<slug>/edit` | Markdown editor with live preview (Write / Split / Preview) |
|
||||
@@ -197,6 +204,13 @@ passing the standard forwarded headers. Point `NUXT_PUBLIC_API_BASE` and `MONGO_
|
||||
deployment's real addresses and set a real `JWT_SECRET` — the fallback key is a development
|
||||
convenience only, and anyone holding it can mint a session.
|
||||
|
||||
The stack also runs `lean` — the Lean server built from [`lean/`](lean/README.md),
|
||||
listening on `8080` with its websocket on that one port; the wiki's editor speaks the
|
||||
Lean language protocol to it directly. It keeps no
|
||||
state of the wiki's, but it runs real Lean for every session, so plan the machine
|
||||
accordingly; point `NUXT_PUBLIC_LEAN_URL` at the address the browser reaches (https if
|
||||
the site is https — the `wss://` is derived from it, and mixed content is blocked).
|
||||
|
||||
## Notes for contributors
|
||||
|
||||
[`AGENTS.md`](AGENTS.md) is the working map of the codebase: file-by-file layout, the
|
||||
|
||||
Reference in New Issue
Block a user