# RustPad 0.0.1 Collaborative Markdown editor with standalone notes and workspaces. ## Development setup ```bash ./dev.sh ``` The script creates `data/db` and `data/files`, builds the project, and runs it with Cargo. When Cargo is unavailable, it uses `docker compose up --build`. ## Functions (Workspaces) - real-time collaborative editing over WebSocket, - nickname remembered in `localStorage`, - change authors in history, - line numbering enabled by default with a persistent toggle, - owner color next to each line, - upload images and files to `data/files/pads/_/` lub `data/files/notes/_/`, - automatic Markdown link insertion after upload, - Markdown i diagramy Mermaid, - history with snippets, previews, and version restore. ## Data - SQLite: `data/db/rustpad.db`, - files: `data/files/pads/_/` i `data/files/notes/_/`; the public URL has the form `/f//`. In Docker, both directories are located under `/data`. ## Publishing a note as a page Use the **Page** button in the editor. RustPad creates a permanent public `/s/` address, copies it to the clipboard, and opens it in a new tab. The page displays the current note content and renders Markdown, images, links, and Mermaid. Publishing a protected note requires the password, but the published link itself is public. ## Limit uploadu The maximum size of a single file is configured with `UPLOAD_MAX_SIZE_MB` w `.env`, np. `UPLOAD_MAX_SIZE_MB=50`. The default is 20 MB. After changing it, restart the project with `./dev.sh`. ## Wybór bazy danych RustPad wybiera silnik na podstawie `DATABASE_URL`: - SQLite: `sqlite:///data/db/rustpad.db?mode=rwc&journal_mode=WAL&busy_timeout=5000` - PostgreSQL: `postgres://rustpad:rustpad@postgres:5432/rustpad` - MySQL: `mysql://rustpad:rustpad@mysql:3306/rustpad` SQLite pozostaje domyślną bazą dla developmentu i małych instalacji. Tryb WAL pozwala czytać podczas zapisu, ale SQLite nadal wykonuje tylko jeden zapis naraz. `busy_timeout=5000` powoduje krótkie oczekiwanie zamiast natychmiastowego błędu `database is locked`. Przy wielu równoczesnych edytorach lub wielu instancjach aplikacji zalecany jest PostgreSQL albo MySQL. Opcjonalne bazy w Docker Compose: ```bash # PostgreSQL docker compose --profile postgres up -d postgres DATABASE_URL=postgres://rustpad:rustpad@postgres:5432/rustpad docker compose up -d rustpad # MySQL docker compose --profile mysql up -d mysql DATABASE_URL=mysql://rustpad:rustpad@mysql:3306/rustpad docker compose up -d rustpad ``` Migracje są rozdzielone w `migrations/sqlite`, `migrations/postgres` i `migrations/mysql`. Zapytania aplikacji znajdują się centralnie w `src/queries.rs`, a `src/database.rs` odpowiada za wybór sterownika i konfigurację połączenia.