# Archivum A high-performance, production-ready wiki system optimized for Desktop and Mobile, designed to run on a Raspberry Pi 5 (ARM64) or any AMD64 host. ## Tech Stack - **Backend:** Go (Golang) + GraphQL (gqlgen) + SQLite (modernc.org/sqlite). - **Frontend:** Vue 3 (Composition API) + Vite + Tailwind CSS. - **PWA:** Vite-plugin-pwa for mobile installation and offline caching. - **Version Control:** Git (Backend executes Git commands on the storage path). - **Editor:** TipTap (Visual) and CodeMirror (Manual AsciiDoc). - **Auth:** LDAP + JWT with in-memory session tracking. ## Core Architectural Flow ### 1. Configuration & First-Run Setup - **Config Management:** Separate `config.json` (Backend) and `settings.json` (Frontend). Paths defined via Docker environment variables. - **Initial State:** If configs are missing/empty, API signals `REQUIRE_SETUP`. Frontend triggers a "Setup Wizard" for LDAP, Admin user, and Storage paths. ### 2. Mobile & PWA Optimization - **Responsive Design:** Mobile-first UI using Tailwind. The sidebar (tree view) should become a slide-over menu on mobile. - **Read-Optimized:** Documents must be perfectly rendered for small screens with adjustable font sizes. - **PWA Features:** Manifest and Service Worker for "Add to Home Screen" support, fast loading, and basic offline viewing of cached documents. ### 3. Git-Storage & History - **Save Operation:** Receive AsciiDoc string + Commit Message -> Write to disk -> Git Commit with user as author. - **History & Diff:** GraphQL queries for commit logs and unified diffs. ### 4. The Visual Transformer (Round-trip) - TypeScript "Bridge" using **Asciidoctor.js AST**: - `toTipTap(asciidoc: string): JSON` - `fromTipTap(json: JSON): string` ## Detailed Requirements ### Backend (Go) - **CGO-Free:** Pure Go SQLite for multi-arch support (ARM64/AMD64). - **Git:** Manage repo via `os/exec` or `go-git`. - **Auth:** LDAP + Salted Bearer tokens. ### Frontend (Vue 3) - **Hybrid Editor:** Seamless toggle between Visual (TipTap) and Source (CodeMirror). - **Mobile UI:** Collapsible navigation and touch-friendly buttons. - **Setup Wizard:** Dedicated route for initial configuration. ### Docker & Deployment - **Multi-Stage Dockerfile:** Multi-arch support. - **Volumes:** Handle `${DOCKER_PATH}/config` and `${DOCKER_PATH}/data`. - **Permissions:** Respect PUID/PGID for file system access. ## Deliverables 1. Full project structure. 2. PWA configuration (`vite-plugin-pwa`) and responsive layout components. 3. The TypeScript Bridge for AsciiDoc <-> TipTap conversion. 4. Multi-arch Dockerfile and Docker Compose template. 5. README.md with setup guide and JSON schema.