# PubScript A self-hostable, multi-user writing studio for novelists — one codebase that runs as a web app and as a native desktop app, with a local-first AI co-writing engine built in. See **[PLAN.md](./PLAN.md)** for the full vision, architecture, and data model. The `CHUNK#n.md` files are the executable work orders. ## Quickstart ```bash pnpm i && pnpm dev # run the app shell at http://localhost:5173 pnpm test # run every workspace's unit tests pnpm typecheck # strict TypeScript across the monorepo pnpm build # build web + server ``` ## Docker (self-host) ```bash docker compose -f docker/compose.yaml up --build # → http://localhost:8080 (health: curl localhost:8080/api/health) ``` One container serves the web app, runs the Fastify API, and stores SQLite on a volume. ## Repository layout | Path | What it is | |---|---| | `PLAN.md` | Single source of truth for *what* and *why* | | `CHUNK#n.md` | Executable, step-by-step work orders | | `apps/web/` | React 19 + Vite app (runs in browser AND in Tauri) | | `packages/core/` | Domain types, ULIDs, time, token budget, `StorageAdapter` contract | | `packages/ui/` | Design tokens, theme engine (Ink / Parchment / Nocturne / Terminal), component kit | | `server/` | Fastify + SQLite: auth, multi-tenant, WS, admin, AI proxy | | `docker/` | Dockerfile + compose (one container serves app + API + data) | | `docs/` | ADRs, data model reference, AI role prompts, parity matrix | ## Status **CHUNK #1 through #8 are complete and CI-green:** the monorepo with strict TypeScript, the app shell and theming system, the `packages/core` contracts, the Fastify multi-tenant server, the TipTap writing surface, characters & world-building, the plot & whiteboard surface, the export pipeline (Markdown/HTML/EPUB/DOCX/ODT/PDF with an ExportDialog), and the AI provider layer (`packages/ai` — provider config/discovery, streaming, thinking params, token budget, 71 passing tests). `pnpm typecheck`, `pnpm test`, `pnpm lint`, and `pnpm build` all pass across the workspace. *Next: [CHUNK #7](./CHUNK%237.md) — Spell & Grammar.* **CHUNK #9 (AI Roles & Suggestions) and CHUNK #10 (Multi-User Admin & Sharing)** have their full backend/protocol layer implemented and tested — the AI roles, context builder, tools, accept/reject/pin, and session persistence in `packages/ai`, plus the admin API, roles, project sharing, audit logging, and multi-tenant isolation in `server/`. **Their web UI is still a stub** (`apps/web/src/routes/AI.tsx` and `apps/web/src/routes/Admin.tsx` are static pages awaiting integration with the backend). **CHUNK #11 (Packaging, Parity & Polish)** has Docker packaging done (`docker/compose.yaml`, one container serving app + API + SQLite). The remaining items — Tauri desktop bundles for 3 OSes, the parity matrix, onboarding, import/backup, and perf/a11y polish — are not started.